Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Workbench scripting API: how to change DesignModeler design parameter?

Status
Not open for further replies.

abeschneider

Mechanical
Sep 25, 2003
189
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.
 
Replies continue below

Recommended for you

Scripting in DM can be pretty tricky. I kind of taught myself how to do this by slowly building up a sketch. For example

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor