TheSwamp
CAD Forums => CAD General => Topic started by: ROBBO on May 07, 2014, 05:53:48 AM
-
Is it possible to keep associated short cuts with redefined command?
For example if the Explode Command is redefined - 'x' no longer works. How can the 'x' short cut be added to the redefined command and operate even if the entity is picked first?
Many thanks in advance.
-
Can you use something like this? Where "new_explode" is whatever the new command is.
(defun c:X ()
(command "new_explode")
(princ)
)
-
Many thanks for your reply.
I used something similar including code to prevent certain title block objects from being exploded in my Redefine.lsp, which works to a degree, but falls down on Dynamic blocks when they have an Anonymous Name too.
I originally done this for the explode command which lost its 'X' shortcut key.
;;-------------------------------------------------------------------------------
;;EXPLODE
;;-------------------------------------------------------------------------------
(command "UNDEFINE" "EXPLODE")
(defun C:EXPLODE ( / lst1 en typ)
(setq lst1 (list "BLOCK_NAME_1" "BLOCK_NAME_2" "BLOCK_NAME_3"))
(setq en (car (entsel "\nSelect objects to explode")))
(setq typ (entget en))
(setq typ (cdr (assoc 2 typ)))
(if (member typ lst1)
(alert "\nThis block cannot be exploded.")
(progn
(command ^c^c)
(command ".EXPLODE" en)
)
)
(princ)
)
(princ)
;;-------------------------------------------------------------------------------
(defun c:x ()(c:explode))
;;-------------------------------------------------------------------------------
-
1:
(defun c:x ()(c:explode))
2:
Why don't you just change the properties of your title block to unexplodable?
-
Valid points Crank. With regard to point 2 - unfortunately the block creation is out of my control. Need to prevent some users exploding these blocks and use the attribute and field data asociated with them.
Many thanks, Robbo.
-
I have this routine to prevent tables from being exploded in AutoCAD. How can this be incorporated in to the redifined explode command in the above routine?
Many thanks in advance, Robbo.
(defun c:explode (/ oce ss)
(princ "\nSelect objects to explode")
(if
(setq ss (ssget (list (cons 0 "~ACAD_TABLE"))))
(progn
(sssetfirst ss ss)
(setq oce (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "_.explode")
(setvar "cmdecho" oce)
)
)
(princ)
)