Grasshopper

algorithmic modeling for Rhino

Something that often causes me problems with GH is things end up pointing in a direction I don't expect them to... I'll then end up trying to figure out how to reverse or rotate the things that I want changing but this never works...

In the attached example I converted a box to a mesh. I divided the box surfaces and found the closest points on the mesh and then got the mesh Normals at these points.

Why don't the mesh normals all point out from each face? Is it because they are also on the mesh edges?

I also tried this with a spherical mesh and most normals point out but some seem to be in a strange position.

Views: 4193

Attachments:

Replies to This Discussion

Hi Martyn,

Use the "Face normals" component instead. It will will give you the center of each mesh's face, along with face normals.

Attachments:

Thanks for the reply.

I really want to find the normal vector at a specific point though. I'm working on an application for a Coordinate Measurement Machine (CMM). I use this to check pressed metal components. If I have a set of surface points from the CAD model of the component, I can program the CMM to take measurements at these points but I need to move it to a point along a vector normal to the surface and hit the surface along this vector. I then get an actual measurement coordinate and I can see how close the component is to the CAD model.

I could use face normals in some instances, but the latest check requires that I take measurements at specific coordinates which may not be at a mesh face centre.

If the mesh was fine enough then maybe I could use the closest mesh face centre but this still leaves me wondering why I get the illogical normal directions in the example file I posted.

A triangular mesh face is always flat. So the face normal is valid for any coordinate on the face.

Any mesh is just an approximation of a smooth surface. The face normal is a very rough approximation of the normals in the area of the face. You can get a better approximation by interpolating the normals of the face and the normals of adjacent faces.

About your "illogical normals": Looks like the point returned by MeshEval is wrong. If you connect the original point from MeshCP as an anchor to VDisp, the normals look perfectly fine.

Thanks Hannes, yes, I got a better set of normals from using the MeshCP!

Hello Martyn,

Rhinocommon also has the vertexNormalList class which can get the normals at the vertices of the mesh. Rhinoscriptsyntax also has a function to get the normals at the vectors.

Keep in mind, that the normals at the vertices are not the same if the vertices are welded or not. If a vertex is welded, then the vertex normal is averaged between the faces that meet at that vertex. If it's not welded, then there are in effect as many vertices as regions meet at that vertex, and hence the vertex has the same number of normals. 

The image bellow is of two cylinders with the indexes of their vertices and their normals plotted; the one on the right has all it's vertices welded (notice the smooth edges). The one on the left has the vertices that meet at the top and bottom ends unwelded. 

I'll also attach the script with which I made the vertices' normals and indexes.

Oh, and what you are working on sounds interesting! Coordinate Measurement Machine, cool

Attachments:

Hi Jesus, that's really interesting. I'd love to have a look at the script but I think I need Rhino5 for python scripts.

The CMM is pretty cool... it can measure points to an accuracy of about +/- 0.005mm so its great for digitising objects and reverse engineering them or for checking parts.

I want to find easier ways to create CNC programs to run it in auto rather than manually taking points.

A typical line of CNC code for taking a point vertically downwards at (0,0,0) would be...

POINT,1,E1

IP,0.00,0.00,5.00       -      (Move to 5mm above (0,0,0) )

VP,0.00,0.00,0.00,0,0,-1       -     (Measure point at (0,0,0) in -Z direction)

so being able to take a list of surface target points, calculate a pre-hit point say 5mm away from the target along the surface normal and get the unitised surface normal should enable me to generate the CNC code!

If I get something working then I'll try and post a video!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service