Hi,
I am trying to create a macro, that will switch the configuration of the drawing views in to my appointed name.
I tried to record macro and run it, but looks like it didn’t work. The configuration stays the same as it is before.
Anyone have any solution for this?
Thanks for your help
Attached is the macro I recorded.
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
boolstatus = Part.ActivateSheet("Sheet1")
boolstatus = Part.ActivateView("Drawing View1")
boolstatus = Part.Extension.SelectByID2("Drawing View1", "DRAWINGVIEW", 0.129656022558782, 0.17639323452528, 0, False, 0, Nothing, 0)
boolstatus = Part.ChangeRefConfigurationOfFlatPatternView("P:\Data\Engineering\SOLIDWORKS\AM00X-00101 BIFOLD DOOR\AM00X-00101G01.SLDASM", "CLOSED-OFFSET BIFOLD")
Part.ViewZoomtofit2
Part.ClearSelection2 True
boolstatus = Part.ActivateSheet("Sheet2")
boolstatus = Part.ActivateView("Drawing View2")
boolstatus = Part.Extension.SelectByID2("", "EDGE", 0.108617334865133, 0.253403458635116, -24500.0945, False, 0, Nothing, 0)
boolstatus = Part.ChangeRefConfigurationOfFlatPatternView("P:\Data\Engineering\SOLIDWORKS\AM00X-00101 BIFOLD DOOR\AM00X-00101G01.SLDASM", "CLOSED-OFFSET BIFOLD")
boolstatus = Part.ActivateView("Drawing View3")
boolstatus = Part.Extension.SelectByID2("Drawing View3", "DRAWINGVIEW", 0.29879326549845, 0.232182110323512, 0, False, 0, Nothing, 0)
boolstatus = Part.ChangeRefConfigurationOfFlatPatternView("P:\Data\Engineering\SOLIDWORKS\AM00X-00101 BIFOLD DOOR\AM00X-00101G01.SLDASM", "OPENED-OFFSET BIFOLD")
Part.ViewZoomtofit2
Part.ClearSelection2 True
boolstatus = Part.ActivateSheet("Sheet3")
boolstatus = Part.ActivateView("Drawing View4")
boolstatus = Part.Extension.SelectByID2("Drawing View4", "DRAWINGVIEW", 0.128318370555632, 0.168032909505594, 0, False, 0, Nothing, 0)
boolstatus = Part.ChangeRefConfigurationOfFlatPatternView("P:\Data\Engineering\SOLIDWORKS\AM00X-00101 BIFOLD DOOR\AM00X-00101G01.SLDASM", "CLOSED-OFFSET BIFOLD")
End Sub