Lisp to Set plot settings Automatically

Lisp to Set plot settings Automatically

Justin.gonzalezUH7QC
Explorer Explorer
2,327 Views
2 Replies
Message 1 of 3

Lisp to Set plot settings Automatically

Justin.gonzalezUH7QC
Explorer
Explorer

My goal is create a lisp that will automatically set the plot settings. I have tried to piece together a lisp but was not successful in making it work. can someone help me out please and thank you. 

 

 

(defun c: pltc (/)
(LM:ODBX
(function
(lambda ( doc )
(princ (strcat "\nOpening file : "(vla-get-name doc)))
(vlax-for lay (vla-get-layouts doc)

; (if ( = "Model" (vla-get-name lay))
; (progn
(princ "\nSearching in Model space for Title Block")
(vlax-for blk (vla-get-blocks doc)
(cond

(( = (vla-get-name blk) "Layout1") (setq PaperSize "36X48") (vla-put-PlotRotation lay ac0degrees))
);cond
);vlax-for blocks
(princ (strcat "\nPaper Size for Model Space : " PaperSize))
; );progn
; );if model space


(vla-put-ConfigName lay "DWG To PDF") ;set the plotter
(vla-put-CanonicalMediaName lay 36x48) ;set the paper size
(vla-put-PlotType lay acLayout) ;plot area layout
;(vla-put-CenterPlot lay "1") ;center plot
(vla-put-PaperUnits lay "1") ;set units to mm
(vla-put-PlotWithLineweights lay "1") ;turn on lineweights
(vla-put-PlotWithPlotStyles lay "1") ;turn on plot styles
(vla-put-StandardScale lay ac1_1) ;fit to paper
;(vla-put-PlotRotation lay ac90degrees) ;Drawing orientation 1=portrait 0=landscape
(vla-put-stylesheet lay "KPFF-COLOR-PLAN.ctb") ;set the CTB
(princ (strcat "\nPlot settings done for : "(vla-get-name lay)))
);vlax-for
(princ "\n--------------------------------------------------")
)
)
nil t
)
(princ)
);defun

 

JustingonzalezUH7QC_0-1631729237650.png

 

0 Likes
Accepted solutions (1)
2,328 Views
2 Replies
  • Lisp
Replies (2)
Message 2 of 3

maratovich
Advisor
Advisor
Accepted solution

You may be better off using off-the-shelf solutions. Use the search, there are many lisp for printing on the site or ready-made programs for automatic printing from the Model.

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes
Message 3 of 3

TomBeauford
Advisor
Advisor

Why not just use Page Setups? 

I use lisp macros that import two matching Page Setups (one for plotting & one for PDF) along with each Layout complete with Title Block for each size & use. One click!

64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
0 Likes