Event Handler to toggle LTScale between MS/PS
This code should serve only as a simple boilerplate to give you a start in making an event handler that toggles LTScale when you switch from ModelSpace to a Layout. It needs to be placed in the ThisDrawing object.
It makes the assumption that the current DimScale is the scale factor you want for ModelSpace. This is a poor assumption IMHO, but you can decide how you want to store the scale factor yourself. (I might suggest a Dictionary/XRecord.)
This sample regens the active viewport, but I have only tested this in AutoCAD 2004/2005. older versions might go unstable with the regen in there, so please test well before you use in an earlier environment.
Code:
Private Sub AcadDocument_LayoutSwitched(ByVal LayoutName As String)
Dim sf As Double
With ThisDrawing
If UCase(LayoutName) <> "MODEL" Then
sf = 1#
ElseIf .GetVariable("DimScale") = 0 Then
sf = 1#
Else
sf = .GetVariable("DimScale")
End If
.SetVariable "LTScale", 0.5 * sf
.Regen acActiveViewport
End With
End Sub