-
-
Save Cyril-Pop/0aa18466aa4209325b9899e0c7a69189 to your computer and use it in GitHub Desktop.
[Dynamo+=Python] checkview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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