Showing results for 
Show  only  | Search instead for 
Did you mean: 

Disable "Include Object of Merging" in a Macro to perform Compare & Align


Disable "Include Object of Merging" in a Macro to perform Compare & Align



I want to write a macro to perform Compare & Align. However, "Include Object of Merging" is always enabled by default, which makes execution time horrible. Is there any way I can disable "Include Object of Merging" in the macro?


 Below are a sample of code to perform Compare and Align in Mega. Is there an API documentation on this API? Thanks!


Set objCompareTool = mgRoot.OpenCompareTool(g_objJobGlobals.m_strTargetRepositoryMegaField)
      If TypeName(objCompareTool) <> "Nothing" Then
        Dim oSourceRootObjectsColl
        Set oSourceRootObjectsColl = mgRoot.GetSelection("")
        If (Not(oSourceRootObjectsColl is nothing)) Then
          oSourceRootObjectsColl.Add mgobjTransferedObject

          g_objJobGlobals.m_strAlignCommandsFileName = GetAlignCommandsFileName(mgRoot)

          objCompareTool.Perimeter = g_objJobGlobals.m_strTransferPerimeterMegaField

          objCompareTool.CompareObjects oSourceRootObjectsColl

          objCompareTool.GenerateOutput g_objJobGlobals.m_strAlignCommandsFileName, "MGR"
        End If
      End If

2 Replies

Re: Disable "Include Object of Merging" in a Macro to perform Compare & Align

Hello Linhbui


Atttention: if the merge feature is used, maintaining the consistency of certain diagram requires to include merge objects in the scope. Otherwse issue can occur, especially with diagram drawings.


Cases have been reported to MEGA technical support of partial inconistency of diagram drawing after object compare and object merge.

The direct cause was that, when opening the target diagram, merge object where not available. The diagram tool did not have the information to position objects merged in the drawing (technical step run when opening a diagram).

This has led to a fix to add merge data in the scope of compare and align (CR 42103 Unexpected diagram drawing after merge then compare and align)


Re: Disable "Include Object of Merging" in a Macro to perform Compare & Align

Hello Linhbui,


As Jérôme said, objects of merging (i.e. _TransferredObject) are usefull as they memorise the position of the deleted object in diagrams.

But these _TransferredObject become useless once the diagram has been re-opened because then, the position of the object is memorised in the "standard" way.


If you are sure that all your diagrams has been "re-opened" since your last merge, than you can simply delete (at your own risk...) all the _TransferredObject in your repository, which will solve your perf problem :-)


To do so you can use this script :


Set colMergeObjects = getCollection("~b20000000M20[_TransferredObject]")
For i = 1 to colMergeObjects.Count


Remember : use it at your own risk : if diagrams containing a merge object have not been re-opened since the merging, you might encounter issues :-)