Jump to content

apply layout configuration from one dwg to several....help


Recommended Posts

Posted

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?

image.png.33f32d0093879d89d792de01ad0334ec.png

 

Posted

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

Posted

You can use Page setup top left it allows you to select a dwg and get page setups. Only hiccup only updates current dwg.

Posted

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

 

 

  • Like 1
Posted

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.

  1. pop up a window asking you to select a folder.
  2. generate and save script file to your my documents
  3. 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

Posted

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) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

 

 

 

  • Like 1
Posted
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

 

image.png.da838adee4042442687aa4ee315d9b17.png

 

 

 

 

Posted

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)
)

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...