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 use the centroid as a vector?
MichaelPascoe
PRO
I found the centroid of my sketch with this:
The hint says it returns a vector, but when I try to use the variable "centroid" as a position in my sketch point, it says it's not a vector. and throws this error: Precondition of skPoint failed (value.position is undefined || is2dPoint(value.position))
Code for my sketch point:
Once the point is placed, how would I query the point so that I could use it in a loft?
var centroid = evApproximateCentroid(context, { //Finds the centroid of the selected face.
"entities" : definition.selectedFace
});The hint says it returns a vector, but when I try to use the variable "centroid" as a position in my sketch point, it says it's not a vector. and throws this error: Precondition of skPoint failed (value.position is undefined || is2dPoint(value.position))
Code for my sketch point:
var pt = skPoint(sketch, "point1", { "position" : centroid}); Once the point is placed, how would I query the point so that I could use it in a loft?
RENDERCAD
rendercad.ai - Photorealistic product rendering.
▚▞▚▞▚▞▚▞▚
________________________________________________________________________
Tagged:
0
Best Answers
-
centroid is 3d vector while for sketch point you need 2d, so you need to transform it like that: centroid2d = worldToPlane(skPlane)*centroid
6 -
is realPlane2 a query or a Plane?
You will need to do evPlane to get the plane object for the plane query.6
Answers
-
centroid is 3d vector while for sketch point you need 2d, so you need to transform it like that: centroid2d = worldToPlane(skPlane)*centroid
6 -
I tried this:
var centroid2d = worldToPlane(realPlane2, centroid);
realPlane2 is the plane my sketch is on.
I'm still failing to implement it correctly. It throws this: Call worldToPlane(Query (map), Vector (array)) does not match worldToPlane(Plane, ...)
RENDERCAD
rendercad.ai - Photorealistic product rendering.
▚▞▚▞▚▞▚▞▚
________________________________________________________________________0 -
is realPlane2 a query or a Plane?
You will need to do evPlane to get the plane object for the plane query.6 -
RENDERCAD
rendercad.ai - Photorealistic product rendering.
▚▞▚▞▚▞▚▞▚
________________________________________________________________________0

