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.

Get lengths/position of points/lines from selected face?

Lauren_FroschauerLauren_Froschauer Member Posts: 10 EDU
I am trying to cut down on the number of user inputs for the box joint feature. I remember Kevin mentioning that I could query the length of an edge or the position of a point etc. from a selected face. 

Kevin, which command were you referring to? Could you give me some example code using it? 

Comments

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited October 2015
    To get the distance from a point to a plane (i.e. the z-component of the point from the plane's perspective):
    distance is ValueWithUnits = worldToPlane(plane, worldPoint)[2]; (this should probably just be in std)

    To get the length of an edge:
    length is ValueWithUnits = evLength(context, {entities : edgeQuery});
  • Lauren_FroschauerLauren_Froschauer Member Posts: 10 EDU
    Is there a way to evaluate the length of all the edges of a face by just selecting a face?
    Is there a way to return the coordinates of the two vertices that define an edge by selecting the face that the edge belongs to?
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    For getting the perimiter of a face, you can pass  qEdgeAdjacent(face, EntityType.EDGE) to evLength. To get the vertices of an edge, query for them using qVertexAdjacent(edge, EntityType.VERTEX) and use evVertexPoint using either the evaluated vertex query or using qNthElement.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
Sign In or Register to comment.