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.
vector question
papawo
Member, Developers Posts: 206 PRO
Comments
-
Vectors can indicate several things - 3D direction, 3D position, 2D position, location on a surface, and probably more that I don't recall. Some of these don't require units; some do. Specifically, direction doesn't need units, but position does. If you're trying to sketch a rectangle, you are feeding the skRectangle function the position of two points. If units are not included, that (1,1) could be (1,1)*inch or (1,1)*meter. So instead of trying to assume a unit, which would probably lead to errors along the way, the function was written to require explicit units. I hope I explained that well enough
0 -
The reason is that 1 is a number, while 1 * inch is a length. The locations of rectangle corners are lengths (distances from plane's origin), not numbers, so skRectangle doesn't work without the *inch. The reason we did it this way (as opposed to treating everything as a number) is to catch common errors earlier in the design process (so, e.g., adding 2 * inch + 3 * degree will lead to an error, rather than an unintended result that could slip into manufacturing) by forcing the programmer/engineer to think about units explicitly.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc1
-
When referring to a position on a sketch, you need to specify a distance along the X-and Y-axes of the sketch. These distances need to have length units, and can be created in many ways —
vector(1, 0) * inchmeans something different formvector(1, 0) * meter, which means something different fromvector(1, 0) * definition.radius, but all of these represent a certain distance along the X-axis, and zero distance along the Y-axis.
Under the hood, multiplyingvector(1, 0)(a Vector) byinch(a ValueWithUnits) will multiply each component of the vector by the value, resulting in a vector that specifies two distances along the X-and Y-axes, which is what the argument for skRectangle expects.
0 -
Thank you ! Ilya , kevin & Mahir . Now its all clear!

0



