Skip to content

Commit

Permalink
added try/except to wipe collaboration cache tool to handle case when…
Browse files Browse the repository at this point in the history
… there is no cache folder in a version of revit
  • Loading branch information
jmcouffin committed Feb 3, 2021
1 parent 6f3e004 commit f2fca00
Showing 1 changed file with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,26 @@ def name(self):
' [ Linked ]' if self.linked else ''
)


cmodels = []
# grab collab caches
for cc in bim360.get_collab_caches():
# add models
cmodels.extend(
[CacheModelItem(x) for x in cc.cache_models]
)
# and linked models
cmodels.extend(
[CacheModelItem(x, linked=True) for x in cc.cache_linked_models]
)

# ask user for which model to delete
selected_cmodels = forms.SelectFromList.show(cmodels, multiselect=True)
if selected_cmodels:
# delete each selected cache
for cm in selected_cmodels:
logger.info('Deleting %s', cm)
bim360.clear_model_cache(cm)
try:
cmodels = []
# grab collab caches
for cc in bim360.get_collab_caches():
# add models
cmodels.extend(
[CacheModelItem(x) for x in cc.cache_models]
)
# and linked models
cmodels.extend(
[CacheModelItem(x, linked=True) for x in cc.cache_linked_models]
)

# ask user for which model to delete
selected_cmodels = forms.SelectFromList.show(cmodels, multiselect=True)
if selected_cmodels:
# delete each selected cache
for cm in selected_cmodels:
logger.info('Deleting %s', cm)
bim360.clear_model_cache(cm)

except:
nomodels = forms.alert('No Collaboration Cache for this version of Revit', title='pyRevit - Wipe Collaboration Cache', ok=True, cancel=False)

0 comments on commit f2fca00

Please sign in to comment.