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.

how to query for all vertexes in a mesh

tommie_berrytommie_berry Member Posts: 12 ✭✭
how to query for all vertexes in a mesh

Best Answers

  • tommie_berrytommie_berry Member Posts: 12 ✭✭
    Answer ✓
    Yes, it is easy to extract all vertex points from the .stl file. Sorting them into each plane of the original scan is very difficult. The original scan planes are all parallel. I used the 3D points program in featurescript to create 3D splines, but you can only loft between 2D splines. So you have to create 2D closed splines from all the points close (<0.1mm) to one scan plane.
    then go to the next plane. So I agree, I can use the extracted points from a csv. But it would have been so much easier to query for all the points.
  • tommie_berrytommie_berry Member Posts: 12 ✭✭
    Answer ✓
    Thank you, that was very helpful.
    if you could send that code to tom@berry.org I am very interested.

Answers

  • tommie_berrytommie_berry Member Posts: 12 ✭✭
    edited April 2019
    I have a part studio with just an imported mesh.
    I want to loop through all the vertexes in the mesh using featurescript.
  • philip_thomasphilip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381
    Perhaps positing in the FeatureScript forum?
    Philip Thomas - Onshape
  • tommie_berrytommie_berry Member Posts: 12 ✭✭
    That’s where I thought it was, I wish I could delete it.
  • philip_thomasphilip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381
    @TimRice - can you help Tommie get this down and moved to the FeatureScript forum - there he will get a snippet that does exactly what he needs.
    Philip Thomas - Onshape
  • tommie_berrytommie_berry Member Posts: 12 ✭✭
    I reposted over there, please delete this one, sorry😜
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited April 2019
    Hi Tommie,

    There is no direct way to iterate through every single point in a mesh in FeatureScript. A user may select individual mesh points into a query parameter, but not all at once. If you are looking to do mathematical calculations on every single point, FeatureScript may simply not be the right solution for you.

    We do support many ways of identifying specific positions on a mesh surface. For instance you can find the closest point to another point/plane/body with evDistance, or find a point along a ray with evRaycast.

    So, what's your use case?
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @tommie_berry

    We don't expose mesh vertices to FeatureScript.  If you do a qOwnedByBody on a mesh, you'll notice that a mesh is basically just one composite face:

    https://cad.onshape.com/documents/f8b3df73f921b5ed6b03e0a3/w/180340618b58cdd57349a22f/e/899f59ff6132240c25fb70df

    This simplification allows us to increase user performance when working with meshes.  Please submit an Improvement Request for us to expose this information, or to create some kind of workaround function to expose a list of the locations of the vertices.

    What is your desired feature here?  Maybe we can suggest a different approach.
    Jake Rosenfeld - Modeling Team
  • tommie_berrytommie_berry Member Posts: 12 ✭✭
    If I could get the list of mesh points, then I could read a 2D spline for each original plane from the scan. Then I can loft between those 2D splines, to create an object I can edit.
  • tommie_berrytommie_berry Member Posts: 12 ✭✭
    Answer ✓
    Yes, it is easy to extract all vertex points from the .stl file. Sorting them into each plane of the original scan is very difficult. The original scan planes are all parallel. I used the 3D points program in featurescript to create 3D splines, but you can only loft between 2D splines. So you have to create 2D closed splines from all the points close (<0.1mm) to one scan plane.
    then go to the next plane. So I agree, I can use the extracted points from a csv. But it would have been so much easier to query for all the points.
  • tommie_berrytommie_berry Member Posts: 12 ✭✭
    Answer ✓
    Thank you, that was very helpful.
    if you could send that code to tom@berry.org I am very interested.
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @billy2

    The code block should be fine as long as you create the code block first and then paste into it.  If you paste and then highlight and click code, it looks bad.
    Jake Rosenfeld - Modeling Team
Sign In or Register to comment.