AnsweredAssumed Answered

How to move view position with API

Question asked by Yong Ning on Oct 11, 2016
Latest reply on Apr 23, 2018 by Cuinn Herrick

0.jpg

Record MACRO, don't move view??

' ******************************************************************************

' C:\Users\ADMINI~1\AppData\Local\Temp\swx1700\Macro1.swb - macro recorded on 10/12/16 by Administrator

' ******************************************************************************

Dim SwApp As Object

Dim Part As Object

Dim SelMgr As Object

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long

Dim Feature As Object

Sub main()

 

 

Set SwApp = Application.SldWorks

 

 

Set Part = SwApp.ActiveDoc

Set SelMgr = Part.SelectionManager

boolstatus = Part.ActivateView("Drawing View1")

boolstatus = Part.Extension.SelectByID2("Drawing View1", "DRAWINGVIEW", -0.08152817060098, 0.1672106486486, 0, False, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("Drawing View1", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)

End Sub

 

 

***********************************************************

 

''

Private Sub ll5()

    Dim swApp As SldWorks.SldWorks, swModel As ModelDoc2

         Set swApp = Application.SldWorks

         Set swModel = swApp.ActiveDoc

    Dim swDraw As DrawingDoc

         Set swDraw = swModel

    Dim SwSheet As Sheet

         Set SwSheet = swDraw.GetCurrentSheet

    Dim SwSelMgr As SelectionMgr

         Set SwSelMgr = swModel.SelectionManager

    Dim swView As View

         Set swView = SwSelMgr.GetSelectedObject5(1)

        

    Dim Var, vPts, oScale

        swView.AlignWithView swNoViewAlignment, Nothing

        vPts = swView.GetXform

        vPts(0) = 0

        vPts(1) = 0

        swView.SetXform vPts

       

End Sub

Attachments

Outcomes