I opened a journal and I found these
what my code does is removing created elements if there is a clash and create new elements with no clash
journal snippet (Don't know the issue of errors in red)
6:< REGEN_DOC_CONTEXT_INFO: Attempt to modify wrong element during regeneration
' 6:< REGEN_DOC_CONTEXT_INFO: Document is changed in regeneration while it is not supposed to
' 4:< DBG_INFO: 5 regen passes: line 7728 of d:\ship\2019_px64\source\revit\revitdb\regen\ADocumentRegen.cpp.
' 2:< DBG_INFO: When constructing ElementRecord, elem 20252 not found: line 35 of d:\ship\2019_px64\source\revit\revitdb\elemtable\ElementRecord.cpp.
' 6:< ::68:: Delta VM: Avail +14 -> 134211062 MB, Used +1 -> 633 MB; RAM: Avail -13 -> 3483 MB, Used +3 -> 881 MB, Peak +3 -> 883 MB
' 6:< GUI Resource Usage GDI: Avail 9161, Used 839, User: Used 487
' 71.592764!!! 2:!!!BIG_GAP EndOrAbortUndoTransaction();DOPT;
' 4:< ::68:: Delta VM: Avail 134211062 MB, Used 633 MB; RAM: Avail -51 -> 3432 MB, Used +3 -> 884 MB, Peak +1 -> 884 MB
' 4:< GUI Resource Usage GDI: Avail 9162, Used 838, User: Used 487
' 32.425605!!! 2:!!!BIG_GAP EndOrAbortUndoTransaction();DOPT;
' 6:< FaultyAtomsCheckLog - Comparasion difference found :
' 9:< MODIFICATION IS FORBIDDEN: Element modification is forbidden because it is a member of a family, and that family is not being edited.
is there any other way to achieve my goal? and i can not use DocumentChanged event as i will not be able to make transaction in it.