Multi Plot Selected Layout Tabs

Multi Plot Selected Layout Tabs

jcr96
Contributor Contributor
1,543 Views
15 Replies
Message 1 of 16

Multi Plot Selected Layout Tabs

jcr96
Contributor
Contributor

Hello All,

 

I need help with a lisp command and i cant wrap my brain around this one. With help i put this lisp together for work and it works great plotting all paperspace layout tabs. I also have another that plots the current paperspace layout. What I need help with is adjusting this lisp command to plot selected layouts. Say I need only 5 sheets plotted i select the 5 tabs of the layouts i want to plot and type the command and they plot. Alot easier than going to the 5 pages or plotting all 20 pages.

Here is the lisp im working with: 

(defun c:SPDF (/ up_folder ; local function
	         file)

 (defun up_folder (prefix / p)
  (if (setq p (vl-string-search (strcase "\\cad\\") (strcase prefix)))
   (substr prefix 1 p)
  )
 ); up_folder

(foreach lay (layoutlist)
(setvar 'CTab lay)
(setq file (strcat (up_folder (getvar 'DWGPREFIX)) "\\pdf\\Preliminary Design\\" (substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4)) ".pdf"))
;;The above line Creating the PDF File name, According to "Layout" Name

(setvar "PLOTTRANSPARENCYOVERRIDE" 2)

(COMMAND "-PLOT"
"Yes" ;Detailed plot configuration?
"" ;Get a layout name
"DWG To PDF.pc3" ;Enter an output device name
"ARCH D (24.00 x 36.00 INCHES)" ;Enter paper size
"inches" ;Enter paper units
"Landscape" ;Enter drawing orientation
"No" ;Plot upside down?
"window" ;Enter plot area
"0,0"
"36,24"
"1:1" ;Enter plot scale
"0,0" ;Enter plot offset (x,y)
"Yes" ;Plot with plot styles?
"SCD SHADER.stb" ;Enter plot style table name or
"yes" ;Plot with lineweights?
"No" ;Scale lineweights with plot scale?
"yes" ;Plot paper space first?
"No" ;Hide paperspace objects?
(setq file (strcat (up_folder (getvar 'DWGPREFIX)) "\\pdf\\Preliminary Design\\" (getvar "CTAB") ".pdf")) ;Name of file
"No" ;Save changes to page setup
"yes" ;Proceed with plot
)
)
)

 

0 Likes
Accepted solutions (1)
1,544 Views
15 Replies
Replies (15)
Message 2 of 16

Sea-Haven
Mentor
Mentor

Did you ask this on another forum ? I have plot range which does just that plot a range of layouts like 3-5 etc, on the other post suggested could do "3 4 5 8 12 15" based on layout position not name.

 

An example PlotA3pdfrange needs the multi radio to work.

 

SeaHaven_0-1694733593936.png

 

0 Likes
Message 3 of 16

jcr96
Contributor
Contributor

No, this is my first time asking. I just want to be able to select the tabs. I am hoping I can do so without using an input box. I see you can choose publish selected layouts when you right click them so I'm sure it can work with just a command just having a hard time finding out how to make that work. Usually I can pick and pull from other lisp's but I can't find anything similar enough that uses tabs selected as the focus. 

0 Likes
Message 4 of 16

Sea-Haven
Mentor
Mentor

We have been using this method for years but we did name our layouts like D01, D02 etc. so using numbers is easy.

 

I had 88 layouts, 1 dwg so would use a GOTO to jump to layout 1 where we had a dwg index so could see the layouts I wanted to plotby number. Ps GOTO 0 is "Model"

0 Likes
Message 5 of 16

paullimapa
Mentor
Mentor

there is a way for you to enter the list of layout names manually by including this in your code here:

 

 

(foreach lay (layoutlist)

 

 

Just replace (layoutlist) with yours ie:

 

 

(foreach lay (list "Layout1" "Layout5" "Layout9")

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 16

Sea-Haven
Mentor
Mentor

Your request select layouts does not work in my Bricscad V20 I do know it works in Autocad as have used it with delete multiple layouts.

0 Likes
Message 7 of 16

jcr96
Contributor
Contributor

Thanks,

This would be a good compromise if I can't get it by selecting layouts. This way I could make multiple commands for each field (health,plumbing, building,etc.).

Let me see if I can input it properly. 

0 Likes
Message 8 of 16

paullimapa
Mentor
Mentor

sure, glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 9 of 16

jcr96
Contributor
Contributor

Well I'm using just Autocad. Can you show me the thread on that command that adds selection by layout?

0 Likes
Message 10 of 16

paullimapa
Mentor
Mentor

FYI, when you come up with those groupings then you can adjust your code like this:

(setq health (list "Layout1" "Layout4")
      plumbing (list "Layout2" "Layout5")
      building (list "Layout3" "Layout6")
)
(initget 1 "Building Health Plumbing")
(setq x (getkword "Choose Layout Groups To Plot [Building/Health/Plumbing] "))
(cond 
 ((eq x "Building")
  (setq lyolst building)
 )
 ((eq x "Health")
  (setq lyolst health)
 )
 ((eq x "Plumbing")
  (setq lyolst plumbing)
 )
)
(foreach lay lyolst

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 11 of 16

jcr96
Contributor
Contributor

appreciate it i'll plug this in when i get to work tomorrow. 

0 Likes
Message 12 of 16

jcr96
Contributor
Contributor

This works well. I added it to my lisp command and it works. The only negative is that some projects require more sheets some less sheets and if a sheet number I list isnt there it wont skip it and plot the rest it will just cancel the entire function. Example: on the command below I added A-0.1 it typically isnt on our template sheets unless we are working on big projects and have to create it. So the command wont work because that sheet isnt there on the layout tabs. I guess i could create 2 commands one for big projects and 1 for typical projects. I am sure a if/cond script could fix this, but i tried and couldnt get it to work. 

(defun c:SPDF (/ up_folder ; local function
	         file)

 (defun up_folder (prefix / p)
  (if (setq p (vl-string-search (strcase "\\cad\\") (strcase prefix)))
   (substr prefix 1 p)
  )
 ); up_folder
  
(setq health (list "K-0.1" "K-1.0" "K-1.1" "K-1.2" "K-2.0")
      plumbing (list "P-1.0" "P-2.0" "P-2.1" "P-3.0")
      building (list "A-0.1" "A-1.0" "A-1.1" "A-1.2" "A-2.0" "A-2.1" "A-3.0")
      mechanical (list "M-1.0" "M-1.1" "M-1.2" "M-1.3" "M-2.0" "M-2.1")
      title (list "T-1.0" "T-1.1" "T-1.2" "T-1.3" "T-1.4" "T-1.5")
)
(initget 1 "Building Health Plumbing Mechanical Title")
(setq x (getkword "Choose Layout Groups To Plot [Building/Health/Plumbing/Mechanical/Title] "))
(cond 
 ((eq x "Building")
  (setq lyolst Building)
 )
 ((eq x "Health")
  (setq lyolst Health)
 )
 ((eq x "Plumbing")
  (setq lyolst Plumbing)
 )
 ((eq x "Mechanical")
  (setq lyolst Mechanical)
 )
 ((eq x "Title")
  (setq lyolst Title)
 )
)
(foreach lay lyolst
(setvar 'CTab lay) 
(setq file (strcat (up_folder (getvar 'DWGPREFIX)) "\\pdf\\Preliminary Design\\" (substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4)) ".pdf"))
;;The above line Creating the PDF File name, According to "Layout" Name

(setvar "PLOTTRANSPARENCYOVERRIDE" 2)

(COMMAND "-PLOT"
"Yes" ;Detailed plot configuration?
"" ;Get a layout name
"DWG To PDF.pc3" ;Enter an output device name
"ARCH D (24.00 x 36.00 INCHES)" ;Enter paper size
"inches" ;Enter paper units
"Landscape" ;Enter drawing orientation
"No" ;Plot upside down?
"window" ;Enter plot area
"0,0"
"36,24"
"1:1" ;Enter plot scale
"0,0" ;Enter plot offset (x,y)
"Yes" ;Plot with plot styles?
"SCD SHADER.stb" ;Enter plot style table name or
"yes" ;Plot with lineweights?
"No" ;Scale lineweights with plot scale?
"yes" ;Plot paper space first?
"No" ;Hide paperspace objects?
(setq file (strcat (up_folder (getvar 'DWGPREFIX)) "\\pdf\\Preliminary Design\\" (getvar "CTAB") ".pdf")) ;Name of file
"No" ;Save changes to page setup
"yes" ;Proceed with plot
)
)
)

 

0 Likes
Message 13 of 16

paullimapa
Mentor
Mentor
Accepted solution

This is the location where you can test to see if that layout name exists:

(foreach lay lyolst
 (if(member lay (layoutlist))
  (progn
   (setvar 'CTab lay) 
.... then the plot code
  ) ; progn
 ) ; if
) ; foreach

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 14 of 16

jcr96
Contributor
Contributor

Genius! It works and I just expanded the field of sheets so it will always work big or small project. Definetly a lot more time saving then individually or all. Thank you!

0 Likes
Message 15 of 16

paullimapa
Mentor
Mentor

glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 16 of 16

Sea-Haven
Mentor
Mentor

Your Health is "K..." Plumbing is "P...." if your layouts are always name with a prefix then you should be able to make a list for any dwg and not hard code. You can get the taborder a number and its layout name so you could mix and match layouts Health1 Plumbing1 Health2 and so on so I would look at adding that. Same again like posted select "Type" then which layouts within that group. A custom dcl. 

 

One missing 

 

 

(initget 1 "Building Health Plumbing Mechanical Title All")

 

 

If you post a sample dwg with multi layouts will see what I can do. Just need layouts not actual objects in dwg. Note screen limit within a dcl vertical is about 20 lines. So does a group have more than that ? If so then need to use a dcl list method. 

 

 I don't use initget rather like this

SeaHaven_0-1694836914041.png

 

0 Likes