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.

Face relative coordinates for a sketch

I have a feature script feature where the user has selected a face, such as one side of a cube. I want to draw a sketch on that face. I can draw a sketch on that face but it still originates from world coordinates. How can I make the center of my sketch the center of the face I am drawing on? 

Comments

  • marena_richardsonmarena_richardson Member Posts: 20 EDU
    edited September 2015
    I tried evFaceTangentPlane by the way which will make a new origin but returns a plane, not a query, which the sketch will not accept as an input for "face". 
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    newSketchOnPlane (instead of newSketch) will accept a Plane as a sketchPlane and won't recenter it.  If your face is planar, you can also use evPlane to get the plane centered on the face middle instead of evFaceTangentPlane.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • marena_richardsonmarena_richardson Member Posts: 20 EDU
    Thanks Ilya. newSketchOnPlane and evPlane both work well. What I am struggling with now is how to make a sketch appear the same on all faces despite their different orientations relative to the global coordinate system. 
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    Not sure what you mean by "the same" -- evPlane returns planes in a "canonical" orientation, but if you rotate them, newSketchOnPlane will use what you give it.  If you are referencing geometry outside the sketch (unlikely but...) and simply using a different plane wouldn't work, keep in mind that you can also use opTransform and opPattern with qCreatedBy(id + "sketch", EntityType.BODY)
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • marena_richardsonmarena_richardson Member Posts: 20 EDU
    Hm. I wasn't very clear. What I really need is a sketch on one face that appears mirrored on another face so that the two sketches would line up if the bodies were moved into contact. 
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    Note that if the rotation of the plane returned by evPlane is arbitrary. You can specify a plane with a different rotation like:

    newPlane = plane(oldPlane.origin, oldPlane.normal, newXDirection);

  • lanalana Onshape Employees Posts: 711
    @marena_richardson
    Planes have right-handed coordinate systems, so you can't get symmetric sketch by manipulating sketch planes only. If the faces are in the same plane, you can use MIRROR constraint in the same sketch. You probably will be using sketches to make extrude. It might be easier to build the body you are looking to build and then mirror and transform it.
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    @lana
    I think it's easier to just have the sketch normal point opposite the face normal -- the default extrude direction will be wrong, but that doesn't seem like a big deal. The other possibility, like I said above, is using opTransform or opPattern on the sketch itself, which can take transforms with negative determinant.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
Sign In or Register to comment.