Can somebody explain how GUIDs of objects in Grasshopper work? I have the following code to bake some curves into rhino and keep track of their ids:
def my_code():
isocrvs = []
#... populate isocrvs list here ...
# bake curve into rhino
for crv in isocrvs:
new_crv = bake_guide_crv(crv)
#expected output: True
#actual output: False
print rs.IsCurve(new_crv)
def bake_guide_crv(guide_crv_id):
sc.doc = Rhino.RhinoDoc.ActiveDoc
# bake guide curve into rhino
doc_object = rs.coercecurve(guide_crv_id)
crv_id = sc.doc.Objects.AddCurve(doc_object)
crv_obj = sc.doc.Objects.Find(crv_id)
crv_obj.CommitChanges()
#prints True as expected
print rs.IsCurve(crv_id)
rs.DeleteObject(guide_crv_id)
#we put back the original Grasshopper document as default
sc.doc = ghdoc
return crv_id
if __name__ == '__main__':
my_code()
Since the curve now exists in rhino, the rs.IsCurve() function should return True? Why does it work within the function, but not after passing the GUID back to the parent function?