algorithmic modeling for Rhino
Hey,
I want to do 'convex-hull' for a tree of curves. For each branch I need to make the Cnvx-Hull separately (but if I have a list in one branch, I wanna do the convex hull for the entire list- together).
But it didn't work directly on grasshopper (if you have an idea pls let me know)
So I also trying to use the convex hull function of rhino\ grasshopper in the python component...
I wrote this code:
# input: treeOfCrvPoints <Tree>
# output: cnvxHullTree <Tree>
import System
import rhinoscriptsyntax as rs
import clr
clr.AddReference("Grasshopper")
from Grasshopper.Kernel.Data import GH_Path as ghPath
from Grasshopper.Kernel.Geometry import ConvexHull as cnvxHull
from Grasshopper import DataTree as ghTree
tree = ghTree[System.Object]()
for i in range(treeOfCrvPoints.BranchCount):
path = ghPath(i)
crvs = treeOfCrvPoints.Branch(i)
cnvxCrv = cnvxHull(crvs)
cnvxHullTree.Add(cnvxCrv,path)
I have an error about this line: cnvxCrv = cnvxHull(crvs)
it says: Runtime error (ArgumentTypeException): namespace# is not callable
Tags:
it doesn't work.. but- I combined your code with my code and it worked.
Thank you very much :)
Attached here two pictures (for other people):
First only your code- didn't work in my case for som reason..
Second the combination (the green lines are the convex result)
forgot the second one :)
In my example the input "Pts" is defined as a list.
It probably does not work for you since you define your input as a tree.
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