Question 1: If I have a curve in Python, is there a way to get the Rhino object so I can use the Highlight and Select methods without having the GUID? If not, is there a method somewhere that will find the same object within the current document and so I can access it’s GUID and/or access the Rhino object? I am trying to not iterate through the document’s objects and compare each curve since this takes up a fair amount of CPU time. Is there an easier way?
Question 2: If I have to iterate through the document’s objects, why doesn’t the document’s object geometry equal the curve? Look @ the following code. Assume that c is a curve object that matches a curve in the document.
for x in sc.doc.Objects:
if x.Geometry == c:
print 'found, id is ' + str(x.Id)
Even if the curve’s geometry (properties) matches an object’s properties within the document such as PointAtStart, PointAtEnd, TangentAtStart, TangentAtEnd, etc, the object is never found. If I compare these properties individually then it is found. Maybe I’m not seeing some property that is different between the two objects but it appears they are in fact the same.
Question 3: In .NET many times there is an “.Items” collection in an object that represents the properties of an object or class. These classes naturally allow access to each individual property, i.e. “.X”, “.Y”, etc as well as the same properties in the .Items collection. This allows the developer to iterate through the .Items collections of 2 objects and easily see if the two objects are the same. Is there a way to do this with the current API?
You don’t really need to worry about this, I’ve never seen an appreciable difference in trying to avoid working with the GUIDs vs the actual ‘objects,’ but…how to put this quickly and simply…once you move beyond using the Rhinoscript commands to the underlying RhinoCommon you’ll be working with the objects more.
Question 2: If I have to iterate through the document’s objects, why doesn’t the document’s object geometry equal the curve? Look @ the following code. Assume that c is a curve object that matches a curve in the document.
for x in sc.doc.Objects:
if x.Geometry == c:
print 'found, id is ' + str(x.Id)
Even if the curve’s geometry (properties) matches an object’s properties within the document such as PointAtStart, PointAtEnd, TangentAtStart, TangentAtEnd, etc, the object is never found. If I compare these properties individually then it is found. Maybe I’m not seeing some property that is different between the two objects but it appears they are in fact the same.
What are you trying to do there? Find an object’s ID or match an identical object? Short answer I don’t think you’re comparing the right thing, “.Geometry” is a giant ball of stuff, it’s not just literally “the geometry,” and “some curve” won’t be equal to “someothercurve.Geometry.”