• the revit API IndependentTag.Create() method requires a Reference object as one of its inputs
  • A Reference object is instantiated with a revit Element object
  • I have bunch of revit Wall objects which inherit from the Element class
  • in C# I can simply say:Reference ref = new Reference(wall as Element);
  • clr.Convert does not cast correctly, just returns the object as a Wall again
  • ref = Reference(wall) in python gives an exception that the reference cannot be used

Can one cast a .Net object to its parent object in python (iron python)? I am trying to bandage up someone's dynamo/python script and that one object is mucking it up

1 Answers

Jeremy Tammik On Best Solutions

In C#, if wall is of class Wall and that inherits from Element, there is no need to cast wall to Element. You can just use wall as is. It is already a Wall and therefore also an Element. I would assume the same applies in Python. I suggest you post a code snippet for better understanding.