Quantcast
Channel: Grasshopper - McNeel Forum
Viewing all articles
Browse latest Browse all 39494

Display large amount of meshes that are totally the same in shape through grasshopper component

$
0
0

@Petras_Vestartas wrote:

Hi,

I would like to ask what is the proper way of displaying large amount of elements via grasshopper component?

I have a collection of objects that are totally the same (not necessary boxes) but an example I did is this:

In the Solve instance each iteration I declare mesh that is global to the component:

previewMesh = new Mesh();

then I loop through a for loop and append mesh boxes to previewMesh

foreach(Rigid body in solver.Bodies){


previewMesh.Append(Mesh.CreateFromBox(b, 1, 1, 1));

}

And then display it through custom previews:

    public override void DrawViewportWires(IGH_PreviewArgs args) {
        args.Display.DrawMeshWires(previewMesh, System.Drawing.Color.Black);
    }

    public override void DrawViewportMeshes(IGH_PreviewArgs args) {
        args.Display.DrawMeshShaded(previewMesh, m);
    }

Since this is the same geometry I do not think this is the best way to create one large mesh out of many small meshes. What would be the most efficient way regarding display?

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 39494

Trending Articles