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.
FS calculating plane normal
graham_lock
Member Posts: 148 PRO
Hi,
I'm creating a plane at an offset from a reference plane which I also want to angle at a given number of degrees.
My test code looks like this:
How should I go about generating the normal vector to achieve the desired angle?
Thank you.
I'm creating a plane at an offset from a reference plane which I also want to angle at a given number of degrees.
My test code looks like this:
const p is Plane = plane(
offsetDirection ? (refPlane.origin - (offset * refPlane.normal)) : (refPlane.origin + (offset * refPlane.normal)),
vector(0, 0.1, 0.3)
);
opPlane(context, id + "plane1", {
"plane" : p
});
How should I go about generating the normal vector to achieve the desired angle?
Thank you.
0
Best Answer
-
Caden_Armstrong Member Posts: 180 PROFeatureScript transforms are great, they do a lot of heavy lifting for you.
If you create a rotation transform:var rotationangle = rotationAround(X_AXIS, 30*degree); var newVector = rotationangle*oldvector;
The one thing is that it only works with vectors that have a length.
So you'll need to take your normal, give it units (ie oldvector*meter), rotate it, and then remove units (newVector/meter)
www.smartbenchsoftware.com --- fs.place --- Renaissance
Custom FeatureScript and Onshape Integrated Applications0
Answers
If you create a rotation transform:
The one thing is that it only works with vectors that have a length.
So you'll need to take your normal, give it units (ie oldvector*meter), rotate it, and then remove units (newVector/meter)
Custom FeatureScript and Onshape Integrated Applications