Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

doc.Objects.Delete how to delete PolylineCurve

$
0
0

I must be missing something obvious but I cant seem to figure it out.

I would like to split a line into two curves then delete the shorter of the two. When it comes time to delete the polylinecurve I get an error saying it needs a Rhino object. When looking at the documentation it seems like it can take a GUID, Rhino object, ObjRef. How do I go about getting to one of the supported data types ? What is a ObjRef ? Is there no way to just delete that polylinecurve object directly ?

Thanks !

con_crvs = rs.GetObjects("Select Curves to connect to",4)

for cc in con_crvs:
    
    cc_obj = rs.coercecurve(cc)
    
    if R.Geometry.Intersect.Intersection.CurveCurve(off_crv,cc_obj,0.01,0.01).Count > 0:
        
        for inter_eve in R.Geometry.Intersect.Intersection.CurveCurve(off_crv,cc_obj,0.01,0.01):
            inter_param = cc_obj.ClosestPoint(inter_eve.PointA)
            cc_split = cc_obj.Split(inter_param[1])
            
            len_l = []
            

            
            
            for ccs in cc_split:
               
                len_l.append(ccs.GetLength())
                
            print max(len_l)
            print min(len_l)
            
            for cca in cc_split:
                #print cca.GetLength()
                if round(cca.GetLength(),2) == round(max(len_l),2):
                    
                    target_crv = cca
                if round(cca.GetLength(),2) == round(min(len_l),2):
                    doc.Objects.Delete(cca)

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles