Good morning.
I am having the following problem when trying to get the elements through a list of “BuiltInCategory.OST_…” when running my code it returns an error “Warning: IronPythonEvaluator.Error in operation EvaluateIronPythonScript.
An internal error has occurred.” and I really don’t understand why this is happening…
I appreciate your help
import clr
import os
import time
import os.path
import datetime
import re
from datetime import date
from datetime import datetime
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
import Autodesk.Revit.DB.Structure as DBS
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
from Autodesk.Revit.UI.Selection import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
ColectorCategoriasTAGS = [
BuiltInCategory.OST_MassTags_Obsolete_IdInWrongRange,
BuiltInCategory.OST_FoundationSlabAnalyticalTags,
BuiltInCategory.OST_WallFoundationAnalyticalTags,
BuiltInCategory.OST_IsolatedFoundationAnalyticalTags,
BuiltInCategory.OST_WallAnalyticalTags,
BuiltInCategory.OST_FloorAnalyticalTags,
BuiltInCategory.OST_ColumnAnalyticalTags,
BuiltInCategory.OST_BraceAnalyticalTags,
BuiltInCategory.OST_BeamAnalyticalTags,
BuiltInCategory.OST_StructConnectionProfilesTags,
BuiltInCategory.OST_StructConnectionHoleTags,
BuiltInCategory.OST_CouplerTags,
BuiltInCategory.OST_StructConnectionWeldTags,
BuiltInCategory.OST_StructConnectionShearStudTags,
BuiltInCategory.OST_StructConnectionAnchorTags,
BuiltInCategory.OST_StructConnectionBoltTags,
BuiltInCategory.OST_StructConnectionPlateTags,
BuiltInCategory.OST_StructConnectionTags,
BuiltInCategory.OST_FabricAreaTags,
BuiltInCategory.OST_FabricReinforcementTags,
BuiltInCategory.OST_AreaReinTags,
BuiltInCategory.OST_RebarTags,
BuiltInCategory.OST_PathReinTags,
BuiltInCategory.OST_FabricationContainmentTags,
BuiltInCategory.OST_FabricationPipeworkTags,
BuiltInCategory.OST_FabricationHangerTags,
BuiltInCategory.OST_FabricationDuctworkTags,
BuiltInCategory.OST_PipeInsulationsTags,
BuiltInCategory.OST_DuctLiningsTags,
BuiltInCategory.OST_DuctInsulationsTags,
BuiltInCategory.OST_ConduitTags,
BuiltInCategory.OST_CableTrayTags,
BuiltInCategory.OST_ConduitFittingTags,
BuiltInCategory.OST_CableTrayFittingTags,
BuiltInCategory.OST_ZoneTags,
BuiltInCategory.OST_SprinklerTags,
BuiltInCategory.OST_LightingDeviceTags,
BuiltInCategory.OST_FireAlarmDeviceTags,
BuiltInCategory.OST_DataDeviceTags,
BuiltInCategory.OST_CommunicationDeviceTags,
BuiltInCategory.OST_SecurityDeviceTags,
BuiltInCategory.OST_NurseCallDeviceTags,
BuiltInCategory.OST_TelephoneDeviceTags,
BuiltInCategory.OST_DuctFittingTags,
BuiltInCategory.OST_PipeFittingTags,
BuiltInCategory.OST_WireTags,
BuiltInCategory.OST_PipeAccessoryTags,
BuiltInCategory.OST_FlexPipeTags,
BuiltInCategory.OST_PipeTags,
BuiltInCategory.OST_ElectricalCircuitTags,
BuiltInCategory.OST_DuctAccessoryTags,
BuiltInCategory.OST_DuctTerminalTags,
BuiltInCategory.OST_FlexDuctTags,
BuiltInCategory.OST_DuctTags,
BuiltInCategory.OST_BridgeBearingTags,
BuiltInCategory.OST_BridgeGirderTags,
BuiltInCategory.OST_BridgeFoundationTags,
BuiltInCategory.OST_BridgeDeckTags,
BuiltInCategory.OST_BridgeArchTags,
BuiltInCategory.OST_BridgeCableTags,
BuiltInCategory.OST_BridgeTowerTags,
BuiltInCategory.OST_BridgePierTags,
BuiltInCategory.OST_BridgeAbutmentTags,
BuiltInCategory.OST_RevisionCloudTags,
BuiltInCategory.OST_InternalAreaLoadTags,
BuiltInCategory.OST_InternalLineLoadTags,
BuiltInCategory.OST_InternalPointLoadTags,
BuiltInCategory.OST_AreaLoadTags,
BuiltInCategory.OST_LineLoadTags,
BuiltInCategory.OST_PointLoadTags,
BuiltInCategory.OST_BeamSystemTags,
BuiltInCategory.OST_StructuralConnectionHandlerTags_Deprecated,
BuiltInCategory.OST_TrussTags,BuiltInCategory.OST_KeynoteTags,
BuiltInCategory.OST_DetailComponentTags,
BuiltInCategory.OST_MaterialTags,
BuiltInCategory.OST_FloorTags,
BuiltInCategory.OST_CurtaSystemTags,
BuiltInCategory.OST_HostFinTags,
BuiltInCategory.OST_StairsTags,
BuiltInCategory.OST_MultiCategoryTags,
BuiltInCategory.OST_PlantingTags,
BuiltInCategory.OST_AreaTags,
BuiltInCategory.OST_StructuralFoundationTags,
BuiltInCategory.OST_StructuralColumnTags,
BuiltInCategory.OST_ParkingTags,
BuiltInCategory.OST_SiteTags,
BuiltInCategory.OST_StructuralFramingTags,
BuiltInCategory.OST_SpecialityEquipmentTags,
BuiltInCategory.OST_GenericModelTags,
BuiltInCategory.OST_CurtainWallPanelTags,
BuiltInCategory.OST_WallTags,
BuiltInCategory.OST_PlumbingFixtureTags,
BuiltInCategory.OST_MechanicalEquipmentTags,
BuiltInCategory.OST_LightingFixtureTags,
BuiltInCategory.OST_FurnitureSystemTags,
BuiltInCategory.OST_FurnitureTags,
BuiltInCategory.OST_ElectricalFixtureTags,
BuiltInCategory.OST_ElectricalEquipmentTags,
BuiltInCategory.OST_CeilingTags,
BuiltInCategory.OST_CaseworkTags,
BuiltInCategory.OST_Tags,
BuiltInCategory.OST_MassAreaFaceTags,
BuiltInCategory.OST_MassTags,
BuiltInCategory.OST_StructuralStiffenerTags,
BuiltInCategory.OST_SitePropertyLineSegmentTags,
BuiltInCategory.OST_SitePropertyTags,
BuiltInCategory.OST_MEPSystemZoneTags,
BuiltInCategory.OST_MechanicalEquipmentSetTags,
BuiltInCategory.OST_NodeAnalyticalTags,
BuiltInCategory.OST_LinkAnalyticalTags,
BuiltInCategory.OST_StairsTriserTags,
BuiltInCategory.OST_StairsSupportTags,
BuiltInCategory.OST_StairsLandingTags,
BuiltInCategory.OST_StairsRunTags,
BuiltInCategory.OST_RailingSystemTags,
BuiltInCategory.OST_PathOfTravelTags,
BuiltInCategory.OST_MEPSpaceTags,
BuiltInCategory.OST_RoomTags,
BuiltInCategory.OST_DoorTags,
BuiltInCategory.OST_WindowTags,
BuiltInCategory.OST_PartTags,
BuiltInCategory.OST_AssemblyTags,
BuiltInCategory.OST_RoofTags,
BuiltInCategory.OST_StairsRailingTags,
BuiltInCategory.OST_MultiReferenceAnnotations
]
categorias_validas = []
for categoria in ColectorCategoriasTAGS:
try:
categorias_validas.append(categoria)
except:
pass
Elementos = []
for cat in categorias_validas:
elemento = FilteredElementCollector(doc).OfCategory(cat).WhereElementIsNotElementType().ToElements()
for e in elemento:
Elementos.append(e)
OUT = Elementos