×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Workbench scripting API: how to change DesignModeler design parameter?

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.

RE: Workbench scripting API: how to change DesignModeler design parameter?

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources