Baber62 Posted May 25, 2016 Posted May 25, 2016 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 1 Quote
ReMark Posted May 25, 2016 Posted May 25, 2016 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. Quote
broncos15 Posted May 25, 2016 Posted May 25, 2016 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. Quote
Baber62 Posted May 25, 2016 Author Posted May 25, 2016 Thanks Broncos15 will have a look into Lee's site Quote
Lee Mac Posted May 25, 2016 Posted May 25, 2016 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 Quote
Baber62 Posted May 26, 2016 Author Posted May 26, 2016 Hi Lee, Any ideas why that lamda function is not functioning as it should? Quote
BIGAL Posted May 27, 2016 Posted May 27, 2016 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. Quote
jr.roberto.santos Posted May 11, 2022 Posted May 11, 2022 On 5/26/2016 at 1:15 AM, Lee Mac said: Haha! Thanks broncos @Lee Mac @BIGAL I'm using this great code. I wonder if it is possible to change all DWG files including subfolders. Best regards, (defun c:RV ( / ) (LM:ODBX (function (lambda ( doc ) (princ (strcat "\nOpening file : "(vla-get-name doc))) (vlax-for lay (vla-get-layouts doc) (setq PaperSize "ISO_A3_(297.00_x_420.00_MM)");-----default paper size for Modelspace (princ "\nSearching in Model space for Title Block") (vlax-for blk (vla-get-blocks doc) (cond (( = (vla-get-name blk) "A4 Drawing Sheet") (setq PaperSize "ISO_A4_(210.00_x_297.00_MM)")(vla-put-PlotRotation lay "1")) (( = (vla-get-name blk) "A3 Drawing Sheet") (setq PaperSize "ISO_A3_(420.00_x_297.00_MM)")(vla-put-PlotRotation lay "0")) (( = (vla-get-name blk) "A3P Drawing Sheet") (setq PaperSize "ISO_A3_(297.00_x_420.00_MM)")(vla-put-PlotRotation lay "1")) (( = (vla-get-name blk) "A2 Drawing Sheet") (setq PaperSize "ISO_A2_(594.00_x_420.00_MM)")(vla-put-PlotRotation lay "0")) (( = (vla-get-name blk) "A1 Drawing Sheet") (setq PaperSize "ISO_A1_(841.00_x_594.00_MM)")(vla-put-PlotRotation lay "0")) );cond );vlax-for blocks (princ (strcat "\nPaper Size for Model Space : " PaperSize)) (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-PlotRotation lay "1") ;Drawing orientation 1=portrait 0=landscape (vla-put-stylesheet lay "acad.ctb") ;set the CTB (princ (strcat "\nPlot settings done for : "(vla-get-name lay))) );vlax-for (princ "\n--------------------------------------------------") ) ) nil t ) (princ) );defun Quote
pegasus Posted September 22, 2022 Posted September 22, 2022 On 5/11/2022 at 5:38 AM, jr.roberto.santos said: @Lee Mac @BIGAL I'm using this great code. I wonder if it is possible to change all DWG files including subfolders. Best regards, (defun c:RV ( / ) (LM:ODBX (function (lambda ( doc ) (princ (strcat "\nOpening file : "(vla-get-name doc))) (vlax-for lay (vla-get-layouts doc) (setq PaperSize "ISO_A3_(297.00_x_420.00_MM)");-----default paper size for Modelspace (princ "\nSearching in Model space for Title Block") (vlax-for blk (vla-get-blocks doc) (cond (( = (vla-get-name blk) "A4 Drawing Sheet") (setq PaperSize "ISO_A4_(210.00_x_297.00_MM)")(vla-put-PlotRotation lay "1")) (( = (vla-get-name blk) "A3 Drawing Sheet") (setq PaperSize "ISO_A3_(420.00_x_297.00_MM)")(vla-put-PlotRotation lay "0")) (( = (vla-get-name blk) "A3P Drawing Sheet") (setq PaperSize "ISO_A3_(297.00_x_420.00_MM)")(vla-put-PlotRotation lay "1")) (( = (vla-get-name blk) "A2 Drawing Sheet") (setq PaperSize "ISO_A2_(594.00_x_420.00_MM)")(vla-put-PlotRotation lay "0")) (( = (vla-get-name blk) "A1 Drawing Sheet") (setq PaperSize "ISO_A1_(841.00_x_594.00_MM)")(vla-put-PlotRotation lay "0")) );cond );vlax-for blocks (princ (strcat "\nPaper Size for Model Space : " PaperSize)) (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-PlotRotation lay "1") ;Drawing orientation 1=portrait 0=landscape (vla-put-stylesheet lay "acad.ctb") ;set the CTB (princ (strcat "\nPlot settings done for : "(vla-get-name lay))) );vlax-for (princ "\n--------------------------------------------------") ) ) nil t ) (princ) );defun Hello there, I could not run this lispi. I got an error like this "; error: no function definition: LM:ODBX". Also, can we make a selection in the plot settings? scale, ctb.... THK YOU. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.