Hello all,
this might be a very basic question for everyone having more C# experience then I, but so far I havent found any tutorial explaining this:
How can I convert for example a Rhino.Geometry.Brep into an Rhino.DocObjects.ObjRef ?
I need the ObjRef or RhinoObject (?) for the delete function: ObjectTable.Delete Method (RhinoObject, Boolean)
well, to work with ids, I need to have a RhinoObject at the begining, right?. But the problem was how do i get from a Rhino.Geometry to a RhinoObject.
The only way I ever got an Rhino.Geometry into a RhinoObject was by FindByLayer() but i need a specific Object not the whole Layer. So I tried it with the FindByUserString(), but it doesnt seem to put any “findings” into my RhinoObject “srf”.
you could compare the boundingbox of the object geometry and the geometry to get the object.
import Rhino as rh
import scriptcontext as sc
l1 = rh.Geometry.Line(1,2,3,4,5,6)
sc.doc.Objects.AddLine(l1)
for i in rh.RhinoDoc.ActiveDoc.Objects:
if i.Geometry.GetBoundingBox(i).Equals(rh.Geometry.Line(1,2,3,4,5,6).BoundingBox):
sc.doc.Objects.Purge(i)