Fail to get the tagged parameter

Hello All,

I’m using Revit 2016 and Dynamo 1.3.3 I have an problem when i’m running my script. The script is collecting all the categories and all the elements from the model, but i get the error f"Exception: fail to get the tagged parameter."

I hope that someone could tell me why i’m getting this error.

marc

model_check_algemeen(2018-10-08).dyn (9.1 KB)

Hi @marc_franken,

I could see two things:

When you test if the view is a template, the property is e.IsViewTemplate

When you create the iCollection, you need to create en empty List and then use Add to “fill” the list with the ids:

ex_lst = List[ElementId]()
for i in ex:
    ex_lst.Add(i)

When I make the changes above, I get an output, but I wont/can’t determain if it’s what you are after :slight_smile:. I’ve attached the dyn that worked for me.

model_check_algemeen(2018-10-08)_ForMarc.dyn (10.5 KB)

PS: It was done with a simplified version of what you are attempting though.

Hi @MartinSpence

i downloaded your file but i got an error that the file was corrupt. So i made the changes that you said in my own script but i stil get the same error.

thank you for your time and effort. I hope tou haven an another idea

marc

Ah, sorry for the corrupt upload. Don’t know what went wrong.

Regarding the python script, I ran it again with the entire list and I am getting an output. Although I failed to notice, that you are on Revit 2016. Im afraid I don’t have access to that at the moment.

This is in 2018 Dynamo 1.3.2:

import clr
import sys

from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
#from RevitServices.Transactions import TransactionManager

# Import ToDSType(bool) extension method
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

doc = DocumentManager.Instance.CurrentDBDocument
tekst = []
viewcoll = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Views)

ex = []
for e in viewcoll:
	if e.IsTemplate == True:
		ex.append(e.Id)
	else:
		pass

ex2 = List[ElementId]()
for i in ex:
	ex2.Add(i)

collection = FilteredElementCollector(doc).WhereElementIsNotElementType().Excluding(ex2).ToElements()

sb_list1 = []
for e in collection:
	if e.Category != None:
		sb_list1.append(e.ToDSType(True))

Material_list = []
Level_list = []
FillPatternElement_list = []
FloorPlanView_list = []
Element_list = []
GraphicsStyle_list = []
Electrical_list = []
SunAndShadow_list = []
PanelSchedule_list = []
FloorPlanView_list = []
CeilingPlanView_list = []
ElevationMarker_list = []
SectionView_list = []
AreaScheme_list = []
Phase_list = []
Project_list = []
Revision_list = []
AxonometricView_list = []
Zone_list = []
BasePoint_list = []
ParameterElement_list = []
PropertySetElement_list = []
PipeSegment_list = []
MechanicalSystem_list = []
Sheet_list = []
DetailCurve_list = []
ReferencePlane_list = []
Grid_list = []
ScheduleSheetInstance_list = []
Viewport_list = []
DraftingView_list = []
PipingSystem_list = []
View_list = []
TextNote_list = []
RevitLinkInstance_list = []
Curtain_Panel_list = []
M_Grid_Head_list = []
Space_list = []
LoadCase_list = []
Dimension_list = []
FilledRegion_list = []
RevisionCloud_list = []
MEPSystem_list = []
list_out = []

for k in sb_list1:
	x = str(k)
	if x == 'Material':
		Material_list.append (k)
	elif x.startswith ('Level'):
		Level_list.append (k)
	elif x == 'Element':
		Element_list.append (k)
	elif x == 'LinePatternElement':
		FillPatternElement_list.append (k)
	elif x == 'GraphicsStyle':
		GraphicsStyle_list.append (k)
	elif x.startswith('Electrical'):
		Electrical_list.append (k)
	elif x.startswith('SunAndShadow'):
		SunAndShadow_list.append (k)
	elif x.startswith('PanelSchedule'):
		PanelSchedule_list.append (k)
	elif x.startswith('FloorPlanView'):
		FloorPlanView_list.append (k)
	elif x.startswith('CeilingPlanView'):
		CeilingPlanView_list.append (k)
	elif x == 'ElevationMarker':
		ElevationMarker_list.append (k)
	elif x.startswith('SectionView'):
		SectionView_list.append (k)
	elif x == 'AreaScheme':
		AreaScheme_list.append (k)
	elif x == 'Phase':
		Phase_list.append (k)
	elif x == 'Revision':
		Revision_list.append (k)
	elif x.startswith('AxonometricView'):
		AxonometricView_list.append (k)
	elif x == 'Zone':
		Zone_list.append (k)
	elif x == 'BasePoint':
		BasePoint_list.append (k)
	elif x == 'ParameterElement':
		ParameterElement_list.append (k)
	elif x.startswith('Project'):
		Project_list.append (k)
	elif x.startswith('PropertySetElement'):
		PropertySetElement_list.append (k)
	elif x == 'PipeSegment':
		PipeSegment_list.append (k)
	elif x == 'MechanicalSystem':
		MechanicalSystem_list.append (k)
	elif x.startswith('Sheet'):
		Sheet_list.append (k)
	elif x == 'DetailCurve':
		DetailCurve_list.append (k)
	elif x == 'ReferencePlane':
		ReferencePlane_list.append (k)
	elif x == 'Grid':
		Grid_list.append (k)
	elif x == 'ScheduleSheetInstance':
		ScheduleSheetInstance_list.append (k)
	elif x == 'Viewport':
		Viewport_list.append (k)
	elif x == 'DraftingView':
		DraftingView_list.append (k)
	elif x == 'PipingSystem':
		PipingSystem_list.append (k)
	elif x == 'View':
		View_list.append (k)
	elif x == 'TextNote':
		TextNote_list.append (k)
	elif x == 'RevitLinkInstance':
		RevitLinkInstance_list.append (k)
	elif x == 'Curtain Panel':
		Curtain_Panel_list.append (k)
	elif x == 'M_Grid Head':
		M_Grid_Head_list.append (k)
	elif x == 'Space':
		Space_list.append (k)
	elif x == 'LoadCase':
		LoadCase_list.append (k)
	elif x == 'Dimension':
		Dimension_list.append (k)
	elif x == 'FilledRegion':
		FilledRegion_list.append (k)
	elif x == 'RevisionCloud':
		RevisionCloud_list.append (k)
	elif x == 'MEPSystem':
		MEPSystem_list.append (k)
	else:
		list_out.append (k)

OUT = list_out

Sorry, but I can’t seem to replicate the error you are getting.

Hi, @MartinSpence

thank you for your time again.
I tested the script on an other model and there it worked fine. So i think that the problem is in the first model. So i will look more into that model to find the problem. The script is working now on an model in Reit 2017.

marc

1 Like