The strategy I used to convert was to set the lineweight and transparency of each layer to the value intended by its color. Then I set PLOTTRANSPARENCYOVERRIDE to 2 since the intent is now to plot always with transparencies for screening. For an estimate of transparency, I used 100 - screening. It worked pretty well, though there seems to be some unexpected behavior, such as some unexpected lines at circle segment ends and some unexpected darkness results.
Here's the lisp routine I wrote to do the conversion:
;; Layer Settings by Color
;; Adds lineweights and transparencies to layers
;; that have colors specified in the given plot laysettings
;; Works only with AutoCAD 2011 and higher
(DEFUN C:LSC () (C:LAYERSETTINGSBYCOLOR))
(DEFUN C:LAYERSETTINGSBYCOLOR
(/ LAYLIST LAYNAME LAYSETTINGS LAYSETTING)
(SETQ
;; Define the plot laysettings to add to layers
;;
;; Format: (color-number . (("lw" . lineweight) ("tr" . transparency)))
LAYSETTINGS
'(
(1 . (("lw" . 0.65) ("tr" . 0)))
(2 . (("lw" . 0.25) ("tr" . 0)))
(3 . (("lw" . 0.80) ("tr" . 0)))
(4 . (("lw" . 0.35) ("tr" . 0)))
(5 . (("lw" . 0.25) ("tr" . 0)))
(6 . (("lw" . 0.50) ("tr" . 0)))
(7 . (("lw" . 0.35) ("tr" . 0)))
(8 . (("lw" . 0.35) ("tr" . 0)))
(9 . (("lw" . 0.35) ("tr" . 50))) ; 50% screening
(10 . (("lw" . 2.11) ("tr" . 0)))
(11 . (("lw" . 0.25) ("tr" . 0)))
(12 . (("lw" . 0.25) ("tr" . 40))) ; 60% screening
(13 . (("lw" . 0.25) ("tr" . 40))) ; 60% screening
(14 . (("lw" . 0.25) ("tr" . 60))) ; 40% screening
(15 . (("lw" . 0.25) ("tr" . 30))) ; 70% screening
)
)
(COMMAND "._layer")
;; Go through all layers in drawing and set lineweight per list.
(WHILE (SETQ LAYERLIST (TBLNEXT "LAYER" (NOT LAYERLIST)))
(SETQ LAYNAME (CDR (ASSOC 2 LAYERLIST))
LAYCOLOR (CDR (ASSOC 62 LAYERLIST))
LAYSETTING (CDR (ASSOC LAYCOLOR LAYSETTINGS))
)
(COND
(LAYSETTING
(COMMAND "_lw"
(CDR (ASSOC "lw" LAYSETTING))
LAYNAME
"_tr"
(CDR (ASSOC "tr" LAYSETTING))
LAYNAME
)
)
)
)
(COMMAND "")
;; Sets AutoCAD to plot all layer transparencies
(SETVAR "PLOTTRANSPARENCYOVERRIDE" 2)
)
;|«Visual LISP© Format Options»
(72 2 40 2 nil "end of " 60 9 2 2 1 nil T nil T)
;*** DO NOT add text below the comment! ***|;
1 comment:
Very nice, you can use it to set up all 255 colours, and use vplayer instead of layer to set vplayer to a thinner or thicker line weights, handy for xrefs from other drawings composed at different scales.
mc_tsv
Post a Comment