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.
Consistent normals for cirlces
billyzelsnack
Member Posts: 87 PRO
I have a feature that lets me click on a bunch of circles within a part studio and it creates additional parts at those circles. It works but the normals for the circles are flipped inconsistently if I gather them from circle.coordSystem. I'd like to gather them from their sketchplanes but I'm getting a CANNOT_RESOLVE_PLANE.
Here's the simplified precondition..
annotation { "Name" : "Choose circle edges", "Filter" : EntityType.EDGE && GeometryType.CIRCLE }
definition.circleEdges is Query;
Here's the simplification of how I iterate over the circles..
const circleEdges=evaluateQuery(context, definition.circleEdges );
for (var circleEdge in circleEdges){ const plane=evOwnerSketchPlane(context, { "entity" : circleEdge }); }
I'm not understanding why I can't resolve the plane. The cirlceEdge is an entity isn't it?
Here's the simplified precondition..
annotation { "Name" : "Choose circle edges", "Filter" : EntityType.EDGE && GeometryType.CIRCLE }
definition.circleEdges is Query;
Here's the simplification of how I iterate over the circles..
const circleEdges=evaluateQuery(context, definition.circleEdges );
for (var circleEdge in circleEdges){ const plane=evOwnerSketchPlane(context, { "entity" : circleEdge }); }
I'm not understanding why I can't resolve the plane. The cirlceEdge is an entity isn't it?
0
Best Answers
-
lana Onshape Employees Posts: 706@billyzelsnack
Is evPlane(context, {"face" : qEdgeAdjacent(circleEdge, EntityType.FACE)}) giving you the expected result?
It will work only if circular edge is adjacent to a plane, though. Is this a requirement for your feature input.
1 -
lana Onshape Employees Posts: 706@billyzelsnack
My bad. You can add plane filter to the query : qGeometry(qEdgeAdjacent(circleEdge, EntityType.FACE), GeometryType.PLANE);5
Answers
I just tried and this works for me: https://cad.onshape.com/documents/6da56483710c2b0b2ed1a40b/w/b27042b1cc6a6646c7430d2c/e/f0ab954db4f46bc6e628f248
Is it possible you're using edges that aren't coming from sketches?
How would I go about getting the outward facing normals in this example..
A rectangle with a circle inside it is extruded to create a box with a hole all the way through it. As in your example I would like to select both circles on opposite sides of the box. As it is now I can iterate over each circle and get a coordSystem from each. However the coordSystem normal is the same for both circles rather than pointing in opposite direction..
circle.coordSystem gives me everything I need except the normal might be flipped. How would I get a consistent outward facing normal?
}
This is giving me the same inconsistent normals as asking via evCurveDefinition(context, { "edge" : circleEdge }).coordSystem.
i'm afraid we couldn't solve the problem untill find some formal criteria
Is evPlane(context, {"face" : qEdgeAdjacent(circleEdge, EntityType.FACE)}) giving you the expected result?
It will work only if circular edge is adjacent to a plane, though. Is this a requirement for your feature input.
If you use a body to create the sketch, then the sketch normal is always away from the body. A cut from a circle on a sketch should have a consistent normal based on the face chosen for the sketch which should be away from the bodies center of mass. Shiny side out is positive. This will dictate the circle's normal.
If you need to make a decision, take the dot product relative to the front plane's Z direction or 0,0,1 world coordinates.
Of course, there's always the possibility that I have no idea what you guys are talking about.
for clarity's sake, circle normal is Z world:
Edge normal should be Z world:
On the underside, is this edge based on the adjacent faces or the sketch circle's normal:
I don't know if that edge knows about the sketch.
I would predict that this edge would be the anti-normal 0, 0, -1.
If this geometry came in from parasolids and had no sketches, the 2 faces are analytic and could derive a circle definition. My guess would be the circle is anti-normal relative to the world.
Let me know if you figure it out.
It returns the normal I'm looking for with the center of the face but combined with the other information I have I think I have what I need to make it work. Thanks.
The edge is the intersect of a plane face & cyl face, it's normal is based on the planar face and is shiny side out.
good to know,
Here's a simplified example.
https://cad.onshape.com/documents/58fa73288614a7114f1a299c/w/00d15f89472e5b3b9afecce9/e/7aaeb3191d24d17729b7c39f
It works for the circles on Extrude1 and Extrude3, but not for Extrude2.
I was under the impression that sharing a link would share the specific version it was at when I shared it. I guess you looked at it while I was messing with it. If you look at it how it is now there are debug statements in there to show the planes and I've commented out the mate connector op. However you'll need to edit the feature for the planes to show up.
V3 here.. https://cad.onshape.com/documents/58fa73288614a7114f1a299c/w/00d15f89472e5b3b9afecce9/e/7aaeb3191d24d17729b7c39f
qEdgeAdjacent can return multiple faces and I was just getting lucky with ordering. Depending on the ordering evPlane would try to find the plane for a cylinder face and that's not going to work.
My bad. You can add plane filter to the query : qGeometry(qEdgeAdjacent(circleEdge, EntityType.FACE), GeometryType.PLANE);
Thanks @lana . I've updated the minimal example. Much cleaner now.