Parameters For a Helical Gear Feature Script
peter_morris
Member Posts: 43 ✭✭
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


