Tuesday, April 18, 2006
ABS Macros
Following is a list of ABS keyboard macros I have compiled in the course of working with the software. Many CAD operators prefer keyboarding over menus, toolbars or palettes for frequently used commands.
;====================================================================
; ABS Macros - April 12, 2006
;====================================================================
; utility functions
(defun GetAECBVars ( / data )
; query ABS system variables - thanks to R. Robert Bell
(vl-Catch-All-Apply
(function
(lambda ()
(setq data (entget (cdr (assoc 350
(member '(3 . "AEC_VARS_BUILDING_SYSTEMS")
(dictsearch (namedobjdict) "AEC_VARS"))))))))) ; retrieve data
data) ; return data, if any
(defun IsShowDisconnectOn ()
; status disconnect markers
(= 1 (cdr (assoc 65 (GetAECBVars)))))
(defun IsShowFlowOn ()
; status flow arrows
(= 16384 (logand 16384 (cdr (assoc 99 (GetAECBVars))))))
(defun IsShowCollisionOn ()
; status collision detection
(= 1 (cdr (assoc 71 (GetAECBVars)))))
;--------------------------------------------------
; keyboard macros
(defun c:ads () ; Aec Drawing Setup
(command "aecdwgsetup")(princ))
(defun c:da ( / i ) ; Duct Add
(setq i (getvar "osmode"))
(if (and (<> i 0))(setvar "osmode" (+ i 16384)))
(command "_AecbDuctAdd")(princ))
(defun c:d1 ( / i ) ; Duct 1-line
(setq i (getvar "osmode"))
(if (and (<> i 0))(setvar "osmode" (+ i 16384)))
(command "_AecbDuctAdd" "sh" "u")(princ))
(defun c:dl () ; Duct Length
(command "DuctLength")(princ))
(defun c:dm () ; Duct Modify
(command "DuctModify")(princ))
(defun c:dp () ; Duct Properties
(command "DuctProps")(princ))
(defun c:df () ; Duct preFerences
(command "_AecbDuctPreferences")(princ))
(defun c:dfa () ; Duct Fitting Add
(command "_AecbDuctFittingAdd")(princ))
(defun c:dfm () ; Duct Fitting Modify
(command "DuctFittingModify")(princ))
(defun c:dfp () ; Duct Fitting Properties
(command "DuctFittingProps")(princ))
(defun c:dgr () ; aec Display manaGeR
(command "_AecDisplayManager")(princ))
(defun c:fda ( / i ) ; Flex Duct Add
(setq i (getvar "osmode"))
(if (and (<> i 0))(setvar "osmode" (+ i 16384)))
(command "_AecbDuctFlexAdd")(princ))
(defun c:fdm () ; Flex Duct Modify
(command "DuctFlexModify")(princ))
(defun c:fdp () ; Flex Duct Properties
(command "DuctFlexProps")(princ))
(defun c:gcd () ; toGgle Collision Detection
(command "_AecbCollisionDetection")(princ))
(defun c:gdm () ; toGgle Disconnect Markers
(command "_AecbDisConnectMarkers")(princ))
(defun c:gel () ; toGgle Elevation Lock
(if (= 0 (getvar "osnapz"))(setvar "osnapz" 1)(setvar "osnapz" 0))(princ))
(defun c:gsf () ; toGgle Show Flow
(command "_AecbShowFlow")(princ))
(defun c:gtp () ; toGgle Tool Palettes
(command ".undo" "g")
(if (= 0 (getvar "tpstate"))(command "_ToolPalettes")
(command "_ToolPalettesClose"))(princ))
(defun c:iat () ; Insert Air Terminal
(command "_MvPartAdd" "t" "Air Terminal")(princ))
(defun c:isn () ; Isolate Objects oN
(command "_AecIsolateObjects")(princ))
(defun c:isf () ; Isolate Objects ofF
(command "_AecUnIsolateObjects")(princ))
(defun c:lca () ; Label Curve Add
(command "LabelCurveAdd")(princ))
(defun c:lcm () ; Label Curve Modify
(command "LabelCurveModify")(princ))
(defun c:lcr () ; Label Curve Rotate
(command "LabelCurveRotateNode")(princ))
(defun c:mvpa () ; MVPart Add
(command "mvpartadd")(princ))
(defun c:mvpc () ; MVPart Convert
(command "_aecbmvpartconvert")(princ))
(defun c:mvpm () ; MVPart Modify
(command "MvPartModify")(princ))
(defun c:mvpp () ; MVPart Properties
(command "MvPartProps")(princ))
(defun c:mvpr () ; MVPart Regenerate
(command "_AecbCatalogRegen" "m")(princ))
(defun c:mvps () ; MVPart Style
(command "MvPartStyleEdit")(princ))
(defun c:mvpt () ; MVPart Test
(command "_AecbCatalogTest" "m")(princ))
(defun c:pa () ; Pipe Add
(setq i (getvar "osmode"))
(if (and (<> i 0))(setvar "osmode" (+ i 16384)))
(command "_AecbPipeAdd")(princ))
(defun c:pb () ; Project Browser
(command "_AecProjectBrowser")(princ))
(defun c:pm () ; Pipe Modify
(command "PipeModify")(princ))
(defun c:pn () ; Project Navigator
(command "_AecProjectNavigator")(princ))
(defun c:pl () ; Pipe Length
(command "PipeLength")(princ))
(defun c:pp () ; Pipe Properties
(command "PipeProps")(princ))
(defun c:pf () ; Pipe preFerences
(command "_AecbPipePreferences")(princ))
(defun c:pfa () ; Pipe Fitting Add
(command "_AecbPipeFittingAdd")(princ))
(defun c:pfm () ; Pipe Fitting Modify
(command "PipeFittingModify")(princ))
(defun c:pfp () ; Pipe Fitting Properties
(command "PipeFittingProps")(princ))
(defun c:pga(); PurGe All including aec objects
(command "-purge" "a" "*" "n")
(if (eq "16" (substr (getvar "acadver") 1 2))
(command "_AecbBldSysPurge"))(princ))
(defun c:rgh () ; ReGenerate Haloed lines
(command "_AecObjRelUpdate")(princ))
(defun c:rgm () ; ReGen Model space haloed lines
(setq cmdstr (strcat "sendkeys(" (chr 34) "model~_AecObjRelUpdate~~" (chr 34)")"))
(command "_vbastmt" cmdstr)(princ))
(defun c:sfd () ; Set Flow Direction
(command "SetFlow")(princ))
(defun c:sgr () ; aec Style manaGeR
(command "_AecStyleManager")(princ))
(defun c:xp2000 () ; eXPort to autocad 2000
(command ".model" "_AecExportToAutoCAD2000")(princ))
(defun c:xp2004 () ; eXPort to autocad 2004
(command ".model" "_AecExportToAutoCAD2004")(princ))
- This also provides a convenient backup for the code, accessible anytime anywhere. From time to time I will update it with recent revisions, noted by a date stamp at top of the list.
- Also of note, I have endeavored to make the code generic, either removing functions which included function references, or substituting code for a function reference where it was simple to do so.
;====================================================================
; ABS Macros - April 12, 2006
;====================================================================
; utility functions
(defun GetAECBVars ( / data )
; query ABS system variables - thanks to R. Robert Bell
(vl-Catch-All-Apply
(function
(lambda ()
(setq data (entget (cdr (assoc 350
(member '(3 . "AEC_VARS_BUILDING_SYSTEMS")
(dictsearch (namedobjdict) "AEC_VARS"))))))))) ; retrieve data
data) ; return data, if any
(defun IsShowDisconnectOn ()
; status disconnect markers
(= 1 (cdr (assoc 65 (GetAECBVars)))))
(defun IsShowFlowOn ()
; status flow arrows
(= 16384 (logand 16384 (cdr (assoc 99 (GetAECBVars))))))
(defun IsShowCollisionOn ()
; status collision detection
(= 1 (cdr (assoc 71 (GetAECBVars)))))
;--------------------------------------------------
; keyboard macros
(defun c:ads () ; Aec Drawing Setup
(command "aecdwgsetup")(princ))
(defun c:da ( / i ) ; Duct Add
(setq i (getvar "osmode"))
(if (and (<> i 0))(setvar "osmode" (+ i 16384)))
(command "_AecbDuctAdd")(princ))
(defun c:d1 ( / i ) ; Duct 1-line
(setq i (getvar "osmode"))
(if (and (<> i 0))(setvar "osmode" (+ i 16384)))
(command "_AecbDuctAdd" "sh" "u")(princ))
(defun c:dl () ; Duct Length
(command "DuctLength")(princ))
(defun c:dm () ; Duct Modify
(command "DuctModify")(princ))
(defun c:dp () ; Duct Properties
(command "DuctProps")(princ))
(defun c:df () ; Duct preFerences
(command "_AecbDuctPreferences")(princ))
(defun c:dfa () ; Duct Fitting Add
(command "_AecbDuctFittingAdd")(princ))
(defun c:dfm () ; Duct Fitting Modify
(command "DuctFittingModify")(princ))
(defun c:dfp () ; Duct Fitting Properties
(command "DuctFittingProps")(princ))
(defun c:dgr () ; aec Display manaGeR
(command "_AecDisplayManager")(princ))
(defun c:fda ( / i ) ; Flex Duct Add
(setq i (getvar "osmode"))
(if (and (<> i 0))(setvar "osmode" (+ i 16384)))
(command "_AecbDuctFlexAdd")(princ))
(defun c:fdm () ; Flex Duct Modify
(command "DuctFlexModify")(princ))
(defun c:fdp () ; Flex Duct Properties
(command "DuctFlexProps")(princ))
(defun c:gcd () ; toGgle Collision Detection
(command "_AecbCollisionDetection")(princ))
(defun c:gdm () ; toGgle Disconnect Markers
(command "_AecbDisConnectMarkers")(princ))
(defun c:gel () ; toGgle Elevation Lock
(if (= 0 (getvar "osnapz"))(setvar "osnapz" 1)(setvar "osnapz" 0))(princ))
(defun c:gsf () ; toGgle Show Flow
(command "_AecbShowFlow")(princ))
(defun c:gtp () ; toGgle Tool Palettes
(command ".undo" "g")
(if (= 0 (getvar "tpstate"))(command "_ToolPalettes")
(command "_ToolPalettesClose"))(princ))
(defun c:iat () ; Insert Air Terminal
(command "_MvPartAdd" "t" "Air Terminal")(princ))
(defun c:isn () ; Isolate Objects oN
(command "_AecIsolateObjects")(princ))
(defun c:isf () ; Isolate Objects ofF
(command "_AecUnIsolateObjects")(princ))
(defun c:lca () ; Label Curve Add
(command "LabelCurveAdd")(princ))
(defun c:lcm () ; Label Curve Modify
(command "LabelCurveModify")(princ))
(defun c:lcr () ; Label Curve Rotate
(command "LabelCurveRotateNode")(princ))
(defun c:mvpa () ; MVPart Add
(command "mvpartadd")(princ))
(defun c:mvpc () ; MVPart Convert
(command "_aecbmvpartconvert")(princ))
(defun c:mvpm () ; MVPart Modify
(command "MvPartModify")(princ))
(defun c:mvpp () ; MVPart Properties
(command "MvPartProps")(princ))
(defun c:mvpr () ; MVPart Regenerate
(command "_AecbCatalogRegen" "m")(princ))
(defun c:mvps () ; MVPart Style
(command "MvPartStyleEdit")(princ))
(defun c:mvpt () ; MVPart Test
(command "_AecbCatalogTest" "m")(princ))
(defun c:pa () ; Pipe Add
(setq i (getvar "osmode"))
(if (and (<> i 0))(setvar "osmode" (+ i 16384)))
(command "_AecbPipeAdd")(princ))
(defun c:pb () ; Project Browser
(command "_AecProjectBrowser")(princ))
(defun c:pm () ; Pipe Modify
(command "PipeModify")(princ))
(defun c:pn () ; Project Navigator
(command "_AecProjectNavigator")(princ))
(defun c:pl () ; Pipe Length
(command "PipeLength")(princ))
(defun c:pp () ; Pipe Properties
(command "PipeProps")(princ))
(defun c:pf () ; Pipe preFerences
(command "_AecbPipePreferences")(princ))
(defun c:pfa () ; Pipe Fitting Add
(command "_AecbPipeFittingAdd")(princ))
(defun c:pfm () ; Pipe Fitting Modify
(command "PipeFittingModify")(princ))
(defun c:pfp () ; Pipe Fitting Properties
(command "PipeFittingProps")(princ))
(defun c:pga(); PurGe All including aec objects
(command "-purge" "a" "*" "n")
(if (eq "16" (substr (getvar "acadver") 1 2))
(command "_AecbBldSysPurge"))(princ))
(defun c:rgh () ; ReGenerate Haloed lines
(command "_AecObjRelUpdate")(princ))
(defun c:rgm () ; ReGen Model space haloed lines
(setq cmdstr (strcat "sendkeys(" (chr 34) "model~_AecObjRelUpdate~~" (chr 34)")"))
(command "_vbastmt" cmdstr)(princ))
(defun c:sfd () ; Set Flow Direction
(command "SetFlow")(princ))
(defun c:sgr () ; aec Style manaGeR
(command "_AecStyleManager")(princ))
(defun c:xp2000 () ; eXPort to autocad 2000
(command ".model" "_AecExportToAutoCAD2000")(princ))
(defun c:xp2004 () ; eXPort to autocad 2004
(command ".model" "_AecExportToAutoCAD2004")(princ))