Here is our Master LISP command;
(defun c:s1 ( / ss1 e1)
;;Transfers elements from layer bgspa_floor_area_b to A-FLOR-FTPT
;;Transfers elements from layer bgspa_space_area_b to A-FLOR-PERI
;;Transfers elements from layer bgspa_space_area_c to A-AREA-IDEN
;;Changes text to color white By Layer
;;Places a line spacing value of 1 between Multiline Text
;;Zoom Extents the building to fill the screen
(defun ECHG (ent fld val)
(setq ent (subst (cons fld val) (assoc fld ent) ent))
(entmod ent)
)
(command "zoom" "e")
(setq ss1 (ssget "X" (list (cons 8 "bgspa_space_area_b"))))
(command "chprop" ss1 "" "la" "A-FLOR-PERI" "c" "bylayer" "")
(setq ss1 (ssget "X" (list (cons 8 "bgspa_floor_area_b"))))
(command "chprop" ss1 "" "la" "A-FLOR-FTPT" "c" "bylayer" "")
(setq ss1 (ssget "X" (list (cons 8 "bgspa_space_area_c"))))
(command "chprop" ss1 "" "la" "A-AREA-IDEN" "c" "bylayer" "")
(setq ss1 (ssget "X" (list (cons 0 "MTEXT")(cons 8 "A-AREA-IDEN"))))
(command "_.justifytext" ss1 "" "_MC")
(setq C 0)
(progn
(repeat (sslength ss1)
(setq e1 (entget (ssname ss1 C)))
(setq e1 (echg e1 40 12))
(setq e1 (echg e1 44 0.9))
(setq e1 (echg e1 7 "Arial"))
(setq e1 (echg e1 1 (vl-string-subst "sf" "sq ft" (cdr (assoc 1 e1)))))
(setq C (+ C 1))
)
)
(command "_.textstyle" "Arial")
)
(defun c:Slab ( / ss1 e1)
;;This changes the text style of A-ANNO-TEXT which is the sheet label text to arial with a middle left justification
(defun ECHG (ent fld val)
(setq ent (subst (cons fld val) (assoc fld ent) ent))
(entmod ent)
)
(setq ss1 (ssget "X" (list (cons 0 "MTEXT")(cons 8 "A-ANNO-TEXT"))))
(command "_.justifytext" ss1 "" "_ML")
(setq C 0)
(progn
(repeat (sslength ss1)
(setq e1 (entget (ssname ss1 C)))
(setq e1 (echg e1 40 12))
(setq e1 (echg e1 44 0.9))
(setq e1 (echg e1 7 "Arial"))
(setq C (+ C 1))
)
)
(command "_.textstyle" "Arial")
)
(defun c:DimUPD (/ *error* ocm lays ss)
;;This is used when the template file contains the dim style PRISMS_AEC CAD Standard, it updates properties to Bylayer.
;;Used to set UCS based on an object, in this case we will use the sheet label
;;this also updates all dimensions to the current UCS, once dimensions are set to current UCS, reset UCS back to view
(defun *error* (msg)
(if ocm (setvar "CMDECHO" ocm))
(if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
(princ (strcat "\n<< Error: " msg " >>")))
(princ))
(setq ocm (getvar "CMDECHO")
lays (vla-get-layers
(vla-get-ActiveDocument
(vlax-get-acad-object))))
(setvar "CMDECHO" 0)
(or (tblsearch "LAYER" "A-ANNO-DIMS")
(vla-put-color
(vla-add lays "A-ANNO-DIMS") 2))
(if (and (tblsearch "DIMSTYLE" "PRISMS_AEC CAD Standard")
;(if (and (tblsearch "DIMSTYLE" "AEC CAD Standard R5")
(setq ss (ssget "_X" '((0 . "LEADER,DIMENSION")))))
(progn
;(command "-dimstyle" "_R" "AEC CAD Standard R5")
(command "-dimstyle" "_R" "PRISMS_AEC CAD Standard")
(command "_.chprop" ss "" "_LA" "A-ANNO-DIMS" "")
(command "_.chprop" ss "" "C" "BYLAYER" "")
(command "-dimstyle" "_A" ss ""))
(princ "\n<< No Dimensions Found, or Dimstyle Doesn't Exist >>"))
(setvar "CMDECHO" ocm)
(command "_.ucs" "_OB" PAUSE)
;; removed, auto-select(prompt "\nSelect dimensions to set to current UCS: ")
(if (and (setq ss (ssget "_X" '((0 . "DIMENSION"))))
(> (setq n (sslength ss)) 0)
) ;_ end of and
(repeat n
(setq en (ssname ss (setq n (1- n))) ;Get the nth entity and decrement the counter
ed (entget en) ;Get the DXF data
) ;_ end of setq
(setq ucs (- 0 (angle '(0.0 0.0 0.0) (getvar "UCSXDIR")))) ;Get the current UCS's X-axis direction
(setq ed (subst (cons 51 ucs) (assoc 51 ed) ed)) ;Modify the data
(entmod ed) ;Modify the entity
) ;_ end of repeat
) ;_ end of if
(command "ucs" "previous")
(princ)
)
(DEFUN C:STT()
;;DEFINE A FUNCTION NAMED "STT"
(SETQ TARGENT (CAR (ENTSEL "\NSELECT OBJECT ON LAYRER TO SELECT: ")))
;;PROMPT USER TO SELECT OBJECT, ENTSEL STORESPICK PINT & ENTITY NAME
(SETQ TARGLAYER (ASSOC 8 (ENTGET TARGENT)))
;;EXTRACT LAYER NAME OF ENTITY USING "ENTGET" TO RETRIEVE ENTITY DATA
;; 'ASSOC' TO EXTRACT PORTION OF DATA PAIR, '8' IS THE LAYER NAME GROUP CODE
(SSSETFIRST NIL (SSGET "_X" (LIST TARGLAYER)))
;;SSGET USED TO SELECT ALL ITEMS (THE 'X' OPTION) HAVING SAME LAYER NAME
;;SSSETFIRST USED TO GRIP & HIGHLIGHT ITEMS
)
(defun c:acrun (/)
(c:s1)
(c:slab)
(c:dimupd)
(c:stt)
(command "move")
)
ERROR DURING PROCESSING...
INSERT .DWG into AutoCAD Session with TEMPLATE loaded.
Command: I
INSERT
Command: Duplicate definition of block _Oblique ignored.
Duplicate definition of block NORTH ignored.
Duplicate definition of block NorthArrow2 ignored.
Substituting [simplex.shx] for [WORKING.shx].
Substituting [simplex.shx] for [STANDARD.shx].
Substituting [ROMANTIC.TTF] for [ROM_____.PFB].
Substituting [simplex.shx] for [WORKING.shx].
Substituting [simplex.shx] for [WORKING.shx].
Command:
Command: *Cancel*
Command: *Cancel*
Command:
Command: AC
BACTION ** BACTION command only allowed in Block Editor. **
Command: ACRUN
zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: e Regenerating model.
Command: chprop
Select objects:
Command: ACRUN
Unknown command "ACRUN". Press F1 for help.
Command: la Unknown command "LA". Press F1 for help.
Command: A-FLOR-PERI Unknown command "A-FLOR-PERI". Press F1 for help.
Command: c Unknown command "C". Press F1 for help.
Command: bylayer Unknown command "BYLAYER". Press F1 for help.
Command: ACRUN
Unknown command "ACRUN". Press F1 for help.
Command: chprop
Select objects:
Command: ACRUN
Unknown command "ACRUN". Press F1 for help.
Command: la Unknown command "LA". Press F1 for help.
Command: A-FLOR-FTPT Unknown command "A-FLOR-FTPT". Press F1 for help.
Command: c Unknown command "C". Press F1 for help.
Command: bylayer Unknown command "BYLAYER". Press F1 for help.
Command: ACRUN
Unknown command "ACRUN". Press F1 for help.
Command: chprop
Select objects:
Command: ACRUN
Unknown command "ACRUN". Press F1 for help.
Command: la Unknown command "LA". Press F1 for help.
Command: A-AREA-IDEN Unknown command "A-AREA-IDEN". Press F1 for help.
Command: c Unknown command "C". Press F1 for help.
Command: bylayer Unknown command "BYLAYER". Press F1 for help.
Command: ACRUN
Unknown command "ACRUN". Press F1 for help.
Command: _.justifytext
Select objects:
Command: ACRUN
Unknown command "ACRUN". Press F1 for help.
Command: _MC Unknown command "MC". Press F1 for help.