Is there a way to transform a 3D point (map) into a 3D vector ?
Antoine_Bodin
Member Posts: 6 PRO
Hello there,
I am looking for a way to transform a 3D point (map) into a vector in a feature script. How can I do it ?
I am looking for a way to transform a 3D point (map) into a vector in a feature script. How can I do it ?
Tagged:
0
Answers
-
Hi @Antoine_Bodin
You can make Vectors in featurescript with the `vector(x, y, z)` function. Here is some documentation:
https://cad.onshape.com/FsDoc/library.html#module-vector.fs
Some examples:const pointInSpace = vector(1, 2, 3) * inch; // point at (1 inch, 2 inch, 3 inch) const xLoc = 5 * meter; const anotherPointInSpace = vector(xLoc, 4 * inch, 3 * centimeter); // point at (5 meter, 4 inch, 3 centimenter) // show these vectors as red dots while you're in the part studio with your custom feature dialog open debug(context, pointInSpace); debug(context, anotherPointInSpace);
If you post the URL of your document, or screenshots of the specific issue you are facing, we can get more specific with our help.Jake Rosenfeld - Modeling Team0 -
i think you have a query (which is internally a map) of a vertex and want to get it coordinates? evVertexPoint() function does it
2 -
In fact, I am drawing a point in a sketch and I need to define a vector that represents this point to use it in the function qContainsPoint(). I tried to use evVertexPoint() but I got the following error: evVertexPoint: CANNOT_RESOLVE_ENTITIES.

0 -
the first approach: planeToWorld(plane2, vector(0,0.6)*millimeter) will return corresponding vector in 3d.
the approach with evVertexPoint() requares the query of a point, so if the sketch contains the only point you can directly use qCreatedBy("sketch_feature_id", EntityType.VERTEX). or if you need sketch entity with specific id use sketchEntityQuery()
0 -
Hi Antoine,
Here is a document with an example Feature Script that implements the three methods @konstantin_shiriazdanov outlined.
Best,
Mike0



