Public intSnapSetting As Integer
Public SettingChanged As Boolean
Sub Change_Snaps()
'Sets running Object Snap modes to whatever you choose,
'then back to the original setting.
'-----------------From the HELP file--------------------------------------
'Bitcodes for Object Snap Modes:
' 0 NONe
' 1 ENDpoint
' 2 MIDpoint
' 4 CENter
' 8 NODe
' 16 QUAdrant
' 32 INTersection
' 64 INSertion
' 128 PERpendicular
' 256 TANgent
' 512 NEArest
' 1024 QUIck
' 2048 APParent Intersection
' 4096 EXTension
' 8192 PARallel
'
'To specify more than one object snap, enter the sum of their values.
'To find out the current bitcode combination you have, simply enter OSMODE
'and the number will be inside < >
'-------------------------------------------------------------------------
If SettingChanged = False Then
intSnapSetting = ThisDrawing.GetVariable("OSMODE")
SettingChanged = True
End If
If ThisDrawing.GetVariable("OSMODE") = 4 Then
'Returns object snap mode to previous state and resets the boolean value
ThisDrawing.SetVariable "OSMODE", intSnapSetting
SettingChanged = False
AutoCAD.Application.ActiveDocument.Utility.Prompt vbCrLf & "Snaps Restored"
Else
ThisDrawing.SetVariable "OSMODE", 4 'Sets the Object Snap mode to CENter
AutoCAD.Application.ActiveDocument.Utility.Prompt vbCrLf & "Snap set to Center"
End If
End Sub
AutoCAD | Temporarily change the running object snap mode |
| ||
Ease of Use | Intermediate | |||
Version tested with | 2004, 2005 | |||
Submitted by: | ||||
Description: | Stores the Object Snaps you have running at Run-Time and resets the Object Snap mode to specific settings. Once the code is run again, the original settings are restored. | |||
Discussion: | At my job, I design pools. And when I dimension the pool I like to use the Center object snap and everything else off. I usually have a lot more snaps running than just Center, so it becomes tedious to keep checking on/off the same check boxes everytime I dimension a pool. So I made this code as sort of a "switch" for when I dimension pools, specifically. But you can set it to whatever you prefer, just follow the code. | |||
Code: |
沒有留言:
張貼留言