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.
skRectangle error when part's rotated
Lee_Hesketh
Member, Developers Posts: 148 ✭✭✭
Hi there. I have a script that generates mortice and tenon joinery however I have some problems. It works fine if the parts face that the tenon protrudes from is aligned with the x axis. The problem is when it aligns with the y axis.
How I have got it to work so far is the user selects two adjacent faces and then the adjacent face to those two is found using queries. then the vertex of one of the corners is found which is used as the first corner of an skRectangle() function. The other corner is vector(-width, -height). Where width and height are variables chosen by the user.
When it aligns with the y axis, the width and height become swapped and I don't know how to deduce which way the face is aligned. Here is the document. Could anyone have a look and see where I am going wrong? It's feature studio 2.
https://cad.onshape.com/documents/580b256ade95e210af0261d8/w/1d22e17d9b07548059b7b311/e/119330903d9f0efa384481b9
Thanks
Lee Hesketh
How I have got it to work so far is the user selects two adjacent faces and then the adjacent face to those two is found using queries. then the vertex of one of the corners is found which is used as the first corner of an skRectangle() function. The other corner is vector(-width, -height). Where width and height are variables chosen by the user.
When it aligns with the y axis, the width and height become swapped and I don't know how to deduce which way the face is aligned. Here is the document. Could anyone have a look and see where I am going wrong? It's feature studio 2.
https://cad.onshape.com/documents/580b256ade95e210af0261d8/w/1d22e17d9b07548059b7b311/e/119330903d9f0efa384481b9
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 Answer
-
ilya_baran Onshape Employees, Developers, HDM Posts: 1,210I think the problem is that sketchPlane is being created using just a point and a normal -- so Onshape doesn't know what x and y are in the plane (and just picks one). You need to pass a third argument (the x axis) to plane, like plane(vertexPoint, point2 - point1, -fEdgeNormal) -- you could get fEdgeNormal by calling evTangentPlane on fEdge -- and the results should be consistent.
Btw, have you seen Neil's example here: https://cad.onshape.com/documents/57ebf15e06acf910d5ac1b09/v/5667c2380880bfb9fe917f37/e/242e3449f5f40725d9f585ab
Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc5
Answers
Btw, have you seen Neil's example here: https://cad.onshape.com/documents/57ebf15e06acf910d5ac1b09/v/5667c2380880bfb9fe917f37/e/242e3449f5f40725d9f585ab