-1
  • 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

r.schmitt
  • 53
  • 1
  • 10

1 Answers1

0

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.

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17
  • I see what happened now, the error I was getting referred to a "Reference object" in a general sense... not the Autodesk.Revit.DB.Reference object I assumed it was, the debugging environment for python within dynamo is not the best. I was creating the point input for IndependentTag.Create poorly. You are correct, you can feed Reference a Wall object just fine! – r.schmitt Apr 05 '19 at 18:12