Dear Phat Tran,
Thank you for your patience.
The development team has made some progress and shared some interesting observations on the current implementation:
The script collects all elements in the document. It filters out a few kinds of elements, like element types, and elements without geometry. However, it still grabs way too much. In the selection that will be mirrored fall specialised elements like ExtentElem and LegendComponent. In general, I think such an approach of collecting all elements in the document and trying to do something with them is dangerous and can cause unexpected issues. There is no good way to filter out specialised elements that I can see. So, we need to continue internal discussion and decide what to expose, how to know what elements to skip and how to perform the mirror.
A couple more observations:
CanMirrorElements is not enough to tell whether the elements will successfully be mirrored. A number of other internal checks are performed, and even if those checks succeed, the whole operation can still fail in the end. There is no way to tell whether mirroring will succeed without doing the actual mirroring. We could, however, improve the accuracy of this method by including more of the validations in it. This requires more internal discussion and research.
The validation which causes the issue, in this case, is a check areElementsNonViewSpecificOrFromOneView. The reason is, we try to mirror view-specific elements like SketchPlanes and others along with model elements. If this validation is skipped, the operation succeeds. I would still not recommend doing a mirror project this way, and I am concerned that this validation will prevent other much more reasonable workflows. For example, mirroring a wall and its attached tags/dimensions. This will also require more internal discussion and research.
Best regards,
Jeremy