sree314 / stepcvt

Generate STL files for 3D printing from STEP files
2 stars 0 forks source link

subparser for choices module #40

Closed redrn closed 10 months ago

redrn commented 11 months ago

Implement CLI subparser for choices module, functionalities include but not limited to:

redrn commented 10 months ago

Specific CLI subcommand interface:

Add a new chooser:

stepcvt choices add-chooser [--type TYPE] TEXT VARNAME (TEXT:VARNAME[:COND])+

Add a new choice effect:

stepcvt choices add-effect --partid PARTID --type TYPE --value VALUE --cond COND

Replace a component of a chooser:

stepcvt choices edit VARNAME [--choice-value TEXT] (TEXT:VARNAME[:COND])+

Remove a chooser or a component of it

stepcvt choices remove VARNAME [--choice-value TEXT] [--cond]

Apply user choices

stepcvt choices apply (VARNAME=VALUE(,EXTRA_VALUES)*)+

Examples

stepcvt -j file.json choices add-chooser --choice-type single "Printer Options" "options" "HEPA filter":"Filter" "Build area lights":"Lights":"version=='V6'"

Add a SingleChooser with potential values of 'Filter' and 'Lights' that requires 'version == V6'.

stepcvt -j file.json choices add-effect --partid SB_V6_TH_Front --type relative-count --value 2 --cond version=='V6'

Add a relative count choice effect for the part SB_V6_TH_Front, dependent on choice variable version=='V6'.

stepcvt -j file.json choices edit "options" --choice-value "Lights" "Build area lights":"Lights":"version=='V4'"

Change the 'Lights' choice value in the 'options' chooser to have a different version requirement.

stepcvt -j file.json choices remove "options" --choice-value "Lights" --cond

Remove the precondition requirement for the 'Lights' option.

stepcvt -j file.json choices apply Version=V6 Options=Lights,Filter

Apply user choices of version 'V6' and 'Lights' and 'Filter' options enabled

redrn commented 10 months ago

TODO: add support for ChoiceEffect classes

sree314 commented 10 months ago

Roy, could you add examples for each of the command line options above. That may help clarify what the command is supposed to do, and how to use it.

redrn commented 10 months ago

Roy, could you add examples for each of the command line options above. That may help clarify what the command is supposed to do, and how to use it.

Updated the documentation to include examples, pulled from comments in the code.

redrn commented 10 months ago

TODO: change apply subcommand to prompt the user for selecting choices and then either 1) export all based on user chocices 2) apply choices calculation and strip all choices information for the new json config

Edit: Finished and merged in cli in commit d6b434d

redrn commented 10 months ago

All intended functionalities are completed and tested. We can work on simplifying the interface later. Closing as of now