algorithmic modeling for Rhino
I have modelled 3 types of Polygon (they have different opening sizes). I would like to duplicate one type of Polygon based on the gradient value from the bitmap. (Similar to image sampler in GH) So for example, the lighter bitmap will have bigger opening.
Most of the example /tutorial, explain this by using AddCircle() function. However I would like to use my surface or polysurface. From this document I can see only .DuplicateSurfaceBorder( surface )
Any other suggestion to duplicate the finished polygon and place on the plane grid?
Thank you.
Tags:
Joy,
Please attach some samples as it makes it very difficult to understand what you're trying to do.
If you've already got the objects (polygon's) do you mean, Breps, Meshes, or a closed curve region???
You wouldn't need to duplicate the surface boarder. You'd copy the object in it's entirety.
Thanks Mat,
I have made a polygon in Rhino and hope to use them as different sizes of brick. The way I place those brick is to loop them in i (x axis) and j(z axis). I don't know how to copy the entire polygon so I use 'rs.DuplicateEdgeCurves' to get the lines and later on join them as one line. I later on move them to place on specific size of the grid. Fill the curve to get the surface and extrude the curve. I knew it's not straight forward but I can't find the way to copy entire polygon as you suggested using python script.
I have attached the python script here.
Thanks again for you help.
I would use the CopyObject() method.
You can put this inside an 'if, elif, else' loop to test which object to copy to which location. This would need to test your image input against the attribute of the polygon.
Example with the bare bones below. You'd need to amend/insert a few extra loops to configured which object is copied to which point.
import rhinoscriptsyntax as rs
import scriptcontext as sc
import math#Prompt user to select objects to copy and points to copy to.
obj = rs.GetObject("Select object", filter = 8) #Change this line to get the different 'polygons' that you want to copy.
points = rs.GetObjects("Select points", filter = 1, group = True)#Get point to copy from for each of your polygons. Using volume centroid to begin with.
objCenter, error = rs.SurfaceVolumeCentroid(obj)#Insert loop to evaluate points based on input image etc.
pointAtt = ['default' for pt in points]for pt, att in zip(points, pointAtt):
if att == 'optionA':
#Copy relevent geometry to point. Remove 'break' statement'
break
elif att == 'optionB':
#Copy relevent geometry to point. Remove 'break' statement'
break
elif att == 'default':
#They should all be this setting at the moment until you assign a attribute to them.
vec = rs.VectorCreate(rs.coerce3dpoint(pt), objCenter)
rs.CopyObject(obj, vec)
else:
#Default catch statement incase it doesn't work.
print "Point without attribute found. Can't copy object"
break
Hi Mat,
Thanks a lot. It works :)
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