E-Transmit: 'Add Files' through lisp

E-Transmit: 'Add Files' through lisp

Anonymous
Not applicable
1,962 Views
5 Replies
Message 1 of 6

E-Transmit: 'Add Files' through lisp

Anonymous
Not applicable

Hello.

I have a little bit of code so far that runs the eTransmit function, creating one zip folder for one drawing. 

I want to create one zip folder for MULTIPLE drawings, from a list. I have another little bit of code that generates this list.

Is this possible to do with autolisp? 

 

Code 1.

(defun c:etrans nil
	(COMMAND "QSAVE" )
	(command "-etransmit" "ch" "ACAD 2013 REFERENCE" "C" (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ".zip"))
	(princ)
)

 

Code 2.

... (setq dlist (GEN-BU-GETFILES "Select Drawings" "" "dwg"))...
0 Likes
Accepted solutions (1)
1,963 Views
5 Replies
Replies (5)
Message 2 of 6

Ajilal.Vijayan
Advisor
Advisor

looks like the command line version doesn't have the option to add the files as the dialog box has.

If your goal is to create a single zip file for multiple cad files, did you try to add the cad files and do the etransmit ?

Capture.JPG

0 Likes
Message 3 of 6

Anonymous
Not applicable
The eTransit works for me through the dialog box. I can add my multiple files and generate the one zip file perfectly fine. But i want to be able to do it through code.
0 Likes
Message 4 of 6

Ajilal.Vijayan
Advisor
Advisor

Then try to run a script for the drawings and create a transmittal package of folder instead of zip.

And at the end create a single zip file manually.

1. First create a new transmittal package manually by setting the package type to 'Folder(set of files).

2. Then use the modified below code (from here) by passing your Code2 list of files.

    This code will create a script file by adding all the cad files you need to process.

3. Update the lisp path(highlighted in blue)  to the Code1 lsp file location.

    In this lisp use the newly created transmittal package name

4. Then running the script should create the set of files and later manually create a single zip of that folder.

(defun demo ( dwglst / ofile scrfile)
   (setq scrfile (strcat (getenv "Temp") "\\My_Script.scr")
         ofile   (open scrfile "w")
   )
   (foreach dwg dwglst
      (write-line (strcat "_.open\r" (chr 34) dwg (chr 34) "\r") ofile)
      (write-line
         (strcat "(load " (chr 34) "c:/your/path/etra.lsp" (chr 34) ")\r")
         ofile
      )
   )
   (close ofile)
   (command "_.script" scrfile)
) 

 

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hi Ajilal. Thanks for that. I might be a little confused though..

Could I not just have all the codes in the same lsp file and have the "demo" function CALL my "etrans" (code1) function?? instead of calling a separate lsp file? Or have i got the wrong idea of how this all works... 😕

 

(defun c:etrans nil
	(COMMAND "QSAVE" )
	(command "-etransmit" "ch" "ACAD 2013 REFERENCE" "C" (strcat (getvar 'dwgprefix) "ProgressPrints\\" (vl-filename-base (getvar 'dwgname)) ".zip"))
	(princ)
)


(defun demo ( dlist  / ofile scrfile)
   (setq scrfile (strcat (getenv "Temp") "\\My_Script.scr")
         ofile   (open scrfile "w")
   )
   (foreach dwg dlist 
      (write-line (strcat "_.open\r" (chr 34) dwg (chr 34) "\r") ofile)
      (write-line
         (strcat "(load " (chr 34) "c:/your/path/etra.lsp" (chr 34) ")\r")		;change this to call "etrans"??
         ofile
      )
   )
   (close ofile)
   (command "_.script" scrfile)
)

 

0 Likes
Message 6 of 6

Anonymous
Not applicable
Accepted solution

Never mind. I've just decided to run through the drawing list and create a zip folder for each drawing. I think it's probably better this way anyway.

Thank you anyway!

0 Likes