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.

Plane rotation

graham_lockgraham_lock Member Posts: 209 PRO

Hi,

I'm drawing sketch profiles onto faces of parts.

All parts but the last have the sketches drawn on their front faces.

The last part has the sketch drawn on the rear face.

I have use cases where I need the box profiles to be drawn tangential to the sketch line direction as in the image below - this works fine:

Non tangential.png

And use cases where I need the box profiles to be drawn tangential to the part edges as in the image below - this is where the problem lies:

Tangential.png

The box profiles on the front faces rotate clockwise.

The box profile on the rear face rotates anti clockwise but I need it to rotate clockwise.

Which make sense but I'm not sure how to correct it.

My code for setting up the sketch planes is as below:

profilePlane = plane(config.intersectingPoints[formerIndex - 1], normal, config.isTangential ? lines.tangentLines[0].direction : cross(normal, config.sketchLineDirection));

I need to modify:

config.isTangential ? lines.tangentLines[0].direction

where lines.tangentLines represents the straight reference sketch lines

Any help appreciated.

Thank you.

Best Answer

  • EvanReeseEvanReese Member, Mentor Posts: 2,329 ✭✭✭✭✭
    Answer ✓

    Ah I see better now what you're up do. You could maybe just make a new plane by taking the first plane and moving the origin of the last one. That way you don't need to know how the other planes are oriented. You just know they'll match.

    const orientedLastPlane = plane(lastPlane.origin, firstPlane.normal, firstPlane.x);

    Evan Reese
    Independent Onshape Consultant | Industrial Designer

Answers

  • EvanReeseEvanReese Member, Mentor Posts: 2,329 ✭✭✭✭✭

    I'm not sure I follow exactly, but can you flip the normal of the rear face plane to get the right behavior?

    profilePlane.normal = -profilePlane.normal;

    Evan Reese
    Independent Onshape Consultant | Industrial Designer
  • graham_lockgraham_lock Member Posts: 209 PRO
    edited April 21

    Thank you.

    Flipping the normal doesn't work unfortunately.

    The green arrow represents the normal direction of the front faces, the red arrow represents the flipped normal direction of the last part:

    Normal directions.png

    If not flipped then all normal directions are the same.

  • MichaelPascoeMichaelPascoe Member Posts: 2,240 PRO

    @graham_lock What is your question?


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • EvanReeseEvanReese Member, Mentor Posts: 2,329 ✭✭✭✭✭
    Answer ✓

    Ah I see better now what you're up do. You could maybe just make a new plane by taking the first plane and moving the origin of the last one. That way you don't need to know how the other planes are oriented. You just know they'll match.

    const orientedLastPlane = plane(lastPlane.origin, firstPlane.normal, firstPlane.x);

    Evan Reese
    Independent Onshape Consultant | Industrial Designer
  • graham_lockgraham_lock Member Posts: 209 PRO

    Thank you @EvanReese this seems to work well!

  • graham_lockgraham_lock Member Posts: 209 PRO

    More of an update than a question thanks @MichaelPascoe

Sign In or Register to comment.