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.
worldToPlane() gives inconsistent location?
alan_1
Member Posts: 14 EDU
I am trying to get a 2D point on a surface that I can then extrude. In this example, I am using a line's endpoint and attempting to extrude a circle with that point as its center. it works in one orientation, but when I switch orientations it either moves the extrude or fails completely (extrude error). In my testing, the line is drawn on a flat surface and is well within the interior of that surface. The surface is of a simple XYZ rectangular block. Think rectangle in "top" plane then extrude. So we're not talking non-90-degree angles at the moment.
Here's the code snippet.
I figure I'm misusing something, but not quite sure what the misuse is.
var endpoints = evaluateQuery(context, qVertexAdjacent(line, EntityType.VERTEX));
Here's the code snippet.
I figure I'm misusing something, but not quite sure what the misuse is.
var endpoints = evaluateQuery(context, qVertexAdjacent(line, EntityType.VERTEX));
var A is Vector = evVertexPoint(context, { "vertex" : endpoints[0] });
var aInPlane = worldToPlane(sketchPlane, A);
var Avec = vector(aInPlane[0], aInPlane[1]);
var circleB = skCircle(sketch1, "circleA" ~ index, {
"center" : Avec,
"radius" : definition.width / 2
});
skSolve(sketch1);
var exid = id + ("extrude1" ~ index);
extrude(context, exid, {
"entities" : qSketchRegion(sketchid),
"endBound" : BoundingType.UP_TO_BODY,
"depth" : (definition.height + 1 * meter),
"endBoundEntityBody" : definition.targetBody,
"operationType" : NewBodyOperationType.ADD,
"defaultScope" : false,
"booleanScope" : definition.targetBody,
"oppositeDirection" : true
});
0
Comments
I suspect that somewhere in this code snippet the orientation gets flipped. Perhaps the use of plane(). I tried using sketchPlane instead of topPlane and have solved my issue.