Grasshopper

algorithmic modeling for Rhino

Can anyone tell me the appropriate command to do the above.

Many thanks

William

Views: 465

Replies to This Discussion

Transferring?

Making a duplicate in grasshopper.

Thank you. Will try it when I get back to work.

The two functions(duplicate and duplicatemesh) does the same in principle, however they return a different object. Meaning that the duplicate functions returns a GeometryBase obj, which I assume you have to cast. the DuplicateMesh() function does this automatically for you and returns a Mesh.

I hope this helps. 

What is the full syntax required for the duplicate command?

Yes, DuplicateMesh is what you're after.

The question remains whether you want to create a new mesh in Grasshopper which is completely disassociated form the original mesh in Rhino, or whether you want to maintain that link. If the grasshopper mesh data needs to remember where it came from, you need to use Kernel.Types.GH_Mesh instead of Rhino.Geometry.Mesh.

What is the syntax for using the Rhino.Geometry.Mesh

I have tried to simply add that line and also

A=Rhino.Geometry.Mesh

In both cases, there is a fatal warning message -

1. Error (BC30691): 'Mesh' is a type in 'Geometry' and cannot be used as an expression. (line 88)

Many thanks

"Mesh" is the name of the type we use in RhinoCommon for mesh geometry. The "Rhino.Geometry." prefix is the location of that type within the assembly, also sometimes called the "namespace". Together; "Rhino.Geometry.Mesh" fully identifies the correct type. This is needed because sometimes you might have more than one type with the same name, and the only way to tell them apart is to use the namespace as well.

A "Type" (in this case a "Class") can be thought of as a collection of related information and functionality. A Mesh is used to represent some actual mesh geometry, and it provides ways to measure and modify that data (transforming, assigning colours, count the number of faces, measure the bounding box etc. etc.). There is only 1 type called Mesh, but you can have many different "instances" of that type, each of which provides access to a differently shaped mesh.

Sometimes a type contains "Shared" functions ("static" in C#). These functions do not require actual geometry, they always work. As such you do not need an instance of Mesh before you can use these functions. For example Mesh.CreateFromSphere(), which creates a new mesh instance based on an existing Sphere instance. It would be mean of us to require you create a pointless mesh before you can create the mesh you want. You call a Shared method by using the type name, a dot, and then the method name.

However most functions and properties are not "Shared", they require an existing mesh instance before they can work. For example Mesh.ClosestPoint(). These so called instance-functions (they are the most common type, so we usually just call them "functions" or "methods") must be called not on the type, but on the instance instead.

The difference:

Dim myMesh As Mesh = Mesh.CreateFromSphere(mySphere, 20,20)

Dim myPoint As Point3d = myMesh.ClosestPoint(Point3d.Origin)

mySphere is an instance of Rhino.Geometry.Sphere, myMesh is an instance of Rhino.Geometry.Mesh and myPoint is an instance of Rhino.Geometry.Point3d.

CreateMeshFromSphere() is a Shared function on Rhino.Geometry.Mesh and must be called via the type name. ClosestPoint() is an instance function of Rhino.Geometry.Mesh and must be called on an instance of Rhino.Geometry.Mesh, and Origin is a Shared property on Rhino.Geometry.Point3d.

------------------------------------------------------

If you want to create a duplicate of an existing mesh instance (let's assume it's called originalMesh), then you need to:

Dim duplicateMesh As Mesh = originalMesh.DuplicateMesh()

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