Set View Scale Opposite Parent View Scale Example (VBA)
This example shows how to set the selected drawing view's scale opposite
the parent's drawing view's scale.
'-----------------------------------------------
'
' Preconditions: Drawing document is open and a drawing
view is selected.
'
' Postconditions: Selected drawing view's scale is set
opposite parent's drawing's
' view
scale.
'
'-----------------------------------------------
Option Explicit
Sub main()
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swSelMgr As
SldWorks.SelectionMgr
Dim
swDraw As
SldWorks.DrawingDoc
Dim
swView As
SldWorks.View
Dim
bRet As
Boolean
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
Set
swDraw = swModel
Set
swSelMgr = swModel.SelectionManager
Set
swView = swSelMgr.GetSelectedObject5(1)
Debug.Print
"File = " & swModel.GetPathName
Debug.Print
" View
= " & swView.Name
Debug.Print
" UseParentScale
= " & CBool(swView.UseParentScale)
'
Toggle
If
swView.UseParentScale Then
swView.UseParentScale = False
Else
swView.UseParentScale = True
End
If
'
Rebuild to see new scale
bRet
= swModel.EditRebuild3: Debug.Assert
bRet
End Sub
'-----------------------------