leonucadomi Posted April 9 Share Posted April 9 hello people: I need to apply the layout configuration from a dwg file to many others can anybody help me? some lisp routine that does it? Quote Link to comment Share on other sites More sharing options...
leonucadomi Posted April 9 Author Share Posted April 9 I was able to do it with the DWG TRUE VIEW 2022, AND ALL THE DWG HAVE THE DESIRED CONFIGURATION, BUT NOW HOW CAN I MAKE THAT CONFIGURATION CURRENT IN EACH DWG Quote Link to comment Share on other sites More sharing options...
mhupp Posted April 9 Share Posted April 9 https://www.lee-mac.com/steal.html 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 9 Share Posted April 9 You can use Page setup top left it allows you to select a dwg and get page setups. Only hiccup only updates current dwg. Quote Link to comment Share on other sites More sharing options...
leonucadomi Posted April 10 Author Share Posted April 10 17 hours ago, mhupp said: https://www.lee-mac.com/steal.html use this routine but only apply it to one file, Is there something that can apply it to a group of files? Quote Link to comment Share on other sites More sharing options...
Steven P Posted April 10 Share Posted April 10 I'm at home, CAD is in the office so can't copy and paste anything. I have a pagsetup LISP / series of LISPs, rather than copying from one setup to another the codes just set things. Usually we have 3 or 4 large clients and ourselves which means about 12 pagesetups (A3, A1, A0 page sizes, 4 clients) and you don't need the drawing with the template on. I think there about about 6 things to work out and set: plotter, Paper size, Plot area, centre the plot, plot style, plot options and orientation. From what I remember all the LISPs I use to set these were downloaded - might be somethng out there that you can make up to do as you want. With a single LISP you can apply this to a script process to change a lot of files as necessary 1 Quote Link to comment Share on other sites More sharing options...
mhupp Posted April 10 Share Posted April 10 This is my lisp to generate a script file to process a folder of drawings. tho you will have to modify the (write-line to add in the lee mac steal command. pop up a window asking you to select a folder. generate and save script file to your my documents ask if you want to run the file now if yes runs the script file. This is what i had it doing last save the format to like dxf 2010 maybe. cut everything in model space and paste it closer to the origin , then zoom extents and save. (write-line (strcat "_.Open \"" Path "\\" FileName "\"") F) (write-line "_Saveformat 6" F) ;save to dxf code 2010 i think (write-line "_.Cutclip All \"\"" F) (write-line "_.Pasteclip 0,0,0" F) (write-line "_.Base 0,0,0" F) (write-line "_.Zoom E" F) (write-line "_.qsave" F) (write-line "_.close" F) Gen-Script.lsp Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 10 Share Posted April 10 Do 1 layout as suggested get page set up from a dwg. then https://autocadtips1.com/2012/05/18/autolisp-apply-current-page-setup-to-all-layout-tabs/ In Lee's steal lisp ;; The user may choose multiple items from a list of: ;; - Page Setups Quote Link to comment Share on other sites More sharing options...
Steven P Posted April 11 Share Posted April 11 This snippet should set up a page to ISO 'A' paper sizes with the standard things I use. Might be useful starting point. For example PSA1L is A1 drawing, layout, PSA1P is the same but portrait. For a batch process you might need to include some code to go to the layout sheet you want to set up and then run this ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Default page setup and set paper size as required: (defun psAx( Ax Width Height / pagesize orientation aplotsize) (setq pagesize (strcat "ISO_" Ax "_(" (itoa Width) ".00_x_" (itoa Height) ".00_MM)")) (c:defaultpagesetup) (setq aplotsize pagesize) (setq orientation ac0Degrees) (vla-put-canonicalmedianame (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) (getvar 'ctab)) aplotsize) (setq layoutname (vla-get-name (vla-get-ActiveLayout (vla-get-activedocument (vlax-get-acad-object ))))) (setq AD (vla-get-activedocument (vlax-get-acad-object ))) ;;AD: Active Document (setq AL (vla-get-ActiveLayout AD)) ;;AL: Active Layout ;; (vla-get-PlotRotation AL) ;;Get plot rotation (vla-put-PlotRotation AL orientation) ;;Set orientation (vla-put-PaperUnits al acMillimeters) ;;set mm (vla-put-CenterPlot AL :vlax-true) ;;center the plot (vla-put-PlotType AL acExtents) ;;set to extents (command "regen") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:psA4L()(psAx "A4" 297 210)(princ) ) (defun c:psA3L()(psAx "A3" 420 297)(princ) ) (defun c:psA2L()(psAx "A2" 594 420)(princ) ) (defun c:psA1L()(psAx "A1" 841 594)(princ) ) (defun c:psA0L()(psAx "A0" 1189 841)(princ) ) (defun c:psA4P()(psAx "A4" 210 297)(princ) ) (defun c:psA3P()(psAx "A3" 297 420)(princ) ) (defun c:psA2P()(psAx "A2" 420 594)(princ) ) (defun c:psA1P()(psAx "A1" 594 841)(princ) ) (defun c:psA0P()(psAx "A0" 841 1189)(princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1 Quote Link to comment Share on other sites More sharing options...
leonucadomi Posted April 11 Author Share Posted April 11 7 hours ago, Steven P said: This snippet should set up a page to ISO 'A' paper sizes with the standard things I use. Might be useful starting point. For example PSA1L is A1 drawing, layout, PSA1P is the same but portrait. For a batch process you might need to include some code to go to the layout sheet you want to set up and then run this ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Default page setup and set paper size as required: (defun psAx( Ax Width Height / pagesize orientation aplotsize) (setq pagesize (strcat "ISO_" Ax "_(" (itoa Width) ".00_x_" (itoa Height) ".00_MM)")) (c:defaultpagesetup) (setq aplotsize pagesize) (setq orientation ac0Degrees) (vla-put-canonicalmedianame (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) (getvar 'ctab)) aplotsize) (setq layoutname (vla-get-name (vla-get-ActiveLayout (vla-get-activedocument (vlax-get-acad-object ))))) (setq AD (vla-get-activedocument (vlax-get-acad-object ))) ;;AD: Active Document (setq AL (vla-get-ActiveLayout AD)) ;;AL: Active Layout ;; (vla-get-PlotRotation AL) ;;Get plot rotation (vla-put-PlotRotation AL orientation) ;;Set orientation (vla-put-PaperUnits al acMillimeters) ;;set mm (vla-put-CenterPlot AL :vlax-true) ;;center the plot (vla-put-PlotType AL acExtents) ;;set to extents (command "regen") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:psA4L()(psAx "A4" 297 210)(princ) ) (defun c:psA3L()(psAx "A3" 420 297)(princ) ) (defun c:psA2L()(psAx "A2" 594 420)(princ) ) (defun c:psA1L()(psAx "A1" 841 594)(princ) ) (defun c:psA0L()(psAx "A0" 1189 841)(princ) ) (defun c:psA4P()(psAx "A4" 210 297)(princ) ) (defun c:psA3P()(psAx "A3" 297 420)(princ) ) (defun c:psA2P()(psAx "A2" 420 594)(princ) ) (defun c:psA1P()(psAx "A1" 594 841)(princ) ) (defun c:psA0P()(psAx "A0" 841 1189)(princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; defaultpagesetup Quote Link to comment Share on other sites More sharing options...
Steven P Posted April 12 Share Posted April 12 That's the problem with taking code from larger codes, miss some sometimes. Think this should be the rest to add to the above (defun c:defaultpagesetup() (c:plotstylenone) (c:plotternone) (c:plotextents) (vla-put-PaperUnits al acMillimeters) ;;set mm (command "regen") (princ) ) (defun c:plotstylenone( / stylename) ;;plot style to none, unless Acad or monochrome style used (setq stylename (vla-get-StyleSheet (ActLay))) (ChangeActiveStyleSheet "None" "ctb") ;;Set to Acad plot style (if (= stylename "acad.ctb")(ChangeActiveStyleSheet "acad" "")) (if (= stylename "acad.stb")(ChangeActiveStyleSheet "acad" "")) (princ) ) ;; Change the Plot style table to something (defun ChangeActiveStyleSheet (StyleSheetName CtborStb / plotstylename) (if (= CtborStb "") ;;if CTB or STB is not specified in plot style (progn (setq CtborStb "ctb") (if (> (vl-string-search "stb" (vla-get-StyleSheet (ActLay))) 1)(setq CtborStb "stb")) )) (setq plotstylename (strcat StyleSheetName "." CtborStb)) (if (not (member plotstylename (PlotStyleTableNamesList))) (progn (if (/= StyleSheetName "None") (princ (strcat "\n" plotstylename " plot style sheet was not found. Using Acad." CtborStb))) (setq plotstylename (strcat "Acad." CtborStb)) )) (if (= StyleSheetName "None")(vla-put-StyleSheet (ActLay) "") ) ;; special case for none plot style. (if (/= StyleSheetName "None")(vla-put-StyleSheet (ActLay) plotstylename) ) (princ) ) (defun ActLay () (vla-get-ActiveLayout (vla-get-activedocument (vlax-get-acad-object))) ) (defun PlotStyleTableNamesList () (vlax-safearray->list (vlax-variant-value (vla-GetPlotStyleTableNames (ActLay)))) ) (defun c:plotternone( / mydoc mylay) (setq mydoc (vla-get-ActiveDocument (vlax-get-Acad-Object))) (setq mylay (vla-get-ActiveLayout mydoc)) (if (/= mydoc "None") (vla-put-ConfigName mylay "None")) ;;Clear plotter (princ) ) (defun c:plotextents( / PlotType) (getlayoutname) (setq PlotType (vla-put-PlotType AL acExtents)) (princ); PlotType) ) Quote Link to comment Share on other sites More sharing options...
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.