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.
Setting up a sketch on a cPlane Point Plane
HI,
I'm using cPlane to create a point plane, but I'm struggling to correctly setup a sketch on that plane?
My test document is:
https://cad.onshape.com/documents/d6dc9c54f70594748bdf83df/w/1285c1d3ecaad60b2edff729/e/66b5c01eb88b592b7ff3d36d
Any help appreciated.
Thank you.
Best Answer
-
Caden_Armstrong Member Posts: 195 PRO
It has changed the origin, but you've also put your sketch points through worldToPlane which will calculate where the point should be in the coordinate system based on the model coordinate system. No matter what plane origin you select they will always end up in the same location when you do that.
Plane coordinate system matters if you are calculating the shape of your sketch relative to something. If all of your sketch points are based on other points in the model and will put everything through worldToPlane, you don't need to.www.smartbenchsoftware.com --- fs.place --- Renaissance
Custom FeatureScript and Onshape Integrated Applications0
Answers
You need to filter the qCreatedby to a type
qCreatedBy(id + "pointPlane") should be
qCreatedBy(id + "pointPlane", EntityType.FACE)
Otherwise that query is returning EVERYTHING that the feature made, and newSketch only takes in certain entity types.
Also, consider doing evPlane on the input, skipping cPlane, and doing newSketchOnPlane.
You'll probably need the plane definition at some point and this skips making a plane object.
Custom FeatureScript and Onshape Integrated Applications
Thank you, I've updated the document with your suggestions.
I've added code to transform the sketch origin to the selected vertex.
I guess I should set a custom coordinate system for the plane though? Do you have an example of how to do that?
I've tried
const p is Plane = plane(vertex, -Y_DIRECTION, X_DIRECTION);
but that doesn't appear to change the origin?
It has changed the origin, but you've also put your sketch points through worldToPlane which will calculate where the point should be in the coordinate system based on the model coordinate system. No matter what plane origin you select they will always end up in the same location when you do that.
Plane coordinate system matters if you are calculating the shape of your sketch relative to something. If all of your sketch points are based on other points in the model and will put everything through worldToPlane, you don't need to.
Custom FeatureScript and Onshape Integrated Applications
Fantastic, it works!
Thank you for your help.