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.
qSubtraction part edges vs sketch edges?
MichaelPascoe
Member Posts: 1,982 PRO
I'm trying to preform a qSubtraction by subtracting the edges of a face and desired excluded edges. The subtraction works when both selections are on a part, but it doesn't work when the selection is a sketch face and a sketch edge belonging to the sketch face.
How would I preform a qSubtraction between the edges of a selected sketch face, and one of the edges selected on the same face?
Here is the code for the edges:
Part selection results:
Sketch selection results:
How would I preform a qSubtraction between the edges of a selected sketch face, and one of the edges selected on the same face?
Here is the code for the edges:
annotation { "Name" : "Path faces", "Filter" : EntityType.FACE } definition.face is Query; annotation { "Name" : "Exclude edges" } definition.excludeEdges is boolean; if (definition.excludeEdges == true) { annotation { "Name" : "Edges of path to exclude", "Filter" : EntityType.EDGE } definition.excludedEdges is Query; }
var loopedEdges =
qSubtraction(
qAdjacent(pathFaces[count], AdjacencyType.EDGE, EntityType.EDGE),
definition.excludedEdges
);
debug(context, loopedEdges, DebugColor.GREEN);
Part selection results:
Sketch selection results:
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
Tagged:
0
Best Answer
-
lana Onshape Employees Posts: 706The sketch edges rendered on the screen are not adjacent to the sketch face. They belong to different bodies. You could use
var trackingQs = []; for (var edge in evaluateQuery(context, definition.excludedEdges)) { const edgeTracking = startTracking(context, {"subquery" : edge, "lastOperationId": lastModifyingOperationId(context, edge)}); trackingQs = append(trackingQs, edgeTracking); } const remainingFaceEdges = qSubtraction(qAdjacent..., qUnion(trackingQs));
1
Answers
Thanks for the quick response, I will try this.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
It is unfortunately rather obscure, very much informed by how we handle sketch geometry. startTracking is a useful mechanism for linking input geometry with results of operations.