Message 1 of 5

Not applicable
08-27-2018
04:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everybody,
I have made a lisp for creating blocks with certain parameters. If the block name already exists the function gets canceled. Can I somehow provide a option to stop or continue redefining the block
(defun c:blkmake () (command "undo" "be") (princ "\nSelect the objects |||| Cannot redefine blocks") (setq obj (ssget)) (initget 1 " YES NO ") (setq keywordclr (getkword "\nChange Block color to BYBLOCK? [ YES / NO ]: <YES>") ) (if (eq keywordclr "YES") (change_byblock) ) (initget 1 " YES NO ") (setq keyword (getkword "\nBlock has Center line? [ YES / NO ]: <YES>") ) (if (eq keyword "YES") (change_color) ) (princ "\nSpecify insertion base point: ") (setq pnt (getpoint)) (princ "\nEnter block name: ") (setq name (getstring t)) (command "_.-block" name pnt obj "") (command "insert" name pnt "1" "1" "0" "") (initget 1 " YES NO ") (setq ukeyword (getkword "\nScale BLock Uniformly? [ YES / NO ]: <YES>") ) (if (eq ukeyword "YES") (scale_uniformly) ) (command "undo" "end") (command "undo" "end") ) (defun change_byblock () (command "CHPROP" obj "" "LAYER" "0" "") (command "CHPROP" obj "" "COLOR" "BYBLOCK" "") (command "CHPROP" obj "" "LTYPE" "BYBLOCK" "") (command "CHPROP" obj "" "LWEIGHT" "BYBLOCK" "") ) (defun change_color () (princ "\nEnter color code") (setq ccolor (getint)) (setq cobj (ssget)) (command "CHPROP" cobj "" "COLOR" ccolor "") (command "CHPROP" cobj "" "LTYPE" "CENTER" "") ) (defun scale_uniformly () (command "-bedit" name "scale_uniformly") )
Solved! Go to Solution.