Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Parameters For a Helical Gear Feature Script
peter_morris
✭✭
I'm very slowly getting to grips with Featurescript and modifying Neil Cooke's Spur Gear code to allow me to apply a helical gear profile to an already extruded blank. The next stage requires (in my mind) the confirmation that the queried face is in fact a circle and then to extract the position of its centre and its radius/diameter.
I think I'm then going to have a question about how to use feature script to apply a helix to an extruded circular surface, but that perhaps can wait for another day.
Any advice greatly received.
Many thanks.
Peter
I think I'm then going to have a question about how to use feature script to apply a helix to an extruded circular surface, but that perhaps can wait for another day.
Any advice greatly received.
Many thanks.
Peter
0
Comments
-
Take a look at evCurveDefinition and evSurfaceDefinition (for a face).Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc0
-
You can grab the edge of the queried face with qEdgeAdjacent. Something like this...
var edge = qEdgeAdjacent(face, EntityType.EDGE);
Then use evCurveDefinition to return the edge as a circle.var curve = evCurveDefinition(context, { "edge" : edge });Then create an If statement that throws a regen error if the edge is not a circle.<div>if (!(curve is Circle)) // if the selected curve is not a circle throw error</div><div> {</div><div> throw regenError("Selected face does not have a circular edge");</div><div> }</div>
Now that you know it is a circle you can get the radius.var curveRadius = curve.radius;
I created a straight sided spline feature that does alot of this. Might be worth checking out.
Straight Spline Feature0 -
Thank you both for your quick responses which are already helpfing! Very much appreciated.
Peter
0


