Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
2. Need support? Ask a question to our Community Support category.
3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
4. 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.

Options

# Is there a way to transform a 3D point (map) into a 3D vector ?

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 ?
Tagged:

## Answers

• Options
Moderator, Onshape Employees, Developers Posts: 1,646
edited April 2018
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 Team
• Options
Member Posts: 1,221 ✭✭✭✭✭
i think you have a query (which is internally a map) of a vertex and want to get it coordinates? evVertexPoint() function does it
• Options
Member Posts: 6 PRO
edited April 2018
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.

• Options
Member Posts: 1,221 ✭✭✭✭✭
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()
• Options
Onshape Employees Posts: 115
Hi Antoine,

Here is a document with an example Feature Script that implements the three methods @konstantin_shiriazdanov outlined.

Best,

Mike
Sign In or Register to comment.

#### Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.