For a time ago I wrote something like this in order to change color of a layer in many CAD files:
(Command "open" "File namn1" "_layer" "Color" 8 "layername" "qsave" Close")
(Command "open" "File namn2" "_layer" "Color" 8 "layername" "qsave" Close")
(Command "open" "File namn3" "_layer" "Color" 8 "layername" "qsave" Close")
.
.
These rows were saved in a file and could be loaded and run.
But I do not remember is what kind of file it should be saved and how to load it into Autocad!
I used MAP but now using C3D.
Another problem is a system variable called SDI, what is that?
I know this could be done in other ways but this solution worked for me and I rather continue using it!
Hi,
>> But I do not remember is what kind of file it should be saved and how to load it into Autocad!
Save that as lisp-file (extension = LSP), you can load that by just drag & drop.
>> Another problem is a system variable called SDI, what is that?
That is very historical, it's an option for AutoCAD to enable the "single-document-interface", so only one DWG-file can be opened, if you try to open another one the current file will be closed. Not to be used now, it only exists for very, very old scripts.
- alfred -
Thanks for your reply!
As I mentioned I used MAP before and it worked!
Now I am using C3D and the first part of the line does not work:
(Command "open" "File namn1"...
So I have to open each file and paste in the second part:
(Command "_layer" "Color" 8 "layername" "Some other Changes" "qsave" "Close")
And I have 60 files! So I wanted C3D to open all files, do the changes and Save/Close by itself!
Some people suggested changing SDI to "1".
But I don´t understand why! It does not work anyway!
@Anonymous wrote:
...As I mentioned I used MAP before and it worked!
Now I am using C3D and the first part of the line does not work:
(Command "open" "File namn1"...
So I have to open each file and paste in the second part:
(Command "_layer" "Color" 8 "layername" "Some other Changes" "qsave" "Close")
And I have 60 files! ....
Maybe MAP had some kind of exception built into it, but I don't believe a Lisp routine can "survive" getting into a different drawing from the one you invoked it in. You may need to use ScriptPro or something -- Search the Forum and you'll find lots of examples of applying something to multiple drawings that way.
Hi,
>> I don't believe a Lisp routine can "survive" getting into a different drawing from the one you invoked it in
Yes, Kent is absolutely correct, I just saw "lisp syntax" and forgot to think about the mentioned command _OPEN in it.
And no, that does not have to do anything with Map3D, in that case Map3D is acting as AutoCAD without any difference.
Setting SDI to 1 might be a help, I have not tried it. But what Kent suggested - to use something like ScriptPro or a similar tool - is the better way to go.
- alfred -