-
Notifications
You must be signed in to change notification settings - Fork 667
Description
If this issue is with Dynamo for Revit, please post your issue on the Dynamo for Revit Issues page.
If this issue is not a bug report or improvement request, please check the Dynamo forum, and start a thread there to discuss your issue.
Dynamo version
Tested in both Dynamo versions 1.3.3 and 2.0.1
Operating system
Windows 10
Reproducible issue
Tried to specifically import the FilteredElementCollector as follows with annotation:
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import FilteredElementCollector
This works, but as soon as you use a period (dot) anywhere in the Python text editor if you have annotation, it causes hang-time anywhere from 5 seconds onwards (Has caused apparent crashes - but I got lazy and stopped waiting).
# Importing Reference Modules
import clr # CLR ( Common Language Runtime Module )
clr.AddReference("RevitServices") # Adding the RevitServices.dll special Dynamo module to deal with Revit
import RevitServices # Importing RevitServices
from RevitServices.Persistence import DocumentManager # From RevitServices import the Document Manager
clr.AddReference("RevitAPI") # Adding the RevitAPI.dll module to access the Revit API
import Autodesk # Here we import the Autodesk namespace
from Autodesk.Revit.DB import FilteredElementCollector, Wall # From the Autodesk namespace - derived down to the Revit Database, we imoprt only the Filtered Element Collector and Wall classes
# Here we give the Revit Document a nickname of 'doc' which allows us to simply call 'doc' later without having to type the long namespace name
doc = DocumentManager.Instance.CurrentDBDocument
# To create a Filtered Element Collector, we simply type the PINK part of RevitAPIDocs ( FilteredElementCollector ), wrap it inside of Parenthesis and then call the ORANGE part of RevitAPIDocs ( Document ). If we don't specify a particular filter over this ( And we choose the 'OfClass' one here ) it will return an error as showcased in 01 - so we simply want to run our chosen filter with the Class of 'Wall' through it.
wallCollector = FilteredElementCollector( doc ).OfClass( Wall )
# To get our results back inside of Dynamo, we need to append a list to the OUT port
OUT = wallCollector
If I do not have the annotation on the same line as the import, it functions correctly. It also appears to only be the FilteredElementCollector, if I change to to an asterisk ( * ) to bring in everything we don't get the issue.
There is also no change if I import only the FilteredElementCollector, or have multiple classes called separated by a comma.
