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.
Curve Length
 public_public                
                
                    Member Posts: 5 ✭
public_public                
                
                    Member Posts: 5 ✭                
            Please suggest a method to measure the distance along a curve between specified points.
Thank you
                0    
            
Comments
Could you show an example
IR for AS/NZS 1100
FeatureScript 920;<br>import(path : "onshape/std/geometry.fs", version : "920.0");<br><br>annotation { "Feature Type Name" : "CurveLength" }<br>export const CurveLength = defineFeature(function(context is Context, id is Id, definition is map)<br> precondition<br> {<br> annotation { "Name" : "Point_1", "Filter" : EntityType.VERTEX, "MaxNumberOfPicks" : 1 }<br> definition.Point_1 is Query;<br><br> annotation { "Name" : "Point_2", "Filter" : EntityType.VERTEX, "MaxNumberOfPicks" : 1 }<br> definition.Point_2 is Query;<br><br> }<br> {<br> var myStartPoint is Vector = evVertexPoint(context, {<br> "vertex" : qNthElement(definition.Point_1, 0)<br> });<br><br> var myEndPoint is Vector = evVertexPoint(context, {<br> "vertex" : qNthElement(definition.Point_2, 0)<br> });<br> var myCurveF is Query = qContainsPoint(qEverything(EntityType.EDGE), myStartPoint);<br> var myCurve is Query = qContainsPoint(myCurveF, myEndPoint);<br> var Length_1 is ValueWithUnits = evLength(context, {<br> "entities" : myCurve<br> });<br><br> debug(context, Length_1);<br><br> });<br><br>1. Iterate over the curve to find the parameter closest to each point using evEdgeTangentLine
2. Compare parameters against overall curve length
HWM-Water Ltd
@public_public I will post a faster solution soon
https://cad.onshape.com/documents/d103e50535cbfbf38dd6e51b
Basically I'm modeling a drive belt with two different-sized pulleys, so I want to measure the exact length of the belt and then save use that length in the part number -- so if anyone knows of a different way to do that, I'd be open to that too. Thank you!
Posted too soon, just found a FS that does exactly what I'm asking:
https://cad.onshape.com/documents/d8a36f7517523544158ae686/w/b257afccef639b5ffa33e3fe/e/a2254749aecfdeb3b2c601c5
Ted