Grasshopper

algorithmic modeling for Rhino

Hi there,

I'm struggling to access the 3d voronoi component in Python. I know how to access the 2d version with:

import clr; clr.AddReference("Grasshopper")
import Grasshopper as gh

delaunay = gh.Kernel.Geometry.Delaunay.Solver.Solve_Connectivity(nodes,0.1,False)
voronoi = gh.Kernel.Geometry.Voronoi.Solver.Solve_Connectivity(nodes,delaunay,outline)

Where nodes is a Node2List with the points and outline is the Node2List of the bounding box corners.

When I change the code to 3d and create Node3Lists then the code fails stating that the method expects a Node2List...which is only 2 dimensional...

Can anyone guide be to the correct methods to use?

I've attached the 2d version as a reference.

Thanks a lot,

Florian

Views: 2035

Attachments:

Replies to This Discussion

Hi Florian

In GHPython 0.603, you can do something like this,For more information see this link: https://stevebaer.wordpress.com/2013/12/11/ghpython-node-in-code/,Check the attached file. I hope this helps

Attachments:

Awesome! Thanks

You can now call components as functions in GHPython.

Try accessing the [Voronoi 3D] node this way:

from ghpythonlib import components as ghcomp

voronoi = ghcomp.Voronoi3D(my_pts, my_box)

cells = voronoi[0]

boundaries = voronoi[1]

Hope this helps.
/SPM

Thanks a lot!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service