Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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

graham_lockgraham_lock Member Posts: 160 PRO

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_ArmstrongCaden_Armstrong Member Posts: 195 PRO
    Answer ✓

    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 Applications

Answers

  • Caden_ArmstrongCaden_Armstrong Member Posts: 195 PRO

    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.

    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications
  • graham_lockgraham_lock Member Posts: 160 PRO

    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?

  • graham_lockgraham_lock Member Posts: 160 PRO
    edited November 8

  • graham_lockgraham_lock Member Posts: 160 PRO

    I've tried

    const p is Plane = plane(vertex, -Y_DIRECTION, X_DIRECTION);

    but that doesn't appear to change the origin?

  • Caden_ArmstrongCaden_Armstrong Member Posts: 195 PRO
    Answer ✓

    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 Applications
  • graham_lockgraham_lock Member Posts: 160 PRO

    Fantastic, it works!

    Thank you for your help.

Sign In or Register to comment.