Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spreadsheet functionality #3639

Closed
portnov opened this issue Oct 11, 2020 · 19 comments
Closed

Spreadsheet functionality #3639

portnov opened this issue Oct 11, 2020 · 19 comments
Labels
Discussion Proposal 💡 Would be nice to have

Comments

@portnov
Copy link
Collaborator

portnov commented Oct 11, 2020

I'm not sure how exactly useful these things are, so at the moment I've put them to sverchok-extra master. These nodes do not require any dependencies; they can be easily moved to Sverchok, the only question is do we need them.

"Data Item" node.

This is similar to dictionary Out" node, but adopted to work with nested dictionaries. In node UI you select a "path" in the nested dictionary, and the node outputs the item. For example, you can calculate something like my_dict['Boxes']['MyBox']['Width']`.

Screenshot_20201011_221322

Or, for one (not more than one) of the nested keys you can say "All keys", this will be something like my_dict[*]['Width'] or my_dict['Box1'][*]:

Screenshot_20201011_221423

"Spreadsheet" node.

This is more cumbersome. It allows you to input data in spreadsheet-like interface. Each row ("item") has user-provided name, and each column also. Columns to be used are configured in the N panel of the node. Supported types of columns are: integer, float, vector, boolean, string and formula. Most interesting is, off course, formula. It gives a possibility to do calculations in a way similar to LibreOffice or Excel (without aggregation functions). Python syntax is used, as usual in Sverchok. You can refer to other cells of the same spreadsheet as RowName.ColumnName. You can refer to other columns of the same row just as ColumnName. Special input socket named Input is supported for nested dictionaries input (e.g. you can plug another spreadsheet here); you can refer to items of that dictionary as Input.RowName.ColumnName. Any other variables (apart from well-known functions such as sin or pi) will automatically become additional inputs of the Spreadsheet node.

The node can output data in several ways:

  • Dictionaries: Data output for nested dictionary, Rows output for RowName -> List of values in this row, and Columns for ColumnName -> List of values in that column.
  • By row: a separate output for each row, with list of values in that row.
  • By column: a separate output for each column, with list of values in that column.

Screenshot_20201011_223706

@vicdoval
Copy link
Collaborator

Seems very powerful, allows a not nodal behaviour in a nodal environment... also seems a bit confusing.. How did you create the "Center" item in the Center column?
Anyhow we have a Dictionary Category in the menu with only two nodes so it wouldn't harm to have more... so I would say yes to bringing this functionalities to Sverchok

@portnov
Copy link
Collaborator Author

portnov commented Oct 11, 2020

Columns are configured in the N panel:
Screenshot_20201011_233426

@Durman
Copy link
Collaborator

Durman commented Oct 12, 2020

When I was testing dictionaries I did not like node tree results they was too noddy. Data items nodes would definitely improve the situation but I think it will still require too much work of creating and linking nodes. Optimal solution could be create sockets right in nodes which should process the data.
Example how this could look like.
add sockets

@portnov
Copy link
Collaborator Author

portnov commented Oct 12, 2020

Well, the problem I tried to address is the following. I noted that every non-trivial node tree consists of the following blocks:

  1. Input parameters. 5-10 "A Number", "Vector In" or similar nodes.
  2. Parameters calculations. 15+ "scalar math", "vector in", "vector math", "formula" nodes, that calculate some values based on input parameters. Width of this should be equal to width of that plus radius of that, X coordinate of this should be half of depth of that, and so on, tons of it.
  3. Geometry generation. 5-10 nodes that create meshes or solids with inputs linked from parts 1 and/or 2.
  4. Geometry processing. 5-10 nodes that modify (and/or multiply) geometry taken from part 3, like adding fillets, doing booleans, extrusions and so on. Input sockets are again linked from parts 1 and/or 2.
  5. Outputs. 1-2-3 nodes like "viewer draw", "solid to mesh" or similar.

In my trees, the most complex, most "noddy" parts are 1 and 2, there are a lot of links between nodes there also. So I thought maybe it is possible to place such inputs and calculations into several spreadsheets. I did not manage to develop a good workflow, how should one usually use spreadsheets to replace or simplify parts 1 or 2. It is obviously possible, but I'm not sure how to do it in the best way.

@Durman
Copy link
Collaborator

Durman commented Oct 12, 2020

Just made an example how this could be simplified with node groups. It does not cover all functionality.
2020-10-12_11-32-42

@portnov
Copy link
Collaborator Author

portnov commented Oct 12, 2020

An example of what I'm talking about.
Screenshot_20201012_192516

Screenshot_20201012_193513

Here I marked geometry generators with green color, and "geometry modifiers" (like booleans and so on) are yellow. There are 10 input nodes framed in the left part. Collapsed nodes are instances of "scalar math", "vector in" and so on. As you can see there is a lot of them, and they create a mess of node links. If we could somehow simplify such setups it would be good.

One technology that Sverchok already has for it is "wifi nodes", they can help to make more clean layouts. I even have a draft of code somewhere that helps to create such nodes faster...

@Durman
Copy link
Collaborator

Durman commented Oct 12, 2020

I'm quite suspicious about wifi nodes. How all output wifi nodes can be identified in a tree? If there are hundreds of nodes in a tree it will be quite difficult task.With links there is no such problem.
Also it is not necessary to place all A number nodes in left side of the tree. It is possible to combine them in 3D panel where they can be easily organized.

@portnov
Copy link
Collaborator Author

portnov commented Oct 12, 2020

Yep, it's not necessary, just looks better (imho). Btw, maybe it worth to show the same panel in the N panel of node editor? Maybe even with option: to display all input nodes or just those marked with "to_3d".

@Durman
Copy link
Collaborator

Durman commented Oct 12, 2020

Why not but renaming should be done in this case I think. The panel should be renamed to something like Properties set and property should be named to prop set. But it can't be done easily because 3d panel shows properties of all trees but in N panel most likely we would like to have properties only current tree.

@nortikin
Copy link
Owner

nortikin commented Oct 12, 2020

to 3d is shortest and informative name. maybe to 3d panel, but not set. set() множество. What set? What to 3d?
to 3d panel more clear

@nortikin
Copy link
Owner

nortikin commented Oct 12, 2020

no conditions? to formula?
изображение

@nortikin
Copy link
Owner

do you have exec function after compile?

                if formula and isinstance(formula, str):
                    result[row_name][col_name] = sv_compile(formula)
    return result

@portnov
Copy link
Collaborator Author

portnov commented Oct 12, 2020

It understands expressions only, not statements. You can do 5 if condition else 3, but not if condition: statement else: ...
See https://docs.python.org/3/reference/expressions.html .

@nortikin
Copy link
Owner

nortikin commented Oct 12, 2020

i see now

изображение

@Durman Durman added the Proposal 💡 Would be nice to have label Nov 9, 2020
@portnov portnov closed this as completed Nov 18, 2020
@portnov
Copy link
Collaborator Author

portnov commented Nov 21, 2022

@vkter for now, it is in sverchok-extra addon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Proposal 💡 Would be nice to have
Projects
None yet
Development

No branches or pull requests

5 participants
@portnov @nortikin @vicdoval @Durman and others