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.
How do I get the BOTH ends of a user-created sketch line segment?
annotation { "Name" : "UserLine","Filter" : GeometryType.LINE,"MaxNumberOfPicks" : 1 }
definition.userLine is Query;
I can get the sketch Plane on which the line resides:
var sketchPlane = evOwnerSketchPlane ( context, { entity: definition.userLine } );
..And I can get the line definition using evLine:
var line = evLine(context, {
"edge" : definition.userLine
});
But this line definition only gives me the starting point of the line segment the user created, not the ending. But i need to get the beginning and ending of the user's line segment. How can I do that?
I have tried toString() to see if I can access properties of the object I get as a result of evaluateQuery, but that doesn't help me.
There do not appear to be any examples in std of getting a sketch entity this way.
Best Answer
-
ilya_baran Onshape Employees, Developers, HDM Posts: 1,211Two ways to do this:
You can use evEdgeTangentLines and pass [0,1] as the parameters argument (0 means start, 1 means end)
or:
you can use qVertexAdjacent(definition.userLine, EntityType.VERTEX) to query for the two endpoint vertices and then call evVertexPoint on each of them.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc5
Answers
You can use evEdgeTangentLines and pass [0,1] as the parameters argument (0 means start, 1 means end)
or:
you can use qVertexAdjacent(definition.userLine, EntityType.VERTEX) to query for the two endpoint vertices and then call evVertexPoint on each of them.
Thanks for the fast answer!