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.


Measure to Variable feature

kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
 This custom feature will measure a distance between entities (or the length, area, or volume of entities) and store it in a variable which can be used in downstream features and sketches.

Click the link below to add it to your toolbar now:

There have been a few "Measure"-type features written before, but none have had quite the full set of niceness that FeatureScript allows. This feature was written for Onshape by Andrii Furseiev and has already gone through some internal testing and code review.

Our hope is that this feature (or a descendant of it) will eventually become more integrated into Onshape by default. That means we want it to have a high-quality experience, which
  • Presents a clear, uncluttered interface
  • Has the full set of options you would expect out of such a feature, so you don't need to go searching elsewhere
  • Quickly gives you the correct info you need
I encourage anyone in this forum to add this feature to your toolbar and to give us feedback here on how it's working for you!

– Kevin


  • Options
    eric_pestyeric_pesty Member Posts: 1,607 PRO
    That looks really neat! I like the visualization arrows as it could be hard to tell what the different options result in otherwise!

    My only thought at this point would be that it would be nice if the "size" allowed multiple selection, and the variable be the sum of whatever was selected. Would be helpful to get the length of a chain of edges for example
  • Options
    S1monS1mon Member Posts: 2,492 PRO
    edited January 2022
    This is useful, but there are opportunities to improve .

    Some issues:
    1. When you start the feature and select some entities, the variable name is blank, and therefore it doesn't do anything and seems broken because it's red. It would make a lot more sense to me to put in a starting name (e.g. 'd1', 'd2', 'd3'...) which could easily be edited.
    2. Between circles/cylinders we only get closest or center-to-center. There's no maximum option or min/max option, unless this is part of the "two groups" mode. 
    3. I can't find any examples of the "two groups" being used, so it's hard to imagine what it does. The text on the PDF is not clear enough.
    4. There doesn't seem to be a way to select multiple edges to get a path length. The "measure value" featurescript will do this with "perimeter".
    5. There's no alternate units or dual unit options.
    6. The color coding and "value to record" are useful, but could be much better. Some color hints in the feature dialog to connect to the color coding of the lines on screen would go a long way to reducing cognitive load. Similarly, some way of making the selection for the "value to record" highlighted on screen would be helpful.
    7. The arrow sizes seem to be based on the bounding box size of the model, not something that's related to view. In some cases the arrow heads are so small that it's hard to find them. 
    8. It could be really useful to have a "keep measure line" option which would create a straight curve entity for the "value to record" line.
    9. The tool tips for the measured values aren't working. It reports 0 always. 
    10. Playing around with the selections I can get the tool to show me measurement values but no arrows. This was with "extend entities" checked
    11. What is the "size" of a curved edge? It seems like it's reporting the edge length (which is good) but it's not immediately obvious.
    12. The arrowhead style looks nothing like a standard dimension. In an ideal world, these would look like sketcher dimensions and arrowheads.

  • Options
    kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    Great catch!

    You can now update to the latest version to allow measuring multiple entities.
  • Options
    konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    When feature like that be added natively it should be called as subfeature for numeric input fields of other features, just like current Variable feature does. But for me personally the more desirable is a kind of parametric "query creator" feature which result we could save into variable or link to query fields directly and also call as subfeature
  • Options
    romeograhamromeograham Member, csevp Posts: 664 PRO
    Hi @kevin_o_toole_1
    Can you confirm that this tool does not currently measure angles (like, between two lines, or between two planes etc).
    Just want to make sure I'm not missing the special way to select elements that might give an angle.

  • Options
    kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    @romeograham That's correct, no way to measure angle yet.
  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,748 PRO
    Nice Kevin, thanks for sharing!

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Options
    stvnvl_8501stvnvl_8501 Member Posts: 120 PRO
    perfect. thanks for sharing! 
     Can you use this tool to measure a distance beween 2 features in a certain direction (other than WCS x, y, z)? 
  • Options
    _anton_anton Member, Onshape Employees Posts: 324
    edited May 2023
    perfect. thanks for sharing! 
     Can you use this tool to measure a distance beween 2 features in a certain direction (other than WCS x, y, z)? 
    Yes, and this is now part of our standard Variable feature. See here: https://cad.onshape.com/documents/54f0e6294dc423cedcf2931a/w/15f0834a578292ff4801efb3/e/c5d1800b2d99ad3b881f3fab

    This has the following caveat. You can take "measure a distance in a direction" to mean "get the distance vector, then project it onto the direction" or "project both entities onto a line along that direction, then measure the distance between the projections". Our feature does the former.
  • Options
    ChaosCrafterChaosCrafter Member Posts: 3 ✭✭
    This looks to be just what I need, except, can it work in sketch mode?  I know I can probably two-stage it (put the measure to variable outside the sketch then use the variable back in the sketch, but that sounds like a recipe for a feed-back loop.

  • Options
    kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    You're correct, there is an inherent loop in that structure. To use the result of this feature in a sketch, you will need to measure entities that existed before the sketch was created.
Sign In or Register to comment.