Best approach for creating polygons with variable number of sides
alex_bryant170
Member Posts: 3 ✭
It seems it's not possible to declare an integer variable and use this in the value for side count for an inscribed polygon on a sketch, but it is possible to use a variable value for feature patterns.
Given this is the case, what would the most efficient approach be for creating a polygon of any number of sides with a variable? Essentially my aim is to have a number variable that (for example) could be changed from 3 to 4 to change a basic 1cm depth equilateral triangle into a square.
I can see this being possible by constructing shapes with >3 sides from triangles with a feature pattern and calculating the internal angles using this variable but it would be quite slow to apply this multiple times in a sketch and could get quite messy to maintain.
Given this is the case, what would the most efficient approach be for creating a polygon of any number of sides with a variable? Essentially my aim is to have a number variable that (for example) could be changed from 3 to 4 to change a basic 1cm depth equilateral triangle into a square.
I can see this being possible by constructing shapes with >3 sides from triangles with a feature pattern and calculating the internal angles using this variable but it would be quite slow to apply this multiple times in a sketch and could get quite messy to maintain.
0
Best Answers
-
Here it is...
You can use 360º/NumberSides as input
Un saludo,
Eduardo Magdalena C2i Change 2 improve ☑ ¿Por qué no organizamos una reunión online?
Partner de PTC - Onshape Averigua a quién conocemos en común10 -
You have a few options with the variables. One option is what @emagdalenaC2i shows.If you want a more robust part you can use configuration variables to control the number of sides, depth of the extrusion, and size of the part. That would look like this
6
Answers
-
Here it is...
You can use 360º/NumberSides as input
Un saludo,
Eduardo Magdalena C2i Change 2 improve ☑ ¿Por qué no organizamos una reunión online?
Partner de PTC - Onshape Averigua a quién conocemos en común10 -
You have a few options with the variables. One option is what @emagdalenaC2i shows.If you want a more robust part you can use configuration variables to control the number of sides, depth of the extrusion, and size of the part. That would look like this
6 -
Both great answers, thank you both.1
-
instead of circular pattern you can also let the sketch drive a side of the polygon directly. not sure what the impact is for the rebuild time.0
