Workbench scripting API: how to change DesignModeler design parameter?
Workbench scripting API: how to change DesignModeler design parameter?
(OP)
If one is using DesignModeler to create geometry which is controlled by parameters, is there a way to use a script or input file to change the parameters?
For instance: I have a 2D sketch of a box, with parameters "length" and "width". I want to be able to change these parameters from a script or input file.
There's a way to export a script describing how to create the whole sketch (File>Write Script: Sketch(es) of Active Plane), but the script output doesn't include parameter assignments; it just creates the geometry. I have read through the documentation for DesignModeler and Parameters, and can't find any mention of scripting functions for Parameters (as opposed to features like lines, arcs, sweeps, etc).
Thank you.
For instance: I have a 2D sketch of a box, with parameters "length" and "width". I want to be able to change these parameters from a script or input file.
There's a way to export a script describing how to create the whole sketch (File>Write Script: Sketch(es) of Active Plane), but the script output doesn't include parameter assignments; it just creates the geometry. I have read through the documentation for DesignModeler and Parameters, and can't find any mention of scripting functions for Parameters (as opposed to features like lines, arcs, sweeps, etc).
Thank you.





RE: Workbench scripting API: how to change DesignModeler design parameter?
sketch 1 = block
sketch 2 = block w/ circle
sketch 3 = block w/ circle, diameter of circle defined
sketch 4 = block w/ circle, two dimensions defied
Here are some notes that I made from my testing:
//Dimensions and/or constraints
with (p.Plane)
{
//Dimensions
var dim;
dim = DiameterDim(p.Cr7, -4.72872215, 1.52221530, 0);
if(dim) dim.Name = "D1";
//Constraints
}
the variable name is defined at D1, seen in the dim.Name specification. I'd have to go back further into my notes to see how you change the values, but it should be fairly basic jscript formating.
Hope this helps,
Doug