代码:
Option Explicit
Const TRAININGDIR As String = _
"D:\Application Data\SolidWorks\文章\TRN_CDT2315_API2023\SOLIDWORKS Training Files\API Fundamentals"
Const TEMPLATEDIR As String = _
"C:\ProgramData\SolidWorks\SOLIDWORKS 2022\templates\"
Const TEMPLATENAME As String = _
TEMPLATEDIR & "gb_a1.drwdot"
Dim errors As Long
Dim warnings As Long
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim retval As Boolean
Dim swView As SldWorks.View
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swApp.NewDocument(TEMPLATENAME, _
swDwgPaperA1size, 0#, 0#)
'swDraw.EditTemplate
swDraw.EditSheet
retval = swDraw.Create3rdAngleViews2(swModel.GetPathName)
Dim RebuildSuccess As Boolean
RebuildSuccess = swDraw.ForceRebuild3(True) 'ModelDoc2.ForceRebuild3
End Sub
标签:Dim,Const,swApp,swDraw,solidworks,工程图,SldWorks,swModel
From: https://www.cnblogs.com/cuishengli/p/17427888.html