Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Struggling with opening dwg file from lisp

1 REPLY 1
Reply
Message 1 of 2
Anonymous
973 Views, 1 Reply

Struggling with opening dwg file from lisp

Hey, 

 

Right now I'm working on a program that will go into a directory and it's subdirectories, collect a list of all the .dwg files in those directories, then apply certain changes to all of those .dwg files. 

 

My problem is that none of these things works.

 

(command "open" (srtcat basedir (nth i file)))
(command "open" (nth i fullfile))
(vl-cmdf "open" (strcat basedir (nth i file)))
(vl-cmdf "open" (nth i fullfile))

 Where "basedir" is the main directory (e.g. C:/...), file is the list of the dwg file names (e.g. mydrawing.dwg), fullfile is the list of the ull paths (e.g. C:/.../mydrawing.dwg)

 

I have tried using the filename with and without the .dwg extension with no luck. 

 

I have this code set in (while ...) so that it will go through all the files in the list "file" or "fullfile" in sequence.  The lisp will run without errors but will not open any of the files.  When I look at the command line, I see that the lisp has put open on the command line like it has executed the command, but right below that, it says "Unkown command: C:/.../mydrawing.dwg" or "Unkown command: dwg" depending on which of the above code pieces I'm using.

 

Does anyone know how to do this?

 

Brandon Gingerich

1 REPLY 1
Message 2 of 2
pbejse
in reply to: Anonymous

Try:

 

(vla-open (vla-get-documents (vlax-get-acad-object)) "filename")

 

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

Post to forums  

Autodesk Design & Make Report

”Boost