Message 1 of 4
Plotting blocks in modelspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to rewrite a piece of code, originally intended to plot to a pdf, and make it print directly to the output device.
( I don't know much, if anything about lisp) The point is that it looks for blocks (A4PLOT for example) in my selection set and then automatically prints them.
There is a block of code in the lisp that points to making a file and naming it I believe but I can't delete it without the code breaking, as of now it does not do anything at all.
Any advice by you Lispers?
This is the code so far:
(vl-load-com) (defun c:PrintA4P (/ dwg file hnd i len llpt lst mn mx ss tab urpt) (if (setq ss (ssget "_P" '((0 . "INSERT") (2 . "A4PLOT")))) (progn (repeat (setq i (sslength ss)) (setq hnd (ssname ss (setq i (1- i))) tab (cdr (assoc 410 (entget hnd))) lst (cons (cons tab hnd) lst) ) ) (setq lst (vl-sort lst '(lambda (x y) (> (car x) (car y))))) (setq i 0) (foreach x lst (setq file (strcat (getvar 'DWGPREFIX) (substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4)) "-" (itoa (setq i (1+ i))) ".pdf" ) ) (if (findfile file) (vl-file-delete file) ) (vla-getboundingbox (vlax-ename->vla-object (cdr x)) 'mn 'mx) (setq llpt (vlax-safearray->list mn) urpt (vlax-safearray->list mx) len (distance llpt (list (car urpt) (cadr llpt))) ) (command "-plot" "yes" (car x) "KONICA MINOLTA C554 (v1)" "A4" "Millimeters" "Portrait" "No" "Window" llpt urpt "Fit" "Center" "yes" "Monochrome.ctb" "yes" "" ) (if (/= (car x) "Model") (command "No" "No" file "No" "Yes") (command file "No" "Yes" ) ) ) ) ) (princ) )
Wauter