how to use mirrorAcross

papawo
papawo Member, Developers Posts: 206 PRO
Tagged:

Best Answer

Answers

  • Jake_Rosenfeld
    Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646 image
    What are you hoping to accomplish?

    Calling mirrorAcross returns a 'Transform' which can be used in a variety of ways. A few examples: a transform could be used in applyPattern() to mirror a part or it can be multiplied by a  world space 'Vector' to mirror that vector across the plane in question.
    https://cad.onshape.com/FsDoc/library.html#module-transform.fs

    The concept is similar to a transformation matrix in linear algebra:
    https://en.wikipedia.org/wiki/Transformation_matrix
    Jake Rosenfeld - Modeling Team
  • papawo
    papawo Member, Developers Posts: 206 PRO
    i just want to do this. 

  • Jake_Rosenfeld
    Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646 image
    You can use the 'mirror' feature:

    mirror(context, id + "mirror", {
            "patternType" : MirrorType.PART,
            "entities" : a query for the part you want to mirror,
            "mirrorPlane" : a query for a face you want to mirror across.  In this case you could use qCreatedBy(makeId("Front"), EntityType.FACE) to get the front plane,
            "operationType" : NewBodyOperationType.ADD,  <-- same as "Add" in the feature dialog
            "defaultScope" : false, <-- same as turning off "Merge with all" in the feauture dialog
            "booleanScope" a query for what you want the result to boolean onto <-- same as "Merge scope" in the feature dialog
        })
    If you don't want to boolean the result onto the seed, you can just leave out the last 3 parameters.
    Jake Rosenfeld - Modeling Team
  • papawo
    papawo Member, Developers Posts: 206 PRO
    What if the “front plane” doesnt exist?
    how to create or get that plane without user selecting the face?
  • papawo
    papawo Member, Developers Posts: 206 PRO
    thanks, I think I can work on that.