Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Command file

5 REPLIES 5
Reply
Message 1 of 6
teflon
351 Views, 5 Replies

Command file

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!

 

5 REPLIES 5
Message 2 of 6
Alfred.NESWADBA
in reply to: teflon

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 -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 6
teflon
in reply to: teflon

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!

Message 4 of 6
Kent1Cooper
in reply to: teflon


@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.

Kent Cooper, AIA
Message 5 of 6

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 -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 6 of 6
teflon
in reply to: teflon

I am going to use script file instead!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost