View Full Version : Help with my plotting lisp
Matt Mercer
2006-03-01, 07:31 PM
Here is my lisp routine - thanks for everyone for getting me this far. It works great for me, but I wish it would print the tabs in order ( right now it prints alphabetical ) Any help I would applicate it. Matt
Here is the code:
(defun c:W11 ( )
(foreach X (layoutlist)
(command "layout" "set" x)
(command "-plot" "Y" "
" "HP LaserJet 5000 Series PCL 5e.pc3"
"11x17" "Inches" "landscape" "no" "Extents"
"Fit" "C" "y" " Half Scale 48.ctb" "yes" "no" "no" "no" "no" "y" "y" "")
))
[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]
T.Willey
2006-03-01, 07:51 PM
(defun GetLayoutList (Doc / LoList cnt tmpLo LoName)
(if (not Doc)
(setq Doc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
)
(setq LoCol (vla-get-Layouts Doc))
(setq cnt 0)
(repeat (vla-get-Count LoCol)
(setq tmpLo (vla-item LoCol cnt))
(if (/= (setq LoName (vla-get-Name tmpLo)) "Model")
(setq LoList (cons (cons LoName (vla-get-TabOrder tmpLo)) LoList))
)
(setq cnt (1+ cnt))
)
(mapcar
'(lambda (x) (car x))
(vl-sort LoList '(lambda (a b) (< (cdr a) (cdr b))))
)
)
Use this inplace of (layoutlist).
T.Willey
2006-03-01, 07:59 PM
Forgot to tell you how to use it. If you have assigned a variable to a document (drawing) object that you want to get the layouts for, then you can use it like
(GetLayoutList YourVariable)
If you just want to get it for the current document, then you can use it like
(GetLayoutList nil)
Which is how you would use it in this instance.
Matt Mercer
2006-03-01, 08:10 PM
Thanks CiphDRMS for your time.
But I'm still lost -
(defun c:W11 ( )
(defun GetLayoutList (Doc / LoList cnt tmpLo LoName)
(if (not Doc)
(setq Doc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
)
(setq LoCol (vla-get-Layouts Doc))
(setq cnt 0)
(repeat (vla-get-Count LoCol)
(setq tmpLo (vla-item LoCol cnt))
(if (/= (setq LoName (vla-get-Name tmpLo)) "Model")
(setq LoList (cons (cons LoName (vla-get-TabOrder tmpLo)) LoList))
)
(setq cnt (1+ cnt))
)
(mapcar
'(lambda (x) (car x))
(vl-sort LoList '(lambda (a b) (< (cdr a) (cdr b))))
)
)
(command "-plot" "Y" "
" "HP LaserJet 5000 Series PCL 5e.pc3"
"11x17" "Inches" "landscape" "no" "Extents"
"Fit" "C" "y" "Half Scale 48.ctb" "yes" "no" "no" "no" "no" "y" "y" "")
))
Sorry for the *edit* but code reads much better when the "Code (http://forums.augi.com/misc.php?do=bbcode#code)" button is used.
For further details please refer to "Reading and Posting Messages (http://forums.augi.com/faq.php?faq=vb_read_and_post)" on the FAQs Page (http://forums.augi.com/faq.php?).
Richard
Forum Moderator
T.Willey
2006-03-01, 08:17 PM
All you had to do is change one line, after you added my code to yours.
(defun c:W11 ( )
(defun GetLayoutList (Doc / LoList cnt tmpLo LoName)
(if (not Doc)
(setq Doc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
)
(setq LoCol (vla-get-Layouts Doc))
(setq cnt 0)
(repeat (vla-get-Count LoCol)
(setq tmpLo (vla-item LoCol cnt))
(if (/= (setq LoName (vla-get-Name tmpLo)) "Model")
(setq LoList (cons (cons LoName (vla-get-TabOrder tmpLo)) LoList))
)
(setq cnt (1+ cnt))
)
(mapcar
'(lambda (x) (car x))
(vl-sort LoList '(lambda (a b) (< (cdr a) (cdr b))))
)
)
;-------------------------------------------------------------------------
(foreach X (GetLayoutList nil)
(command "layout" "set" x)
(command "-plot" "Y" "
" "HP LaserJet 5000 Series PCL 5e.pc3"
"11x17" "Inches" "landscape" "no" "Extents"
"Fit" "C" "y" " Half Scale 48.ctb" "yes" "no" "no" "no" "no" "y" "y" "")
))
Matt Mercer
2006-03-01, 08:26 PM
Thanks again - that is perfect. Your the best CiphDRMRS
T.Willey
2006-03-01, 08:31 PM
You're welcome.
Matt Mercer
2006-03-06, 11:47 PM
Having problems again - this time the network - I was hoping that I could put it on the network so everyone has it.
this is what I have:
(defun c:W11 ()
(defun GetLayoutList (Doc / LoList cnt tmpLo LoName)
(if (not Doc)
(setq Doc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
)
(setq LoCol (vla-get-Layouts Doc))
(setq cnt 0)
(repeat (vla-get-Count LoCol)
(setq tmpLo (vla-item LoCol cnt))
(if (/= (setq LoName (vla-get-Name tmpLo)) "Model")
(setq
LoList (cons (cons LoName (vla-get-TabOrder tmpLo)) LoList)
)
)
(setq cnt (1+ cnt))
)
(mapcar
'(lambda (x) (car x))
(vl-sort LoList '(lambda (a b) (< (cdr a) (cdr b))))
)
)
;-------------------------------------------------------------------------
(foreach X (GetLayoutList nil)
(command "layout" "set" x)
(command
"-plot" "Y"
"
" "\\cdp-01\lj5000\HP (file://\cdp-01lj5000HP) LaserJet 5000 Series PCL 5e (upstairs).pc3"
"11x17" "Inches"
"landscape" "no"
"Extents" "Fit"
"C" "y"
"Scale 48.ctb" "yes"
"no" "no"
"no" "no"
"y" "y"
""
)
)
)what it tells me is that "a local printer is required"
any suggustions?
[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]
T.Willey
2006-03-06, 11:52 PM
I don't. I have all my pc3 files on my hard drive, so I haven't run into anything like this. Maybe someone will chime in that has the same setup as you. Sorry I can't be more help.
Matt Mercer
2006-03-07, 12:02 AM
Thats ok - you helped me so much already.
ccowgill
2006-03-07, 11:38 AM
This is my plot lisp, or at least the part that runs the plotter:
(command "-PLOT"
"y" ;Detailed plot configuration? [Yes/No] <No>: y
"" ;Enter a layout name or [?] <Layout1>:
"" ;Enter an output device name or [?] <All SIZES KIP PLOTTER.pc3>:
"" ;Enter paper size or [?] <User 1 (36.00 x 24.00 Inches)>:
"" ;Enter paper units [Inches/Millimeters] <Inches>:
"" ;Enter drawing orientation [Portrait/Landscape] <Landscape>:
"" ;Plot upside down? [Yes/No] <No>:
"" ;Enter plot area [Display/Extents/Layout/View/Window] <Window>:
"" ;Enter lower left corner of window <-0.715381,-1.094228>:
"" ;Enter upper right corner of window <35.284619,22.905772>:
"" ;Enter plot scale (Plotted Inches=Drawing Units) or [Fit] <1:1>:
"" ;Enter plot offset (x,y) or [Center] <0.00,-0.00>:
"" ;Plot with plot styles? [Yes/No] <Yes>:
"" ;Enter plot style table name or [?] (enter . for none) <english.ctb>:
"" ;Plot with lineweights? [Yes/No] <Yes>:
"" ;Scale lineweights with plot scale? [Yes/No] <No>:
"" ;Plot paper space first? [Yes/No] <No>:
"" ;Hide paperspace objects? [Yes/No] <No>:
"n" ;Write the plot to a file [Yes/No] <N>: y
; file ;Enter file name <maverickengineeringx5405RCp01001-Layout1.PLT (file://maverickengineeringx5405RCp01001-Layout1.PLT/)>:
"N" ;Save changes to page setup [Yes/No]? <N> n
"y" ;Proceed with plot [Yes/No] <Y>:
)
It might help some.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.