Layout to plot with different layer settings depending on content of layout name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello I'm trying to work on some code I got a time back, BTW most of it was @CodeDing s, Here is what I need and all help is very much appreciated.
I want to plot a layout list which will always contain A_A_100 for arch A_AE_100 for ceiling and A_AI_100 for Furniture. However as it is on the code and the attached dwg the beginning is a portion that varies depending on the project we are working on.
As you can see I can't make Autocad understand that I need to plot each one of the layouts with a different layer visibility.
Is there a way to achieve what I am attempting? also when it plots it moves my page setup and it messes with the location of my title block which is in layer 0
The main reason we are doing this is so we can plot with one command a set of layouts and and not having to manually freeze all layers.
Again thanks in advanced.
(defun c:PA ( / cmd layouts2Plot lyrs2TurnOff1 lyrs2TurnOff2 lyrs2TurnOff3 laylist cnt fname)
;Prep for plot
(setq cmd (getvar 'CMDECHO)) (setvar 'CMDECHO 0)
(setq layouts2Plot '("varies_A_A_100" "varies_A_AE_100" "varies_A_AI_100")
lyrs2TurnOff1 "A-FURN,A-CEIL";comma separated
lyrs2TurnOff2 "A-FURN";comma separated
lyrs2TurnOff3 "A-CLNG";comma separated
layouts2Plot (mapcar 'strcase layouts2Plot)
laylist (mapcar 'strcase (layoutlist))
cnt 1)
;loop through layouts2Plot (checking if the layout exists)
(foreach layout layouts2Plot
(prompt (strcat "\n" layout "... "))
(if (member (strcase layout) laylist)
(progn
(setvar 'CTAB layout)
(command "_.ZOOM" "e")
(if (eq "varies_A_A_100" layout) (command "-LAYER" "OFF" lyrs2TurnOff1 ""))
(setq fname (strcat (getvar 'DWGPREFIX) (getvar 'DWGNAME))
fname (strcat (substr fname 1 (- (strlen fname) 4)) "-" layout))
(command "-plot" "y" "" "DWG To PDF.pc3" "ARCH expand E1 (30.00 x 42.00 Inches)" "i" "L" "no" "WINDOW" "1.25,0.75" "41.75,29.25" "1:1" "C" "y" "monochrome.ctb" "y" "n" "n" "n" fname "Y" "y")
(if (eq "varies_A_AE_100" layout) (command "-LAYER" "ON" lyrs2TurnOff2""))
(setq fname (strcat (getvar 'DWGPREFIX) (getvar 'DWGNAME))
fname (strcat (substr fname 1 (- (strlen fname) 4)) "-" layout))
(command "-plot" "y" "" "DWG To PDF.pc3" "ARCH expand E1 (30.00 x 42.00 Inches)" "i" "L" "no" "WINDOW" "1.25,0.75" "41.75,29.25" "1:1" "C" "y" "monochrome.ctb" "y" "n" "n" "n" fname "Y" "y")
(if (eq "varies_A_AI_100" layout) (command "-LAYER" "ON" lyrs2TurnOff3""))
(setq fname (strcat (getvar 'DWGPREFIX) (getvar 'DWGNAME))
fname (strcat (substr fname 1 (- (strlen fname) 4)) "-" layout))
(command "-plot" "y" "" "DWG To PDF.pc3" "ARCH expand E1 (30.00 x 42.00 Inches)" "i" "L" "no" "WINDOW" "1.25,0.75" "41.75,29.25" "1:1" "C" "y" "monochrome.ctb" "y" "n" "n" "n" fname "Y" "y")
(prompt "Complete.")
);progn
;else
(prompt "Could not find layout.")
);if
);foreach
;Finish & clean up
(setvar 'CMDECHO cmd)
(prompt "\plotting Complete.")
(princ)
);defun