Suppressing "Changes to Groups are only allowed during Edit Group Mode"

Suppressing "Changes to Groups are only allowed during Edit Group Mode"

Anonymous
Not applicable
1,296 Views
1 Reply
Message 1 of 2

Suppressing "Changes to Groups are only allowed during Edit Group Mode"

Anonymous
Not applicable

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:

 

Error.PNG

 

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?

0 Likes
Accepted solutions (1)
1,297 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

I literally spent an hour trying to find a solution to this in every possible way, and finally stumbled on this:

 

http://thebuildingcoder.typepad.com/blog/2016/09/warning-swallower-and-roomedit3d-viewer-extension.h...

 

Here is the updated code:

 

class failureProcess(IFailuresPreprocessor):
    def PreprocessFailures(self, failuresAccessor):
        fail_acc_list = failuresAccessor.GetFailureMessages().GetEnumerator()
        for failure in fail_acc_list:
			fSeverity = failuresAccessor.GetSeverity()
			if fSeverity == fSeverity.Warning:
				failuresAccessor.DeleteWarning(failure)
			else:
				failuresAccessor.ResolveFailure(failure)
				return FailureProcessingResult.ProceedWithCommit
			
        return FailureProcessingResult.Continue
0 Likes