PDA

View Full Version : How to open a drawing(s)


gdaniels
2006-02-27, 02:08 PM
I'm a beginner to programming but I have done a couple of very basic lisp routines before.

I now wish to write a program that open a batch of drawings (in a user specified folder) one at a time and performs a few simple editing commands. I can't figure out how to open a drawing!

I've search for help and found a few suggestions of using the cmdopen command, what is strange is that this command doesn't seem to exist on my machine (im running ADT2006)!

I'd be grateful if someone could point me in the right direction.

Thanks,

Graham.

CADmium
2006-02-27, 08:31 PM
for this kind of job use a script

cadd4la
2006-02-27, 10:17 PM
Graham,

You could use a .bat file to open up ADT2006 (I use vanilla Acad so I don't know what the .exe file is)

FOR %%f in (DriveName:folder name*.dwg) do START /WAIT c:"program files""Autocad 2006"acad.exe "%%f" /b DriveName:folder name that has the script file\ScriptName.scr

Then you can have a .scr file run like Thomas told you about.

I hope this help you.

Kyle C

kennet.sjoberg
2006-02-28, 06:49 AM
You can use this link (http://forums.augi.com/showthread.php?t=14243#post88722) to make a script file and batch run everything.

: ) Happy Computing !

kennet

gdaniels
2006-02-28, 12:45 PM
I already have a script that will make the changes I want, I wrongly assumed I would need to use Lisp to execute the script on multiple drawings!

Thanks everyone for your help (now I just need to find some time to have a go with the .bat file).

kennet.sjoberg
2006-02-28, 03:03 PM
. . .now I just need to find some time to have a go with the .bat file. ? Are you R12 ?
You may use "MakeMyScript" + your script file to generate one long scriptfile
including all drawings you will process from one AutoCAD task.

: ) Happy Computing !

kennet

BTW if you use .bat be sure to not start AutoCAD multiple, it may kill your computer,
and it is much slower to start AutoCAD every time instead of open and close drawings.

rkmcswain
2006-02-28, 06:56 PM
I now wish to write a program that open a batch of drawings (in a user specified folder) one at a time and performs a few simple editing commands. I can't figure out how to open a drawing!


Also see ScriptPro at [ http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=4091678&linkID=2475161 ]

gdaniels
2006-03-01, 10:55 PM
Thanks kennet, your lisp routine is a gem, I have a couple of questions though, firstly am I right in thinking that unless I can get the routine to add "" marks around the drawing name It cannot contain spaces? Also If I add the full drawing path into the script this would avoid having to add it to the support files path?

Thanks also rkmcswain, I will have a look at that link as soon as I get chance!

kennet.sjoberg
2006-03-02, 06:56 AM
Thanks kennet, your lisp routine is a gem, . . . can get the routine to add "" marks around the drawing name. . .

When you write the file name to the script file, you can replace "
with
\42
or
"\""
or
(chr 34 )

: ) Happy Computing !

kennet

BTW you will find info how to do somewhere earlier in this forum

ha.. I can not find it myself, but I know that the task is treated before

Opie
2006-03-02, 02:40 PM
Has kennet suggested, the quotes have been discussed before. See the STARTAPP ??? thread.

HTH

gdaniels
2006-03-04, 12:40 PM
Ok last question and I think i will be there!

How do I print an additional \ between UserCat & FileName??

(princ (strcat "open " "\""UserCat FileName"\"" "\n" ) File#1 )


Is there a list of what all the (chr number) codes do anywhere?

Thanks,

kennet.sjoberg
2006-03-04, 04:52 PM
Ok last question and I think i will be there!

How do I print an additional \ between UserCat & FileName??

(princ (strcat "open " "\""UserCat FileName"\"" "\n" ) File#1 )

(strcat "open " "\""UserCat "\\" FileName"\"" "\n" ) ;; yes double \\
or
(strcat "open " "\""UserCat "/" FileName"\"" "\n" ) ;; yes / is legal in path



Is there a list of what all the (chr number) codes do anywhere?
It is ascii codes

(ascii "A" ) --> 65
(chr 65 ) --> "A"


: ) Happy Computing !

kennet

gdaniels
2006-03-04, 04:57 PM
Thats got it working thanks.

Graham