Jump to content
Baber62

Lisp to set plot up

Recommended Posts

Baber62

Hi Guys I came across the following routine, from https://forums.autodesk.com/t5/forums/forumtopicprintpage/board-id/130/message-id/336228/print-single-message/false/page/2

 

However, when I tried it it gives me an error message ; error: no function definition: LM:ODBX

 

How can I get this to work and also change the default size to A1 rather than A2.

 

(defun c:RV ( / )
   (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
			(setq PaperSize "ISO_A2_(594.00_x_420.00_MM)");-----default paper size
			
			(princ "\nSearching for Title Block")
			(vlax-for blk (vla-get-blocks doc)
			(cond
				(( = (vla-get-name blk) "Title_A4") (setq PaperSize "ISO_A4_(297.00_x_210.00_MM)"))
				(( = (vla-get-name blk) "A3 Drawing Sheet") (setq PaperSize "ISO_A3_(420.00_x_297.00_MM)"))
				(( = (vla-get-name blk) "Title_A2") (setq PaperSize "ISO_A2_(594.00_x_420.00_MM)"))
				(( = (vla-get-name blk) "Title_A1") (setq PaperSize "ISO_A1_(841.00_x_594.00_MM)"))
			);cond
			);vlax-for blocks
			(princ (strcat "\nPaper Size Assigned : " PaperSize))
			; );progn
		; );if model space


		(vla-put-ConfigName lay "DWG To PDF.pc3")	;set the plotter
		(vla-put-CanonicalMediaName lay PaperSize)		;set the paper size--->
		(vla-put-PlotType lay "1")			;plot area extens
		(vla-put-CenterPlot lay "1")			;center plot
		(vla-put-PaperUnits lay "1")			;set units to mm
		(vla-put-PlotWithLineweights lay "0")		;turn off lineweights
		(vla-put-PlotWithPlotStyles lay "1")		;turn on plot styles
		(vla-put-StandardScale lay "0")			;fit to paper
		(vla-put-stylesheet lay "Grayscale.ctb")	;set  the CTB
		(princ (strcat "\nPlot settings done for : "(vla-get-name lay)))
	);vlax-for
	(princ "\n--------------------------------------------------")
           )
       )
       nil t
   )
   (princ)
);defun

Share this post


Link to post
Share on other sites
ReMark

Re: change default paper size. Wouldn't you just substitute "ISO_A1_(841.00_x_594.00_MM)") for "ISO_A2_(594.00_x_420.00_MM)") where it says (setq PaperSize...default paper size? Can't help you with the first question. Sorry.

Share this post


Link to post
Share on other sites
broncos15

In general, if you see a function that starts with LM: it will have been created by Lee Mac because that is his signature he puts on nearly all functions (you can also bet that it will be an awesome function because he is the master of all things LISP haha). That function can be found on his website http://www.lee-mac.com/odbxbase.html.

Share this post


Link to post
Share on other sites
Baber62

Thanks Broncos15 will have a look into Lee's site

Share this post


Link to post
Share on other sites
Lee Mac
In general, if you see a function that starts with LM: it will have been created by Lee Mac because that is his signature he puts on nearly all functions (you can also bet that it will be an awesome function because he is the master of all things LISP haha).

 

Haha! Thanks broncos :thumbsup:

Share this post


Link to post
Share on other sites
Baber62

Hi Lee,

 

Any ideas why that lamda function is not functioning as it should?

Share this post


Link to post
Share on other sites
BIGAL

My $0.05 went a slightly different way just have a pull down menu with the various plot sizes and destination printer hard coded rather than select. Pick option 20 sheets come out etc.

Screen Shot 05-27-16 at 01.19 PM.PNG

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×