Greetings!
I need some help. I'd like to change a layer's color from command line because of a user icon. I figured out from previous topics that I should use macro similar to this: ^C^C_filedia;0;-la;s;Verdeckt (ISO);c;1;l;dashed;;_filedia;1;re;
(I want to use this macro to change layer's linetype, too, but that's not the point)
The only problem with this macro: layer's name contains a space therefore Autocad tries to recognize Verdeckt as a command (and macro interrupts there) instead of setting Verdeckt (ISO) as the current layer. I've tried using different quote marks, none of them worked (' and " and <>). I hope there's a method for entering a parameter that contains space. Any idea?
Thanks in advance,
Solved! Go to Solution.
Solved by Zoltan78. Go to Solution.
Solved by bhull1985. Go to Solution.
Wrap it in a defun and call it a lsp.
(defun c:laychg ( /)
(command "filedia" 0)
(command "._layer" s "Verdeckt" c 1 l "dashed")
(command "filedia" 1)
(command "regen")
)
Then in your CUI it'll read like this in the macro section :
^C^C(load "Y:/Path/laychg.lsp");laychg;
Which is pathed to fully, so as to ensure it loads. Then it simply loads and executes the commands in the defun. Hopefully that'll work for you.
It might work but I found the solution. Quote marks do work, I was only trying in command line. I've inserted the whole line in the macro field and it works like a charm.
Just for the record:
^C^C_-la;c;1;"Verdeckt (ISO)";c;6;"Bemaßung (ISO)";l;dashed;"Verdeckt (ISO)";;ltscale;20;re;
Anyway, thank you!
Oh yes, definitely the " quotes will work for taking care of spaces in the strings but it appeared as if that was not the case for you, so I thought outside of the macro box....
Anyways, now you know how to tie lisps into them if ever needed though (if you're dabbling now with CUI and learning macros, it shouldn't be long before you're toying with lisp either IMO, and lisp with macros like this allow for some very nice time-saving)
Keep in mind that all the super-powerful-impressive cad add-ons, such as bentley autoplant, cadworx......are primarily LISP files mixed in with .NET files mixed in with .MNL and GUIs .....some VBA too im sure somewhere but it's mainly just the other eschelon of complexity but using the same tools and options we've available as users.
What I'm saying there is that it'd be good to get familiar with multiple languages that are used in autocad. Not enough to know how to use all of them but would be useful to at least be able to *recognize* them for which one they are, perhaps.
Food for thought
I haven't needed LISP yet, but who nows... maybe one day I will need it and yes, now I know how to tie lisps into them. I also know there's a slight difference between command line and macro interpreter 🙂
Yes Indeed that's correct!
Glad I could help.
The great thing about autoLISP , or these macros within .CUIx, is that there are an abundant amount of users with a plethora of knowledge, and that knowledge is not guarded jealously. These forums are a great central location of autocad knowledge, of any sort. I've gotten bored once or twice and ended up browsing through the threads in this particular forum...there's seemingly an infinite number of them and the threads from way back when are relevant now. (As long as they're using lisp or other currently supported methodology)
Cheers!