9th July 2016

Made design and requirement document for New feature i.e to save set of parameters in JSON format.

New Feature:
Add feature to save the set of parameters of models in JSON file format and add the ability to read that file and append.
Functionality:

  1. This feature should be supported both by UI and cmd line.
  2. Basically, store the currently selected values of parameter into a file. ( get values and parameters from parameterObject ).
  3. It will consist of primarily of parameter – value pairs but We can add create time and update time in this.
  4. The GUI would be responsible to make ComboBox to select the set of Parameter, add new set ,delete set, update set.
  5. To apply set of parameter from .json file we need to define a function applyModelParameter() which would be accessible
    from both GUI and cmdlin this will probably in new class or part of ParameterExtractor class.

    1. In GUI we need to select the model from combo box to apply it.
    2. for cmdline we need to give cmd something like:
      1. openscad -o model-2.stl -p parameters.json -P model-2 model.scad
  6. Advance:
    1. There could even be an automatic “custom” parameter set which just tracks what the user has currently entered
    2. Basically, tracking the latest selection

Points to ponder:

  1. What to do if the file is not saved yet, so we don’t have a file name for the scad script itself.
    1. solution:
      1. On clicking add parameter set button, we will ask to first save file.
      2. Disable the combo box
  2. What if value saved in json gets out of range from that described by current parameter in .scad file.
    1. e.g. if we saved variable with value 50. i.e. variable:50 in json file and in .scad file we have.

      @parameter([1:40])
      variable=30;

      Similarly if we have in scad file.

      @parameter([10,15,20,25])
      variable=20;
    2. Question:

      1. Then should we apply the value or not
      2. if we apply should we reflect new values with input widgets for parameters or not or should we give a message.
  3. What if we change the type of parameter in .scad file and apply parameter set from json file with parameters with different type.
  4. When to save parameter in file on updating, on saving the .scad file or when we close the openscad software.

Design:

  1. Function to be used:
    • Part of ParameterExtractor:
      • getParameterSet() // to read json file and make a data structure to store them.
      • applyfromSetl() // to apply parameter from selected set
    • ParameterWidget:
      • addToCombox() // add the name of set of Parameter to the combobox in parameterWidget.
      • onSetSelect() // apply selected set of parameters to the AST
      • deleteSet() // delete given set of parameters
      • addNewSetl() // It will add new set or update the current selected set
  2. Data structure to be used:
    1. map< name of set, setOfParameter>
    2. setOfParameter:
      Vector: Vector< parameterPair>

      1. ParameterPair: struct parameterPair{ string name; ValuePtr value};
      2. Map: map<string,ValuePtr>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s