algorithmic modeling for Rhino
Hi all,
Is there a way, with a basic gh component or a Python script, to create a Plankton Mesh by specifying lists of vertices, half-edges, etc? I'm looking for something analogous to the Rhinoscript "AddMesh" command.
On a related note, does anyone know how to modify an existing Plankton Mesh to get a valid new one in Python? For example, I fed a Plankton mesh called "PMesh" in to a Python script component with the following code:
PMesh.Vertices.Add(0, 0, 0)
PMesh.Vertices.Add(20, 0, 0)
PMesh.Vertices.Add(20, 20, 0)
PMesh.Vertices.Add(0, 20, 0)
PMesh.Faces.AddFace(0, 1, 2, 3)
The resulting Plankton mesh has the new vertices, but the face doesn't show up. Do I have to add something to the half-edge lists as well?
Thanks,
Dave
Tags:
Hi Dave,
This script might help you with constructing plankton meshes in Python. Note, there are several different ways of "importing" Plankton in a Python script component. See my recent answer to your question about conway operators for what I think is the most robust way!
To answer your second question, assuming your plankton mesh has existing vertices, you need to specify the indices of the new vertices when adding the face. Thankfully PlanktonMesh.Vertices.Add() returns the index of the newly added vertex, so you could modify your code, like so...
v0 = PMesh.Vertices.Add(0, 0, 0)
v1 = PMesh.Vertices.Add(20, 0, 0)
v2 = PMesh.Vertices.Add(20, 20, 0)
v3 = PMesh.Vertices.Add(0, 20, 0)
PMesh.Faces.AddFace(v0, v1, v2, v3)
I posted some very rough documention a while ago... Please let me know if you have any ideas for how this could be clearer!
Hi Will,
Thanks so much for all of your responses. I think I can figure it out now. The documentation is very helpful, but I couldn't find that link anywhere. All I found was the docs here.
By modifying the link you sent me, I also found the documentation for PlanktonFaceList.cs. However, I couldn't anything for PlanktonHalfEdgeList.cs. Is there something similar? Is there a place where there are links to all of the docs?
Thanks again,
Dave
You're welcome :)
Do you have a little link in the corner that says "JUMP TO"? I'll admit it's not very discoverable....
I just saw that about 5 minutes ago! It's so small that I missed it completely.
Thanks again!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by