Skip to content

Instantly share code, notes, and snippets.

@Cyril-Pop
Created November 11, 2019 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cyril-Pop/0aa18466aa4209325b9899e0c7a69189 to your computer and use it in GitHub Desktop.
Save Cyril-Pop/0aa18466aa4209325b9899e0c7a69189 to your computer and use it in GitHub Desktop.
[Dynamo+=Python] checkview
def checkview(view, import_inst):
if not view.IsTemplate:
#get importinstance in each view
lst_inst = FilteredElementCollector(doc, view.Id).OfClass(ImportInstance).ToElements()
#if import is in this wiew and the view is depend of a viewtemplate
if any([import_inst.Id == x.Id for x in lst_inst]) and doc.GetElement(view.ViewTemplateId) is not None:
#get the view template
viewtempl = doc.GetElement(view.ViewTemplateId)
lstnotcontrol = viewtempl.GetNonControlledTemplateParameterIds()
#if the category is control by the viewtemplate
if any([BuiltInParameter.VIS_GRAPHICS_IMPORT.value__ == x.IntegerValue for x in lstnotcontrol]):
return view
#if the category is not control by the viewtemplate
else:
return viewtempl
#else import is in this wiew and the view is not depend of a viewtemplate
elif any([import_inst.Id == x.Id for x in lst_inst]):
return view
else:
return None
else:
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment