Skip to content

Autocad scripts

(load "H:\\Users\\user\\chgblocks.lsp")
chgblocks
(defun c:chgblocks ()
(setq get_bindtype (getvar "bindtype"))
(setq get_tilemode (getvar "tilemode"))
(setvar "bindtype" 1)
(setvar "tilemode" 1)
(command "-xref" "bind" "issue stamp")
(command "-xref" "bind" "rev block")
(command "-xref" "bind" "responsibility")
(setq ssblocks (ssget "X" '((0 . "INSERT"))))
(setq get-block-count 0)
(setq block-item (ssname ssblocks get-block-count))
(while (/= block-item nil)
(setq get_block_ent (entget block-item))
(setq block_name (strcase (cdr (assoc 2 get_block_ent))))
(if (or (= block_name "REV BLOCK") (= block_name "RESPONSIBILITY") (= block_name "ISSUE STAMP"))
(progn
(vl-cmdf "explode" block-item)
);end progn
);end if
(setq get-block-count (+ get-block-count 1))
(setq block-item (ssname ssblocks get-block-count))
);end while
(setq ssblocks (ssget "X" '((0 . "INSERT"))))
(setq get-block-count 0)
(setq block-item (ssname ssblocks get-block-count))
(setq ent_block_value nil)
(while (/= block-item nil)
(setq block_item_test block-item)
(setq get_block_ent (entget block-item))
(setq block_name (strcase (cdr (assoc 2 get_block_ent))))
(if (= block_name "MAP_D_TITLE")
(progn
(setq block_item_test (entnext block_item_test))
(while (= ent_block_value nil)
(setq ent_block_next (entget block_item_test))
(if (/= (assoc 2 ent_block_next) nil)
(setq ent_block_name (strcase (cdr (assoc 2 ent_block_next))))
(setq ent_block_name nil)
);end if
(if (= ent_block_name "REV")
(progn
(setq ent_block_value (cdr (assoc 1 ent_block_next)))
(setq ent_block_value (strcat ent_block_value "B"))
);end progn
);end if
(setq block_item_test (entnext block_item_test))
);end while
);end progn
);end if
(setq get-block-count (+ get-block-count 1))
(setq block-item (ssname ssblocks get-block-count))
);end while
(setq ssblocks (ssget "X" '((0 . "INSERT"))))
(setq get-block-count 0)
(setq block-item (ssname ssblocks get-block-count))
(setq ent_while_test1a nil)
(setq ent_while_test1b nil)
(setq ent_while_test2a nil)
(setq ent_while_test2b nil)
(setq ent_while_test3a nil)
(setq ent_while_test3b nil)
(setq ent_while_test3c nil)
(while (/= block-item nil)
(setq block_item_test block-item)
(setq get_block_ent (entget block-item))
(setq block_name (strcase (cdr (assoc 2 get_block_ent))))
(if (= block_name "BMC-SY-854")
(progn
(setq block_item_test (entnext block_item_test))
(while (or (= ent_while_test1a nil) (= ent_while_test1b nil))
(setq ent_block_next (entget block_item_test))
(if (/= (assoc 2 ent_block_next) nil)
(setq ent_block_name (strcase (cdr (assoc 2 ent_block_next))))
(setq ent_block_name nil)
);end if
(if (= ent_block_name "REV")
(progn
(setq ent_block_next (subst (cons 1 ent_block_value) (assoc 1 ent_block_next) ent_block_next ))
(entmod ent_block_next)
(setq ent_while_test1a 1)
);end progn
);end if
(if (= ent_block_name "DATE")
(progn
(setq ent_block_next (subst (cons 1 "08/22/11") (assoc 1 ent_block_next) ent_block_next ))
(entmod ent_block_next)
(setq ent_while_test1b 1)
);end progn
);end if
(setq block_item_test (entnext block_item_test))
);end while
);end progn
);end if
(if (= block_name "PROP-PROJ")
(progn
(setq block_item_test (entnext block_item_test))
(while (or (= ent_while_test2a nil) (= ent_while_test2b nil))
(setq ent_block_next (entget block_item_test))
(if (/= (assoc 2 ent_block_next) nil)
(setq ent_block_name (strcase (cdr (assoc 2 ent_block_next))))
(setq ent_block_name nil)
);end if
(if (= ent_block_name "REV2")
(progn
(setq ent_block_next (subst (cons 1 ent_block_value) (assoc 1 ent_block_next) ent_block_next ))
(entmod ent_block_next)
(setq ent_while_test2a 1)
);end progn
);end if
(if (= ent_block_name "REV_DESCRP2")
(progn
(setq ent_block_next (subst (cons 1 "ISSUED FOR APPROVAL-REVISED") (assoc 1 ent_block_next) ent_block_next ))
(entmod ent_block_next)
(setq ent_while_test2b 1)
);end progn
);end if
(setq block_item_test (entnext block_item_test))
);end while
);end progn
);end if
(if (= block_name "ISSUE STAMP$0$CIRCREV")
(progn
(setq block_item_test (entnext block_item_test))
(while (or (= ent_while_test3a nil) (= ent_while_test3b nil) (= ent_while_test3c nil))
(setq ent_block_next (entget block_item_test))
(if (/= (assoc 2 ent_block_next) nil)
(setq ent_block_name (strcase (cdr (assoc 2 ent_block_next))))
(setq ent_block_name nil)
);end if
(if (= ent_block_name "ISSUE")
(progn
(setq ent_block_next (subst (cons 1 ent_block_value) (assoc 1 ent_block_next) ent_block_next ))
(entmod ent_block_next)
(setq ent_while_test3a 1)
);end progn
);end if
(if (= ent_block_name "DATE")
(progn
(setq ent_block_next (subst (cons 1 "08/22/11") (assoc 1 ent_block_next) ent_block_next ))
(entmod ent_block_next)
(setq ent_while_test3b 1)
);end progn
);end if
(if (= ent_block_name "LINE_2")
(progn
(setq ent_block_next (subst (cons 1 "APPROVAL-REVISED") (assoc 1 ent_block_next) ent_block_next ))
(entmod ent_block_next)
(setq ent_while_test3c 1)
);end progn
);end if
(setq block_item_test (entnext block_item_test))
);end while
);end progn
);end if
(setq get-block-count (+ get-block-count 1))
(setq block-item (ssname ssblocks get-block-count))
);end while
(setvar "bindtype" get_bindtype)
(setvar "tilemode" get_tilemode)
(command "_resume");allows ScriptPro to resume
);end defun