My mistake, it was Mark who did it. His username was simply Mark and I don't remember his last name. If anyone else does, please post it so he gets the credit.Option Explicit
' Setting saver is to ensure that users have their current settings saved
' and restored when custom VBA programs are done.
Private iOSMode As Integer ' Sets the object snap mode
Private iOrthoMode As Integer ' Turns ortho mode on or off
Private iSnapMode As Integer ' Turns snap on or off
Private iAttDia As Integer ' Controls whether a dialog is shown for attribute values
Private iAUnits As Integer ' Sets units for angles
Private iBlipMode As Integer ' Turns blips on or off
Private sCEColor As String 'Sets the color of new objects
Private dCELTScale As Double 'Sets the current object linetype scaling factor
Private sCELType As String 'Sets the linetype of new objects
Private dChamferA As Double 'Sets the first chamfer distance
Private dChamferB As Double 'Sets the second chamfer distance
Private dChamferC As Double ' Sets the chamfer length
Private dChamferD As Double ' Sets the chamfer angle
Private sCLayer As String ' Sets the current layer
Private iCMDEcho As Integer ' Controls whether AutoCAD echoes prompts and input during the AutoLISP (command) function
Private iEdgeMode As Integer ' Controls how TRIM and EXTEND determine cutting and boundary edges
Private iFileDia As Integer ' Suppresses display of the file dialog boxes
Private iGridMode As Integer ' Specifies whether the grid is turned on or off
Private iHighlight As Integer ' Controls object highlighting; does not affect objects selected with grips
Private dLTScale As Double ' Sets the global linetype scale factor
Private iLUnits As Integer ' Sets linear units
Private iLUPrec As Integer ' Sets the number of decimal places displayed for linear units
Private iMenuEcho As Integer ' Sets menu echo and prompt control bits
Private iMirrText As Integer ' Controls how MIRROR reflects text
Private iPDMode As Integer ' Controls how point objects are displayed
Private iPDSize As Double ' Sets the display size for point objects
Private iProjMode As Integer ' Sets the current Projection mode for trimming or extending
Private dSnapAng As Double ' Sets snap and grid rotation angle for the current viewport
Private vSnapBase As Variant ' Sets the snap and grid origin point for the current viewport relative to the current UCS
Private iSnapISOPair As Integer ' Controls the isometric plane for the current viewport
Private iSnapStyl As Integer ' Sets snap style for the current viewport
Private vSnapUnit As Variant ' Sets the snap spacing for the current viewport
Private iUCSIcon As Integer ' Displays the UCS icon for the current viewport
Private iUnitMode As Integer ' Controls the display format for units
Private Sub SaveCADSettings()
iOSMode = ThisDrawing.GetVariable("OSMODE")
iOrthoMode = ThisDrawing.GetVariable("ORTHOMODE")
iSnapMode = ThisDrawing.GetVariable("SNAPMODE")
iAttDia = ThisDrawing.GetVariable("ATTDIA")
iAUnits = ThisDrawing.GetVariable("AUNITS")
iBlipMode = ThisDrawing.GetVariable("BLIPMODE")
sCEColor = ThisDrawing.GetVariable("CECOLOR")
dCELTScale = ThisDrawing.GetVariable("CELTSCALE")
sCELType = ThisDrawing.GetVariable("CELTYPE")
dChamferA = ThisDrawing.GetVariable("CHAMFERA")
dChamferB = ThisDrawing.GetVariable("CHAMFERB")
dChamferC = ThisDrawing.GetVariable("CHAMFERC")
dChamferD = ThisDrawing.GetVariable("CHAMFERD")
sCLayer = ThisDrawing.GetVariable("CLAYER")
iCMDEcho = ThisDrawing.GetVariable("CMDECHO")
iEdgeMode = ThisDrawing.GetVariable("EDGEMODE")
iFileDia = ThisDrawing.GetVariable("FILEDIA")
iGridMode = ThisDrawing.GetVariable("GRIDMODE")
iHighlight = ThisDrawing.GetVariable("HIGHLIGHT")
dLTScale = ThisDrawing.GetVariable("LTSCALE")
iLUnits = ThisDrawing.GetVariable("LUNITS")
iLUPrec = ThisDrawing.GetVariable("LUPREC")
iMenuEcho = ThisDrawing.GetVariable("MENUECHO")
iMirrText = ThisDrawing.GetVariable("MIRRTEXT")
iPDMode = ThisDrawing.GetVariable("PDMODE")
iPDSize = ThisDrawing.GetVariable("PDSIZE")
iProjMode = ThisDrawing.GetVariable("PROJMODE")
dSnapAng = ThisDrawing.GetVariable("SNAPANG")
vSnapBase = ThisDrawing.GetVariable("SNAPBASE")
iSnapISOPair = ThisDrawing.GetVariable("SNAPISOPAIR")
iSnapStyl = ThisDrawing.GetVariable("SNAPSTYL")
vSnapUnit = ThisDrawing.GetVariable("SNAPUNIT")
iUCSIcon = ThisDrawing.GetVariable("UCSICON")
iUnitMode = ThisDrawing.GetVariable("UNITMODE")
End Sub
Private Sub RecallCADSettings()
ThisDrawing.SetVariable "OSMODE", iOSMode
ThisDrawing.SetVariable "ORTHOMODE", iOrthoMode
ThisDrawing.SetVariable "SNAPMODE", iSnapMode
ThisDrawing.SetVariable "ATTDIA", iAttDia
ThisDrawing.SetVariable "AUNITS", iAUnits
ThisDrawing.SetVariable "BLIPMODE", iBlipMode
ThisDrawing.SetVariable "CECOLOR", sCEColor
ThisDrawing.SetVariable "CELTSCALE", dCELTScale
ThisDrawing.SetVariable "CELTYPE", sCELType
ThisDrawing.SetVariable "CHAMFERA", dChamferA
ThisDrawing.SetVariable "CHAMFERB", dChamferB
ThisDrawing.SetVariable "CHAMFERC", dChamferC
ThisDrawing.SetVariable "CHAMFERD", dChamferD
ThisDrawing.SetVariable "CLAYER", sCLayer
ThisDrawing.SetVariable "CMDECHO", iCMDEcho
ThisDrawing.SetVariable "EDGEMODE", iEdgeMode
ThisDrawing.SetVariable "FILEDIA", iFileDia
ThisDrawing.SetVariable "GRIDMODE", iGridMode
ThisDrawing.SetVariable "HIGHLIGHT", iHighlight
ThisDrawing.SetVariable "LTSCALE", dLTScale
ThisDrawing.SetVariable "LUNITS", iLUnits
ThisDrawing.SetVariable "LUPREC", iLUPrec
ThisDrawing.SetVariable "MENUECHO", iMenuEcho
ThisDrawing.SetVariable "MIRRTEXT", iMirrText
ThisDrawing.SetVariable "PDMODE", iPDMode
ThisDrawing.SetVariable "PDSIZE", iPDSize
ThisDrawing.SetVariable "PROJMODE", iProjMode
ThisDrawing.SetVariable "SNAPANG", dSnapAng
ThisDrawing.SetVariable "SNAPBASE", vSnapBase
ThisDrawing.SetVariable "SNAPISOPAIR", iSnapISOPair
ThisDrawing.SetVariable "SNAPSTYL", iSnapStyl
ThisDrawing.SetVariable "SNAPUNIT", vSnapUnit
ThisDrawing.SetVariable "UCSICON", iUCSIcon
ThisDrawing.SetVariable "UNITMODE", iUnitMode
End Sub
Private Sub Class_Initialize()
Call SaveCADSettings
End Sub
Private Sub Class_Terminate()
Call RecallCADSettings
End Sub