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.

How to use variable as dimension

lars_anderssonlars_andersson Member Posts: 20
edited November 2015 in Using Onshape
My first attempt to use variables. I am probably making a beginners mistake.
The error text when hovering over the red box says "Enter a valid expression"

The document is at:https://cad.onshape.com/documents/83409d532f4b46bd83ba32cd/w/2e1ea2949d804e7d8f616d0f/e/0fc783875c5145b3b61caabe

Best Answers

Answers

  • joris_kofmanjoris_kofman Member Posts: 59 ✭✭
    That being said it is an obvious idea to allow creation of variables by entering the name of the value into a dimension.
    The value of that variable could then be the value that was already entered into the dimension box.

    This of course means that a feature will try to influence the features that come before it, which is probably the biggest no-no in all of feature based modelling.
  • lars_anderssonlars_andersson Member Posts: 20
    It's a problem of timing.
    You need to leap into that Delorean and drag the line specifying the variable so it is further up the tree than any sketch or feature you want to use it in.
    Otherwise it's like trying to be born before your mum.
    Great thanks!

    I just clicked the (x) icon and had a variable made for me wihout much thought. Maybe a progamming background fooled me here, I was thinking of a variable as something globally defined.

    The error text when trying to use the variable was not very helpful. The tutorial on variables did not make me realise this either.


  • joris_kofmanjoris_kofman Member Posts: 59 ✭✭
    The way the variables are defined as a feature is actually a really clever way of not having to make a lot of code to look for loops in the definitions, pretty clever of the onshape people.
  • lars_anderssonlars_andersson Member Posts: 20
    edited November 2015
    Tried to think of a situation where it is meaningful not to have all variables defined before all "real" elements. At my learning level I could not think of any.

    NOTE: I don't have any problems moving the variables up the tree now that I have been educated to do so.
  • andrew_troupandrew_troup Member, Mentor Posts: 1,584 ✭✭✭✭✭
    @ilya_baran
    Thanks for that; it confirms my hunch, which I mentioned further up the thread, regarding a newly added variable :
     <<
     I can see why it's not [added at the top of the tree] (because of future desirability of variables driven by aspects of the model)>>
Sign In or Register to comment.