Jump to content

Open multiple dwgs from a List odf paths


Recommended Posts

Hi, im trying to open multiple files at once. I m usind LM script for get the paths, i want save this as a lsp ( a set of dwgs), and then run the lisp that open this set.


(defun c:test  (/ docslist)
 (setq docslist 

 and im stuck in this part, what can i do for open each file of this list.


Command "openfile" ??

Edited by ASQ
Link to comment
Share on other sites

think simplest way would be :

(defun c:test  ( / docslist)
  (setq docslist (list "C:\\Users\\User\\file01.dwg" "C:\\Users\\User\\file02.dwg"
                       "C:\\Users\\User\\file03.dwg" "C:\\Users\\User\\file04.dwg" ))
  (foreach doc docslist (ShellOpen doc))

; returns T if no errors occurred during program execution
(defun ShellOpen ( $f / it sh )
  (if (and (not (null $f)) (setq $f (findfile $f)) (setq sh (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application")))
    (progn (setq it (vl-catch-all-apply 'vlax-invoke (list sh 'open $f)))(vlax-release-object sh)(not (vl-catch-all-error-p it)))
      (progn (prompt "\nShell application was unable to open file")(setq it nil))))


Edited by rlx
replaced void with null
  • Like 1
Link to comment
Share on other sites

Ignoring do something on each one. Save as a script file .scr


open "C:\\Users\\User\\file01.dwg" 
open "C:\\Users\\User\\file02.dwg" 
open "C:\\Users\\User\\file03.dwg" 
open "C:\\Users\\User\\file04.dwg"


Lots of ways to write a script like this, google Lee-Mac script.



Edited by BIGAL
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...