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.

# Formula for getting vector

Member, Developers Posts: 206 PRO

• Onshape Employees Posts: 563
vector(pt1[0] +1 * inch, pt2[1])

EDITED - sorry missed pt1[0]
• Member, Developers Posts: 206 PRO
@konstantin_shiriazdanov
can you explain pls?

• Onshape Employees Posts: 563
vector(pt1[0] +1 * inch, pt2[1])

EDITED - sorry missed pt1[0]
• Member, Developers Posts: 206 PRO
That is how I interpret it. But it doesnt work. its not giving me the correct 1"

var startPoint2D = worldToPlane(oplane, pt1);
var endPoint2D = worldToPlane(oplane, pt2);
var sketch1 = newSketchOnPlane(context, id + "sketch1", {
"sketchPlane" : oplane
});

skRectangle(sketch1, "rectangle1", {
"firstCorner" : startPoint2D,
"secondCorner" : endPoint2D
});
skSolve(sketch1);
var rect2 = vector(1 * inch, endPoint2D[1]);
....

skRectangle(sketch2, "rectangle2", {
"firstCorner" : startPoint2D,
"secondCorner" : rect2
});
• Member Posts: 1,051 ✭✭✭✭✭
p3 = p1 + dot(p2-p1, vector(0,1)) * vector(0,1) + vector(1,0) * inch
• Member, Developers Posts: 206 PRO
@konstantin_shiriazdanov
can you explain pls?
• Member, Developers Posts: 206 PRO
is dot a syntax?

• Member Posts: 1,051 ✭✭✭✭✭
edited July 2018
dot() is builtin FS function which gives vector dot product (vector operation defined in linear algebra, for vectors a and b dot(a, b) = length(a) * length(b) * cos(a^b) where a^b is an angle between a and b)
• Member, Developers Posts: 206 PRO
thank you guys! Ive learned something new today!