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 to create a query that will select a specific edge of a part?
cory_isaacson
Member, Developers Posts: 43 PRO
I have a part that is a rectangle that is 1/4" thick after extrusion. In FeatureScript I need to select the corner edge (the 1/4" thickness, no other edges). This is so I can keep the part flat but Fillet the corner (just the vertical edge). I can do this manually be don't know how to create a FS query to do the same thing.
If someone could provide a FS query example to do this that would be great.
If someone could provide a FS query example to do this that would be great.
Tagged:
0
Best Answer
-
cory_isaacson Member, Developers Posts: 43 PROThanks Ilya. That's perfect and it works now!
A tutorial on how to do queries would be incredibly helpful, it's not altogether obvious how they work from the documentation and examples. I might be able to help with this if I could work with you on this. I've been a software developer all my career, and an instructor, so this type of documentation would be something I could help with.
5
Answers
Highlighted lines in Italic and bold format are query for edge selection. I am still in the learning phase of FS programming. You can also share your ideas if something needs to be corrected in above lines.
Thanks
So the question now is: How can I select the edge between the two points?
// Query for the part.
var partQuery is Query = qCreatedBy(id + value.extrudeName, EntityType.BODY);
logMessage(context, "partQuery", partQuery);
// This resolves to nothing.
var linesQuery is Query = qGeometry(partQuery, GeometryType.LINE);
logMessage(context, "linesQuery", linesQuery);
// Build the vector for the bottomUpperLeft and topUpperLeft points.
var bottomUpperLeft is Vector = vector(value.xLeft, value.yUpperLeft, value.planeOffset);
var topUpperLeft is Vector = vector(value.xLeft, value.yUpperLeft, value.planeOffset + value.partThickness);
logMessage(context, "bottomUpperLeft", bottomUpperLeft);
logMessage(context, "topUpperLeft", topUpperLeft);
// Build the full query using qContainsPoint. This returns the entire body.
var upperLeftPointsQuery is Query = qContainsPoint(qContainsPoint(partQuery, bottomUpperLeft), topUpperLeft);
logMessage(context, "upperLeftPointsQuery", upperLeftPointsQuery);
// Query for the line between the points.
// This resolves to nothing.
var upperLeftEdgeQuery is Query = qGeometry(upperLeftPointsQuery, GeometryType.LINE);
logMessage(context, "upperLeftEdgeQuery", upperLeftEdgeQuery);
Here is the debug output:
partQuery
debug: Query resolves to 1 bodies
linesQuery
debug: Query resolves to nothing
bottomUpperLeft
debug: Vector (-0.0381 meter, 0.2921 meter, 0 meter)
topUpperLeft
debug: Vector (-0.0381 meter, 0.2921 meter, 0.006350000000000001 meter)
upperLeftPointsQuery
debug: Query resolves to 1 bodies
upperLeftEdgeQuery
debug: Query resolves to nothing
Result: Regeneration complete
A tutorial on how to do queries would be incredibly helpful, it's not altogether obvious how they work from the documentation and examples. I might be able to help with this if I could work with you on this. I've been a software developer all my career, and an instructor, so this type of documentation would be something I could help with.