Grasshopper

algorithmic modeling for Rhino

Hello,

Is there is a method in rhinocommon or an approach how to offset mesh using C#?

I know there is a method using weaverbird. But i would like to do it in code.

Thanks,

Tom

Views: 437

Replies to This Discussion

See the documentation here 
I uploaded Rhinocommon so it is quite simple to use. 

Or the same thing : 

for (int i = 0; i < m.Vertices.Count; i++)
{
m.Vertices[i] = m.Vertices[i] + Vector3f.Multiply(m.Normals[i], (float) offset);
}

A = m;

Thank you for a reply.

In case I have unwelded mesh.
I have mesh where I appended other meshes. The shape looks like a simple box. When I offset it mesh looks exploded. Is there a way to offset unwelded mesh?

The problem is that you need to move coincident point with the same vector. For unwelded mesh the normal at coincident point is not the same. It could be Normal at Face.

See on internet how normals are calculated

http://wiki.polycount.com/wiki/VertexNormal

http://www.slideshare.net/foofiM/polygon-mesh

...  

So a solution could be to weld your mesh surely something in this order

mesh.append(other mesh);

mesh.Weld(20);

mesh.Normals.ComputeNormals(); # Attach normal vectors.

mesh.UnifyNormals(); # Make faces point outwards.

And unweld after that ?? 

Why not just use mesh offset, so that will remove the problem of Unwelded meshes?

Mesh m = GetSomeMesh();
Mesh newMesh = m.Offset(myDistance);

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Mesh offset work well thank you.

I looks like I can correct mesh shading for my mesh by unifying mesh faces loops (wb).

Probably this function does not exist in rhinocommon?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service