Enhancement: Support nested interactive parameters
Currently the getParameterDefinitions() function accepts 4 types: float, int, text, and choice
I am proposing a fifth type that would allow for nesting / grouping of parameters.
This would be useful for scripts which have multiple independent pieces with their own parameters.
Here is an example of how I would picture it being used:
{
name: 'chassisBolt', // a javacsript object will be created, filled with its own parameters
type: 'parameterGroup', // not sure best name for param type, other ideas include 'object', 'group', 'grouping'
caption: 'Chassis Bolt', // optional, displayed as a heading above its own parameter list
// if omitted, the 'name' is displayed (i.e. 'chassisBolt')
parameters: { // params go here in the same manner as at the 'top level', including possibly more parameter groups
{ name: 'headDiameter', type: 'float', initial: 6, caption: 'Head Diameter:' }
{ name: 'shankDiameter', type: 'float', initial: 3, caption: 'Shank Diameter:' }
{ name: 'length', type: 'float', initial: 20, caption: 'Length:' }
}
}
When a parameter group is defined the interactive parameter window should generate a bold heading with the given caption or name, and list all contained parameters beneath it, indented some amount.
Then if I have a function that only needs the bolt related parameters I can pass in params.chassisBolt object and leave out all the other unrelated parameters.
I agree. A group of the parameters is more important then a title, and allows more flexibility. I have this coded already but have to wait for some additional merges to occur first.
@thehans please look at some of the designs at www.z3d.jp This website has support for "groups" already.
Basically, the "group" parameter becomes a new row in the table of parameters, and contains a single header (HTML "th" element). And of course, a new style is added to the CSS file.
Good?
I don't see any openjscad on that site, not sure what I'm supposed to be looking at.
Sorry. I didn't provide a complete URL. Please review some of the designs at http://www.z3d.jp/lab/
@thehans grouping of parameters has been implemented, and groups can be collapsed or expanded interactively.
please try the 'Birthday Ballons' example as www.openjscad.xyz