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.

Can you reference one dimension in a sketch when entering the value for another dimension?

brian_bradybrian_brady Member, Developers Posts: 505 EDU
Say I have a simple rectangle. I always want its height to be .4 times its width. Can I do this directly in a sketch? I am particularly looking at situations where I don't explicitly know what the width of the rectangle will be since it is generated by referencing other geometry when it is constructed. This is kind of like using variables, but created on the fly. In Creo (Pro/E) I would look at a dimension's identifier (i.e. d3) and make the other dimension 0.4*d3

Brian

Best Answer

Answers

  • jon_sorrellsjon_sorrells Onshape Employees Posts: 51
    As a workaround, you can use lines with equal constraints on them to specify the ratio of lengths.  For your case of making one side 0.4x the other, you can put two lines vertically and 5 lines horizontally, then make those 7 lines equal.
    Here's an example: https://cad.onshape.com/documents/4d46f0309ed541160c60804a/w/23b848821b3ef7439c5657bb/e/1e3a2060562fd41eb43fd561

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,212
    Also as a workaround, for an axis-aligned rectangle side ratio, a simpler and more general way is to make the diagonal parallel to that of a fixed construction rectangle with the right ratio.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • brian_bradybrian_brady Member, Developers Posts: 505 EDU
    I gave an example of a rectangle, but that was just for talking purposes. What I am doing is using OS as part of teaching a kinematics class. Everything we do is in sketches. Part of the design process for determining link lengths for various mechanism types is to use constructed geometry that must be measured. Currently I read a dimension that was added and perform math on it to generate the link lengths based on the required formulas. I can do the math inside OS in order, but I cannot reference the dimension directly to do it, so if I decide to change a starting value to make a different version of the mechanism, I have to read and type the new values instead of it happening automatically. If "in-sketch" dimensional referencing is ever added, this will be a piece of cake. Until then, I'll use another tool.
  • brian_bradybrian_brady Member, Developers Posts: 505 EDU

    This isn't a solution, but this Measure Distance custom feature allows you to assign an existing distance to a feature, different from our normal Variable workflow. https://cad.onshape.com/documents/572b968ce4b07aad125dbaaf/v/08093fef6c4d4f330f24dd19/e/b40df94c5081948fe8195e81. Give it a try!

    Since I am working totally within a single sketch, this workflow will do me no good. Features cannot be added while in a sketch. I need a solution that exists within the sketch that I am working with.
  • justin_36justin_36 Member Posts: 23 EDU
    @brian_brady are you willing to share with us an example public file of a mechanism that you would be teaching? thanks
  • michael_bromleymichael_bromley Member Posts: 110 PRO
    You can definitely do this.  Just create a variable first before creating your sketch and assign it your base links value/length.  On the top tool bar it is the (x) button.  Name it whatever you desire and then you can reference that dimension/value in sketches.  To reference it you need to use #"Name of Variable" structure.  I just quickly tested it out and I believe it will do exactly what you desire.
  • brian_bradybrian_brady Member, Developers Posts: 505 EDU
    You can definitely do this.  Just create a variable first before creating your sketch and assign it your base links value/length.  On the top tool bar it is the (x) button.  Name it whatever you desire and then you can reference that dimension/value in sketches.  To reference it you need to use #"Name of Variable" structure.  I just quickly tested it out and I believe it will do exactly what you desire.
    I guess I wasn't clear in my question. I know how to that. I have a dimension that is a resultant of complicated geometry in my sketch. I want to use that value to determine the length of another line or the diameter of a circle within the same sketch. In Creo, for example, every sketch dimension is associated with a dimension number, i.e. d1. So if I ask of the dimension of this resultant, it might be assigned d14. I can draw a new line in the same sketch and dimension it as d14 and it will use the value of the previous resultant. I wish OS had such a mechanism. Essentially "in-sketch" variables.

    Brian
  • tom_augertom_auger Member Posts: 116 ✭✭
    I'm just trolling these older posts that talk about driving dimensions to provide updates to others who are coming to the topic in more recent years. While we don't have direct referencing of other dimensions like you have in F360 and SW, the new on-the-fly variable creation method which has been in place since Dec. 2020 is a step in the right direction for sure!

    https://forum.onshape.com/discussion/15006/improvements-to-onshape-december-10th-2020/p1
Sign In or Register to comment.