Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:

  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Working with Variables and Sketch dimensions.

douglas_clarkdouglas_clark Member Posts: 4

My first question here, probably a very basic one...

I have a sketch with a Variable driven dimension (#foo for eample), I would like to be able to:
  1. Read the value of the Variable
  2. Update the Variable to a new value (I assume that the sketch will recompute at that point).
  3. Read the value of driven (grey) dimensions in the sketch, or maybe get the properties of the elements they're connected to if its not possible to get at the driven dimension.
  4. Write the collected information out to a file.
On no. 3 I'd thought I assign a variable to the driven dimension so that the value of the variable would be driven not driving.  Then I expected to be able to get at that variable programmatically.  Obviously I've found you cannot assign a variable to a driven dimension, so at that point I am stuck.

I thought the SetVariable and GetVariable functions were going to be what I needed to get 1 and 2 done, that does not appear to be the case, so is this possible to do and if so whats the basic direction to take in doing it?

Thanks for the help.


Best Answer


  • jakeramsleyjakeramsley Member, Moderator, Onshape Employees, Developers Posts: 600

    I would take a look at the Measure Distance sample that Ilya has posted.  I'm not sure if getting a driven dimension in the sketch is going to work.  I'm guessing it would be simpler to allow for selection of the sketch entities in your feature and set whether it is vertical/horizontal/min distance (or whichever ones you are interested in) and compute the value based on that and store to your variable.
    Jake Ramsley

    Director of Quality Engineering              onshape.com
Sign In or Register to comment.