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 find the radius or diameter of a curve in Featurescript

peter_morrispeter_morris Member Posts: 43 ✭✭
I'm trying to amend some code to generate a spur gear - eventually I want it to create a helical gear, but I have to walk before I can run!

The starting position is that I will have created a part studio with the relevant gears as blank extruded pieces.  The diameter of the extrusions are the gear tip diameters as I'm making a drawing of an old lathe.  In the precondition section I'm able to select an edge (the curved edge of what will be the gear), but now need to calculate or find the diameter of that circle.  I have one immediate challenge and that is how to extract the diameter from the definition.TipDiameter and, in order to refine the precondition, I'd like to be able check that this is actually a curve and not a straight edge.

I'd be really grateful for any advice.

The code I'm using in the precondition is:
        annotation { "Name" : "Tooth Tip Circle", "Filter" : EntityType.EDGE    , "MaxNumberOfPicks" : 1 }        definition.TipDiameter is Query;
and to try and extract the diameter I'm using:

       TipDiameterVariable=evaluateQuery(Context, definition.ToothTip)[0];
But that is a complete guess that fails to compile properly.

Comments

Sign In or Register to comment.