Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Input the address and file name into a pupop window that made by a virtual printer (foxit reader) automatically

1q2w3e4rr
Contributor

Input the address and file name into a pupop window that made by a virtual printer (foxit reader) automatically

1q2w3e4rr
Contributor
Contributor

 

Hi

I have a code that could print what's inside the multi polylines into multi pdf files and it use “dwg to pdf.pc3”.

But doe to some reasons “dwg to pdf.pc3” dosent work properly for me, so I want to use “foxit reader” virtual printer.

But somewhere in the code foxit reader make a popup window and want me to input addres and the file name in order to save it, I want input address and file name (which the code could generate it) atumaticlly into the popup window.

Thanks for the help 😊

Code:

 

(defun c:FoxitPDF ( / f i s )
   (setq f (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname))))
   (if (setq s (ssget '((0 . "LWPOLYLINE"))))
       (repeat (setq i (sslength s))
           (apply 'plotwindow (cons f (windowpoints (ssname s (setq i (1- i))))))
       )
   )
   (princ)
)

(defun plotwindow ( f p q )
 (if (> (- (car q) (car p)) (- (cadr q) (cadr p)))
   (command
       "_.-plot"
       "_Yes"  ; Detailed plot configuration?
       "Model" ; Enter Layout Name
       "Foxit Reader PDF Printer.pc3" ; Enter an output device name
       "" ; Enter Paper Size (User Defined)
	"M" ; Enter paper units [Inches/Millimeters] <Millimeters>
       "_L"  ; Enter Drawing Orientation
       "_N"  ; Plot Upside Down?
       "_W"  ; Enter Plot Area
       "_non" p "_non" q
       "_F"  ; Enter Plot Scale
       "_C"  ; Enter plot offset
       "_Y"  ; Plot with Style
       "."   ; Enter plot style table name (none)
       "_N"  ; Plot with lineweights?
       "As Displayed" ; Enter Shade Plot Settings
	"_Y" ;Write the plot to a file
	 (uniquefilename f ".pdf")
       "_N"  ; Save Changes to page setup
       "_Y"  ; Proceed with plot

   )

   (command
       "_.-plot"
       "_Yes"  ; Detailed plot configuration?
       "Model" ; Enter Layout Name
       "Foxit Reader PDF Printer.pc3" ; Enter an output device name
       "" ; Enter Paper Size (User Defined)
	"M" ; Enter paper units [Inches/Millimeters] <Millimeters>
       "_P"  ; Enter Drawing Orientation
       "_N"  ; Plot Upside Down?
       "_W"  ; Enter Plot Area
       "_non" p "_non" q
       "_F"  ; Enter Plot Scale
       "_C"  ; Enter plot offset
       "_Y"  ; Plot with Style
       "."   ; Enter plot style table name (none)
       "_N"  ; Plot with lineweights?
       "As Displayed" ; Enter Shade Plot Settings
	"_N" ;Write the plot to a file
	 ;(uniquefilename f ".pdfd")
       "_N"  ; Save Changes to page setup
       "_Y"  ; Proceed with plot
	(uniquefilename f ".pdf")
   )
 )
)

(defun uniquefilename ( pth ext / fnm tmp )
   (if (findfile (setq fnm (strcat pth ext)))
       (progn
           (setq tmp 1)
           (while (findfile (setq fnm (strcat pth "(" (itoa (setq tmp (1+ tmp))) ")" ext))))
       )
   )
   fnm
)

(defun windowpoints ( ent )
   (   (lambda ( lst ) (mapcar '(lambda ( x ) (apply 'mapcar (cons x lst))) '(min max)))
       (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) (entget ent)))
   )
)

(princ)

 

 

0 Likes
Reply
578 Views
0 Replies
Replies (0)