flowerrobot 发表于 2022-7-6 12:05:26

vlax-add/remove-cmd

hey guys
 
Im having a bit of truble with those two commands.
 
Simply im finding that if i load it into one drawing1, then load in into drawing2, drawing 1 will lose its command and return
 
The reason im using it is because when it come to re-defineing commands i thought this would be easyer
Here is an example where its inbeded in a Foreach function of each function
and where NewKeyList is a list of what the are to be defined as

(vlax-remove-cmd (cadr nm))   (if NewKeyList   (progn         (setenv (car nm) (nth Int_Count NewKeyList))   (setq Int_Count (1+ Int_Count))))   (eval (read (strcat "(vlax-add-cmd \""(getenv (car nm)) "\" '" (caddr nm)")")))
 
thanks for any input
 
flower

wizman 发表于 2022-7-6 12:13:05

 
 
Could you not use for example:
 

(if (not c:fillet) (command "._UNDEFINE" "_FILLET"))
 
then put same command name for your lisp routine.

flowerrobot 发表于 2022-7-6 12:21:01

Sorry when i said redefining commands i am refering to routines
 
thus
 

(defun c:hi () (princ "hi") (princ))(command "._UNDEFINE" "hi"))
returns
 

Unknown command name.
SystemProtection-V.1.Lsp

wizman 发表于 2022-7-6 12:29:18

seems like a namespace issue if you're going that way.You might like to try (Setq c:hi nil) or do a vl-load-all call

flowerrobot 发表于 2022-7-6 12:32:16

when i press hi returns
 
Could you explan this vl-load-all call
since every thing is in a .vlx
 
Aswell i would like it to transfer threw open doc's if possible
 
Cheers Flower

Steve Doman 发表于 2022-7-6 12:42:42

Have you tried using vl-acad-undefun?
 
This works for me:

(foreach x '(c:routine1 c:routine2 c:routineN) (vl-acad-undefun x))

Lee Mac 发表于 2022-7-6 12:51:22

Welcome to CADTutor Steve - nice to see you here

Steve Doman 发表于 2022-7-6 12:55:32

Thanks Lee! : )

flowerrobot 发表于 2022-7-6 12:59:38

Cheers mate works great didnt think to lookin in VL for undefun

Steve Doman 发表于 2022-7-6 13:09:02

Glad to help!
页: [1]
查看完整版本: vlax-add/remove-cmd