Get All Structural Column Instances in document : Refresh issue in Python

Hi All,

Not sure why when I run the following code in a code block, the output doesn’t refresh when I delete/add columns in Revit.
(compared with the OOTB nodes)

import clr
import RevitServices
from RevitServices.Persistence import DocumentManager

# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument



StructuralColumns = collector.WherePasses(filter).WhereElementIsNotElementType().ToElements()


I need to disconnect/re-connect the wire to refresh.

Is It how is to supposed to work? am I missing something in the code?


This is how it’s supposed to work. The python node is not tied in to any of Revit’s events, while the “All Elements of Category” is listening to the Document.IsModified event.

1 Like

Thanks @Dimitar_Venkov. Can it be implemented in a python script?

If so, are there any similar examples I can refer to(this forum or others. Python or other languages. Custom nodes)?

Not sure if it’s at all possible and it it is, you’ll probably need to completely re-write the part of Dynamo that executes python scripts. Then you’re probably gonna go and place that new node inside a custom node, and find out that it has stopped working again :smiley:

This is also why 99% of the custom nodes on the package manager, with a python script inside, simply have a refresh/re-execute toggle.

Why don’t you just use the built in node? You’ll save yourself a lot of trouble and you can even use it as an input to your python script. That way every time the builtin node re-executes, it will also re-execute your python script.

Thanks @Dimitar_Venkov