e-transmit multiple dwg-files with LISP?

e-transmit multiple dwg-files with LISP?

thomas.schive
Enthusiast Enthusiast
1,083 Views
1 Reply
Message 1 of 2

e-transmit multiple dwg-files with LISP?

thomas.schive
Enthusiast
Enthusiast

Hey!

 

I am currently trying to write a lisp routine to make my everyday life a bit easier when it comes to e-transmiting a bunch of dwg's, but I am facing some issues and hoped you guys could help me out?

 

What I want to do in words is basically:

- Open all dwg's in the same folder

- e-transmit these (one file / zip)

- Close all dwg's

 

I have a list with all the file names. When I started writing I somehow couldn't contain my variables to the newly opened dwgs as they are locally set. Any way around this? Attaching my code so far, but I'm currently lacking the most important function in the middle there, the (etransmit).

 

(defun c:VB ( / )
    (vl-load-com)
    (createlist)
    (openall)
    (etransmit)
    (princ)
)

 

(defun createlist ( / )
    (setq
            sti "C:\\..." ;;constant part of path to be pasted here
            antalltegninger (length liste)
    )
    (setq liste
    (list
        "\\test.dwg" ;;all variable parts of names of drawings copy pasted in this list
        "\\test2.dwg"
        "\\test3.dwg"
    )
    )
)

 

(defun openall ( / )
            (repeat antalltegninger
                (setq
                    variabel (car liste)
                    bruk (strcat sti variabel)
                )
            
                ;;open all drawings in liste
                
                (setq vgao (vlax-get-acad-object))
                (setq vgad (vla-get-activedocument vgao))
                (setq vgd (vla-get-documents vgao))
                    (if
                        (= 0 (getvar "SDI"))
                        (vla-activate (vla-open vgd bruk))                               ; if sdi = 0
                        (vla-sendcommand vgad (strcat "(command \"_open\")\n" bruk "\n")); if sdi = 1
                    )                
                (setq
                    liste (cdr liste)
                )        
            ) ;;
)

 

(defun etransmit ( / ))

;; This one I can't figure out, but this one must e-transmit the opened dwg's and close them afterwards.

 

Well, I'm stuck now and reaching out.

 

 

 

0 Likes
1,084 Views
1 Reply
Reply (1)
Message 2 of 2

Moshe-A
Mentor
Mentor

@thomas.schive hi,

 

consider using >> script pro <<

 

moshe

 

0 Likes