TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: TopoWAR on August 11, 2014, 11:15:55 PM
-
hi all, with the advent of autocad 2015 I've had enough problems with the use of: command, I had to apply this code to all routines, the question is: is there another way to avoid the mistakes ?
(if command-s (command-s "_layer" "_Thaw" "aaa" "") (command "_layer" "_Thaw" "aaa"""))
appreciate your help
-
Use the vl function instead vl-cmdf .
-
Or just move away from command calls:
(defun _thaw (name / e o)
(if (setq e (tblobjname "layer" name))
(if (minusp (vlax-get (setq o (vlax-ename->vla-object e)) 'freeze))
(vlax-put o 'freeze 0)
)
)
)
;; (_thaw "0")
-
Untested (don't have A2015)... Before you execute routines type : command-switch, and after that type : command-restore...
(defun c:command
-switch
nil )
)
(defun c:command
-restore
nil )
)
HTH, if my assumptions are correct...
M.R.
-
Use the vl function instead vl-cmdf .
had already tried this function, but still fails in 2015
Or just move away from command calls:
(defun _thaw (name / e o)
(if (setq e (tblobjname "layer" name))
(if (minusp (vlax-get (setq o (vlax-ename->vla-object e)) 'freeze))
(vlax-put o 'freeze 0)
)
)
)
;; (_thaw "0")
in 15 thousand lines of code that I have, it would be more difficult to suppress the call command, I've used a lot
Untested (don't have A2015)... Before you execute routines type : command-switch, and after that type : command-restore...
(defun c:command
-switch
nil )
)
(defun c:command
-restore
nil )
)
HTH, if my assumptions are correct...
M.R.
Correct me if it is true, the function is being protected command, trying to replace it with another function daria error running the code, is this true ????
-
I understand, but if you're already going through your code and replacing command with command-s .. why not replace it with a commandless function ?
The solution with the least amount of effort would be:
(if command-s
(setq command command-s)
)
If it's prompting about the assignment to protected symbol just turn it off in the vlide.
Tools>>Environment Options>>General Options>> SETQ to protected symbols>> Transparent
-
ronjonp ,
is that I have not yet replaced by command-s command, I have to do and wanted to see if there is an easier solution, I very much like your proposal, but to try to replace the function code sticks because I pulled a screen says that the function is being protected command, I do? thanks friend
Tools>>Environment Options>>General Options>> SETQ to protected symbols>> Transparent
ahh I see, but my question is: to do this on all pc's where the code is run vlx if so would be complicated!
-
...
Tools>>Environment Options>>General Options>> SETQ to protected symbols>> Transparent
ahh I see, but my question is: to do this on all pc's where the code is run vlx if so would be complicated!
The file that setting is stored in is located in VLIDE.DSK here:
(vl-registry-read (strcat "HKEY_CURRENT_USER\\" (vlax-product-key)) "RoamableRootFolder")
Set (*protect-assign* . 0)
I'd personally take the time to go through the code and fix it though.
-
ronjonp , my friend thank you very much :-)
-
Glad to help :)
-
Also a good argument for creating re-useable functions. Instead of the same thing written out a few thousand times, a function call written once and called where needed. When these things prop up, its only a matter of opening the one box, changing the contents, and everything outside the box is none the wiser.
-
I'm not sure that I understand what the problem is, I have a fair number of routines that use (command and not (command-s and they all work fine in 2015.
-
Also a good argument for creating re-useable functions. Instead of the same thing written out a few thousand times, a function call written once and called where needed. When these things prop up, its only a matter of opening the one box, changing the contents, and everything outside the box is none the wiser.
Agreed ;)
-
I do not understand the problem with command and command-s
I copied the lines below the help of AutoCAD 2015.
"(command-s "._circle" (getpoint "\nSpecify center point: ") "_d" 2.75)"
Turns out the lines of code work fine in AutoCAD 2015 and 2012.
1
(command-s "._circle" (getpoint "\nSpecify center point: ") "_d" 2.75)
2
(command "._circle" (getpoint "\nSpecify center point: ") "_d" 2.75)
Can someone explain me better how to reproduce the error that is as reported.
I better understand all the comments about it.
Thanks
-
vl-cmdf is probably failing due to vl-load-com not being present. The . and _ also affect the running of a command. I have no idea what the difference between "circle " "_circle" and "._circle"
-
I have no idea what the difference between "circle " "_circle" and "._circle"
See here (http://bit.ly/1d2jfB3) & here (http://bit.ly/18cyqA3).
-
I do not understand the problem with command and command-s
I copied the lines below the help of AutoCAD 2015.
"(command-s "._circle" (getpoint "\nSpecify center point: ") "_d" 2.75)"
Turns out the lines of code work fine in AutoCAD 2015 and 2012.
1
(command-s "._circle" (getpoint "\nSpecify center point: ") "_d" 2.75)
2
(command "._circle" (getpoint "\nSpecify center point: ") "_d" 2.75)
Can someone explain me better how to reproduce the error that is as reported.
I better understand all the comments about it.
Thanks
Sorry I forgot to post the text of the AutoCAD 2015 help file.
"The following is an invalid use of prompting for user input with the command-s function.
(command-s "._circle" (getpoint "\nSpecify center point: ") "_d" 2.75)"
-
I'd personally take the time to go through the code and fix it though.
If it ain't broke, why 'fix' it?
I 'know' AutoCAD, I don't 'know' autolisp (or any of its variants) or C++ or V<whatever>.
I write what I know in order to make my cad production faster, not to go back and re-write cr4p with every new release. I see nothing at all 'broken' about using command calls .. until someone mucks with the program to make such legacy calls an issue.