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

**First time visiting? Here are some places to start:**

- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.

# sketch equations and variables

**12**✭✭

It could be great to have the possibility of using equations in the sketch.

Sometimes a dimension is related with a driven dimension, in this case there is no possibility to solve with variables. Now it has to be changed manually. This is not the only case where equations are useful.

It could be great to work with equations.

Some ideas for dimension visualization without the need of editing them to see what is inside

- When a dimension is an input value, could be just a number; 123 like now is

- When a dimension is an equation can be = 123 , where = means the result of an equation

- When a dimension is variable can be: (x) 123 , according to the OS tool

- When a dimension is the result of an equation which involve 1 or more variables, could be: = (x) 123

Variables could be global, and be used across different tabs, even different documents, including assemblies as well. Global variables are already posted by other users.

## Comments

705PROhttps://cad.onshape.com/documents/77baa8153589a7fc5f289829/v/33ba34fba75bf5f4ba08ed63/e/181cb871f3008e6b885df46a

I used to love making a dimension equal to another with a bit of math added in when I used SolidWorks. I find this new method in Onshape a lot more robust. Its also a lot harder to fall into an accidental circular referencing situation. If you change the way you are approaching things slightly I think you will find you can accomplish everything and more with this measuring tool.

BTW, you can do math in a sketch incase you were not aware. You just can't make one dimension equal another.

1,717PRO12✭✭Hi Shawn and S1mon,

I had used MEASURE DISTANCE https://cad.onshape.com/documents/572b968ce4b07aad125dbaaf/v/6cdbbe0e7f24b6c78ed27e97/e/b1f5ab07bb8056d230959ebe which is similar to the MEASURE VALUE you say. They are useful in specific situations but once you get a measurement of something of a (closed) sketch you can't use that result in that same sketch, you only can use that result, that generates a variable (not a fix value, but a value that depends on a geometry) in a future sketch, as far as I know. As S1mon said, I use construction lines equal to each other to have a fraction of a line and then make 1 of them equal to what I need. Sometimes over 2 or + segments I have to draw another construction line overlapped to have a different measurement. The same idea applies to arcs. Also, I had to make a construction line with a specific angle and draw a projection and get a specific proportion. This is indirect, takes more time and messes up the sketch, and where it is not possible, it is necessary to input a value (which doesn't update). I used a lot equations in Solidworks and I would like to see soon the same solved in a nice Onshape way. Thank you.

648✭✭✭✭You can't directly say dimB = 2*dimA. But, you CAN say dimA = #varA, then set dimB = #varA*2.

Its one extra step, but the variable you create inside of a sketch (#varA) becomes available in your feature tree so that you can use it in other features and sketches as well.

Variable (onshape.com)

648✭✭✭✭One other thought - since its' possible to use expressions and equations in your variable definitions, you can often times do many of your calculations outside of the sketch, then just reference those variables when you're drawing your geometry.

12✭✭Hi Tim,

Yes, I had been creating variables within the sketch, and it is time saving, instead of going out of the sketch and creating a variable and positioning them before the sketch in the tree, so then they can be used in the sketch. It can be possible to do some indirect math as you said "You can't directly say dimB = 2*dimA. But, you CAN say dimA = #varA, then set dimB = #varA*2" and is correct, I used this many times, it works well, is very useful especially if the variables are going to be used in different sketches, but at the same time, for some cases, I would like to have the math in the direct method and keep the tree cleaner.

But the problem is that the variables are always before the sketch and not into it, so in some cases it is impossible to solve. Here is an example https://cad.onshape.com/documents/536b9d79e1b6f0cf6cf0307b/w/b227a1c5b7b3f9a7c14ae60a/e/177dfebb9706d4453a2a9193 the rectangle has a height with the math method you say, here it works, I personally use it as well, but check inside the tilted ellipse (more difficult than rectangle to predict distances out of the sketch) and I want to make line 2 a factor (not integer, to complicate the case. auxiliary segments can't help) times of line 2: L2=L1x1.2345 so here is not a preference of choice, an equation is the way to go.

BTW in sketch it could be good to write notes (although comment markup is a great help) and dimensions could have names, and could be displayed the value, the (optional) name (defined by user) before or after the value, with the possibility of toggling on / off the name visibility.