OpenJSCAD.org icon indicating copy to clipboard operation
OpenJSCAD.org copied to clipboard

Enhancement: Support nested interactive parameters

Open thehans opened this issue 10 years ago • 5 comments

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.

thehans avatar Apr 08 '15 17:04 thehans

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.

z3dev avatar Apr 10 '15 01:04 z3dev

@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?

z3dev avatar Aug 28 '15 00:08 z3dev

I don't see any openjscad on that site, not sure what I'm supposed to be looking at.

thehans avatar Aug 28 '15 01:08 thehans

Sorry. I didn't provide a complete URL. Please review some of the designs at http://www.z3d.jp/lab/

z3dev avatar Aug 29 '15 02:08 z3dev

@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

z3dev avatar May 30 '21 06:05 z3dev