‹#›
© 2008 Autodesk
ADSK_BLack_BAR.png
ADN Webcasts 2008
AcadmAuto
§Sub MoveComponent()
§    ' get Mechanical application object
§    Dim acmApp As AcadmApplication
§    Set acmApp = ThisDrawing.Application.GetInterfaceObject("AcadmAuto.AcadmApplication")
§   
§    ' get the 2D structure manager object
§    Dim acmMgr As Mcad2DStructureMgr
§    Set acmMgr = acmApp.ActiveDocument.StructureMgr2D
§   
§    ' get the Mechanical utility object
§    Dim acmUtil As McadUtility
§    Set acmUtil = acmApp.ActiveDocument.Utility
§   
§    ' pick the component view we want to move
§    Dim acmPick As McadPick
§    Set acmPick = acmUtil.Pick("Pick component view to move", mcComponentView)
§   
§    ' get the component view from the pick selection
§    Dim acmCV1 As McadComponentView
§    Set acmCV1 = acmUtil.GetObjectFromPick(acmPick)
§   
§    ' get the component view where we want to move the other view
§    Dim acmCV2 As McadComponentView
§    Set acmPick = acmUtil.Pick("Pick new parent component view", mcComponentView)
§    Set acmCV2 = acmUtil.GetObjectFromPick(acmPick)
§   
§    ' create a folder that will contain the component views we want to move
§    Dim acmFs As McadFolders
§    Set acmFs = acmUtil.CreateCollection(mcFolders)
§   
§    ' add the component view we want to move
§    acmFs.Add acmCV1
§   
§    ' move the component views
§    acmMgr.RestructureViews acmFs, acmCV2
§End Sub