Message 1 of 2

Not applicable
10-26-2017
02:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm using PyRevit to create an add-in using Python.
The add-in is creating a new Drafting view in the active document and copying groups into that drafting view from an open document.
At some point during the process, I am getting the following error:
I've tried using the IFailuresPreprocessor interface as such:
class failureProcess(IFailuresPreprocessor): def PreprocessFailures(self, failuresAccessor): fail_acc_list = failuresAccessor.GetFailureMessages().GetEnumerator() for failure in fail_acc_list: print(failure.GetDescriptionText()) failId = failure.GetFailureDefinitionId() failType2 = failure.GetType() failType = BuiltInFailures.GroupFailures.AtomTouchedNotAllowedDelete if failId == failType: failuresAccessor.ResolveFailure(failure) else: failuresAccessor.DeleteWarning(failure) return FailureProcessingResult.ProceedWithCommit
And I am calling this out as such:
t1 = Transaction(doc, "Create Drafting View") t1.Start() failOptions = t1.GetFailureHandlingOptions() failOptions.SetFailuresPreprocessor(failureProcess()) t1.SetFailureHandlingOptions(failOptions) draftView = ViewDrafting.Create(doc, viewType[0]) c = [] for x, v in enumerate(view1): try: z = elemId[x] e = List[ElementId]() e.Add(z) c.append(ElementTransformUtils.CopyElements(v, e, draftView, None, copyOptions)) except Exception as e: print(e) t1.Commit()
This does suppress the warnings, but it seems that it doesn't go through with the rest of the transaction which is the Creating the Drafting View and Copying the Groups.
Any ideas?
Solved! Go to Solution.