HI,
I am trying to select specific curves by using their area centroid, which is basically three coordinates.
Ive managed to obtain these coordinates using bounding boxes, given these curves are not sitting on cplanes.
However i cant seem to select specific curves by using just the z coordinates. Basically i can put them into lists based on length etc, but not sure how to work with coordinates. Here are my current notes
from Rhino.Commands import Result
from Rhino.DocObjects import ObjectType
import rhinoscriptsyntax as rs
from scriptcontext import doc
layer_objs = rs.ObjectsByType(4,True)
if layer_objs:
#create an empty list
mylist=[]
for obj in layer_objs:
#find curves among the objects
if rs.IsCurve(obj):
if abs(rs.CurveLength(obj)<100):
#curve meets selection criteria, append to “good” list
mylist.append(obj)
rs.UnselectAllObjects()
#bBox = rs.BoundingBox(mylist[0])
#CURVE1
#rs.UnselectAllObjects()
for i in mylist:
bBox = rs.BoundingBox(i)
cent = [(bBox[0][0] + bBox[6][0])/2,(bBox[0][1] + bBox[6][1])/2,(bBox[0][2] + bBox[6][2])/2]
print cent
rs.AddPoint(cent[0],cent[1],cent[2])
newlines = rs.SelectObjects(mylist)
if newlines:
s=[]
for line in newlines:
if rs.IsCurve(line):
if abs(cent[2]< -11):
s.append(line)
rs.UnselectAllObjects()
rs.SelectedObjects(s)
I keep getting the error: expected an indented block.
Help would be appreciated, thank you.