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.
Use a vertex in skRectangle()
Lee_Hesketh
Member, Developers Posts: 148 ✭✭✭
Hi, how could I use a vertex's coordinates as the "firstCorner" coordinates for an skRectangle() function? Am I right by thinking that it must be a 2d vector and I could get it since I am using evVertexPoint, I could use vertexPoint[0] etc., but that only works if the part is in the correct orientation?
Thanks
Lee Hesketh
Thanks
Lee Hesketh
There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!
Tagged:
0
Best Answers
-
ilya_baran Onshape Employees, Developers, HDM Posts: 1,215Assuming you have the sketch plane, you can use worldToPlane https://cad.onshape.com/FsDoc/library.html#worldToPlane-Plane-Vector
to convert the XYZ coordinates of vertex into the 2D coordinates that skRectangle takes. Just make sure you're using newSketchOnPlane rather than newSketch to create the sketch (or you'll have a coordinate system you probably don't want).Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc5 -
ilya_baran Onshape Employees, Developers, HDM Posts: 1,215You can do something like
worldToPlane(sketchplane, vertexPoint) + vector(2 * inch, -3 * inch)
Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc5
Answers
to convert the XYZ coordinates of vertex into the 2D coordinates that skRectangle takes. Just make sure you're using newSketchOnPlane rather than newSketch to create the sketch (or you'll have a coordinate system you probably don't want).
How could I separate the x and y coordinates of the secondCorner to translate the point?
worldToPlane(sketchplane, vertexPoint) + vector(2 * inch, -3 * inch)