jscad / jscad/OpenJSCAD.org

Enhancement: Support nested interactive parameters

Open
#85 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

user interface website app
Dominant language
JavaScript
Stars
3.2k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating getParameterDefinitions() and the code that generates the interactive parameter window. Trace how the existing float, int, text, and choice types are represented and rendered, then define the nested group behavior, including headings, indentation, recursive groups, and the params.chassisBolt object shape. Done means grouped parameters render correctly and nested values are passed to the script as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.