可以通过VBA实现,参考程序:
'获取图幅大小函数
'无输入参数
'返回图幅枚举代码,1-14
Public Function papersize()
Dim swApp As SldWorks.SldWorks
Dim swDraw As SldWorks.DrawingDoc
Dim swSheet As SldWorks.Sheet
Dim vSheetProps As Variant
Dim bFirstAng As Boolean
Dim bRet As Boolean
Set swApp = Application.SldWorks
Set swDraw = swApp.ActiveDoc
Set swSheet = swDraw.GetCurrentSheet
' Get current sheet properties
vSheetProps = swSheet.GetProperties
' Current sheet properties
'
' Debug.Print "Name = " + swSheet.GetName
' Debug.Print " TemplateName = " & swSheet.GetTemplateName
' Debug.Print " PaperSize = " & vSheetProps(0)
' Debug.Print " TemplateIn = " & vSheetProps(1)
' Debug.Print " Scale1 = " & vSheetProps(2)
' Debug.Print " scale2 = " & vSheetProps(3)
' Debug.Print " FirstAngle = " & vSheetProps(4)
' Debug.Print " Width = " & vSheetProps(5)
' Debug.Print " Height = " & vSheetProps(6)
'
' Switch projection property
'切换第一视角 - true/第三视角 - false
'注意:该视角切换不会更新已经定义的视角显示方式!!!!
' bFirstAng = vSheetProps(4)
' vSheetProps(4) = Not bFirstAng
' Apply updated sheet properties
swSheet.SetProperties _
vSheetProps(0), _
vSheetProps(1), _
vSheetProps(2), _
vSheetProps(3), _
vSheetProps(4), _
vSheetProps(5), _
vSheetProps(6)
' 当前项目属性集合
'Debug.Print " New FirstAngle setting = " & vSheetProps(0)
'函数返回值
papersize = vSheetProps(0)
End Function |