Hello everyone
I’m trying to develop a simple python plugin which draws a sort of “halo” around the bottom surface of a polysurface ( I’ll use that to avoid nesting objects too close to each other )
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def Halo():
OBJ = rs.GetObjects("Select objects to nest:", 16, False, True, True, True)
if not OBJ: return
for ObjId in OBJ:
Surfaces = rs.ExtractSurface(ObjId, 0, True)
for SrfId in Surfaces:
Edges = rs.DuplicateEdgeCurves(SrfId)
rs.DeleteObject(SrfId)
JoinedEdges = rs.JoinCurves(Edges)
rs.DeleteObjects(Edges)
for EdgeId in JoinedEdges:
col = rs.CreateColor(255,0,0)
Direction = (1000,1000,1000)
OffsetEdges = rs.OffsetCurve(EdgeId, Direction, 20)
rs.DeleteObjects(EdgeId)
for OEId in OffsetEdges:
rs.ObjectColor(OEId, col)
Grp = rs.AddGroup()
rs.AddObjectsToGroup([ObjId, OEId], Grp)
if __name__=="__main__":
DoHalo()
This won’t work because the surface “0” is not always the bottom one, as I could have rotated the objects. Question is :
How can I select the surfaces facing down or, at lest, the surfaces laying on the C plane ?
Or even better, is there a way to select the largest one between the top and bottom surface ?
Of course I am open to any better solution
Thank you !
2 posts - 2 participants
