26-11-2014 03:11 AM - edited 26-11-2014 03:24 AM
Hi,
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
objCompareTool.Close
14-01-2015 11:37 AM
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 colMergeObjects.item(1).delete Next
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 🙂
Regards,
Lionel
26-11-2014 12:45 PM
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)