vocx wrote: ↑
Fri Nov 15, 2019 3:31 am
I'm not saying it's wrong, I just want to know if there is any circumstance where this may not be true.
There is trick somewhere in PropertyContainerPy to call Part.getShape(obj) if the caller requested an attribute named 'Shape' but the object does not have it. Part.getShape() does not simply return the linked shape, there are quite a few things done there, most obvious one is to transform the linked shape into the placement of the Link. It also supports group, which will generate a compound of its children shapes. So you can use App::Part in Arch as well if you like.
If all the Python code wants is to access the Shape, then replacing isDerivedFrom with hasattr shall be fine. If there are other needs, like trying to access the per face color, then it won't work, for now.
Another thing, Link by default will return the property of the linked object as well, unless the Link has a property with the same name . So with a Link to an Extrusion, will can access its Base simply as Link.Base, while Link.Placement will return Link's own placement. In the case of Arch, I saw it does something special with Extrusion. I didn't know its logic there, so I still keep the isDerivedFrom() checking there just to be safe. It may or may not work for a Link to Extrusion.