Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
calculate_python_expression [2026/07/22 03:35] hermann |
calculate_python_expression [2026/07/22 18:15] (current) hermann |
||
|---|---|---|---|
| Line 57: | Line 57: | ||
| | [[Extract Struct Tuple]] | A tuple value | | | [[Extract Struct Tuple]] | A tuple value | | ||
| - | Each functor takes two inputs: the ''Struct'' returned by ''CalculatePythonExpression'', and the name of the entry to extract as a string constant. For example, to retrieve a numeric output named ''patchCount'' and a table output named ''filteredPatches'': | + | Each functor takes two inputs: the ''Struct'' returned by ''CalculatePythonExpression'', and the name of the entry to extract as a string constant. For example, to retrieve a numeric output named ''patchCount'' and a table output named ''filteredPatches'' — the ''String $"(...)"'' wrapper around the Python code is explained in [[#writing_the_expression_in_ego_script|Writing the expression in EGO Script]] below: |
| <code> | <code> | ||
| Line 127: | Line 127: | ||
| === dinamica.prepareTable() === | === dinamica.prepareTable() === | ||
| - | Converts a list of lists into a table ready to be assigned to an output. The first inner list must be the header row. | + | Converts a list of lists into a table ready to be assigned to an output. The first inner list must be the header row. As with any table (see [[ego_script#constants|Constants]]), each column's type is inferred from its own values: a column of ''int''/''float'' values produces a Real column, a column of ''str'' values produces a String column. |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ | ||
| Line 135: | Line 135: | ||
| === dinamica.prepareLookupTable() === | === dinamica.prepareLookupTable() === | ||
| - | Converts a list of lists into a lookup table ready to be assigned to an output. The first inner list must be the header row. | + | Converts a list of lists into a lookup table ready to be assigned to an output. The first inner list must be the header row. Lookup tables are always Real-typed on both key and value sides — there is no String option — so every value in ''lut'' must be numeric. |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ | ||
| Line 142: | Line 142: | ||
| === dinamica.toTable() === | === dinamica.toTable() === | ||
| - | Converts several Python data shapes into a valid Dinamica table for output. | + | Converts several Python data shapes into a valid Dinamica table for output. Column types are inferred the same way as ''dinamica.prepareTable()'' — except for a flat list, which always produces a Real-typed lookup table with sequential keys, matching the Real-only rule for lookup tables. |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ | ||
| Line 277: | Line 277: | ||
| CalculatePythonExpression | CalculatePythonExpression | ||
| - | |||
| - | |||