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 assign a variable to control number of sides of a polygon?

dhiraj_patildhiraj_patil Member Posts: 3
I want to assign a variable to control number of sides of a polygon. But it won't accept the input. 

Best Answers

  • Alex_KempenAlex_Kempen Member Posts: 208 EDU
    Answer ✓
    Sketch patterns and polygons cannot unfortunately be controlled with variables. This is due to the way Onshape handles creating new sketch entities internally; new entities aren’t processed deterministically, so increasing the number of sides on a polygon and then changing it back will cause things which reference the sides of the polygon to behave unexpectedly and inconsistently.

     One alternative to configuring polygons directly is to make multiple polygon sketches and to use configurations to switch between them. 

    Also, note that variables are called in Onshape using a # - this also activates the variable autocomplete menu.
    FeatureScript Developer, CADSharp
    Sophomore CS Student at UT Dallas
    Checkout my FeatureScripts here:



Answers

  • Alex_KempenAlex_Kempen Member Posts: 208 EDU
    Answer ✓
    Sketch patterns and polygons cannot unfortunately be controlled with variables. This is due to the way Onshape handles creating new sketch entities internally; new entities aren’t processed deterministically, so increasing the number of sides on a polygon and then changing it back will cause things which reference the sides of the polygon to behave unexpectedly and inconsistently.

     One alternative to configuring polygons directly is to make multiple polygon sketches and to use configurations to switch between them. 

    Also, note that variables are called in Onshape using a # - this also activates the variable autocomplete menu.
    FeatureScript Developer, CADSharp
    Sophomore CS Student at UT Dallas
    Checkout my FeatureScripts here:



Sign In or Register to comment.