Introduction
Managing plot styles in AutoCAD—whether CTB (Color-Dependent Plot Style Tables) or STB (Named Plot Style Tables)—can be a critical task for engineers, architects, and designers. Switching between these styles efficiently ensures consistency in output, especially when transitioning between legacy and modern workflows. This guide explores a practical approach to converting drawings from CTB to STB using a custom AutoLISP routine, tailored for Civil 3D and compatible with AutoCAD 2023.
Understanding CTB vs. STB Plot Styles
CTB (Color-Dependent Plot Style Tables)
- Assigns plot styles based on object colors (e.g., color 1 = thick line, color 2 = dashed line).
- Common in older AutoCAD versions and legacy projects.
- Simpler for standardized workflows but less flexible for customization.
STB (Named Plot Style Tables)
- Assigns plot styles independently of color, using named styles (e.g., “Normal,” “125,” “255”).
- Offers greater control over line weights, screening, and other plot properties.
- Preferred for modern workflows, especially in Civil 3D and Architecture, Engineering & Construction (AEC) projects.
Step-by-Step Guide: Convert CTB to STB Using AutoLISP
Prerequisites
- AutoCAD 2023 or Civil 3D 2023 (tested on 64-bit Windows 10).
- A saved drawing (unsaved drawings will trigger an error).
- Access to the STB file (e.g.,
FDOT.stb) you want to apply.
1. Load the AutoLISP Routine
The provided AutoLISP script automates the conversion from CTB to STB by:
- Switching the drawing to STB mode.
- Assigning named plot styles to layers based on their color properties.
- Ensuring compatibility with Civil 3D layer standards.
How to Use the Script
- Copy the LISP code below into a text editor (e.g., Notepad).
- Save the file as
FDOT255.lsp(or your preferred filename). - In AutoCAD, type
APPLOADin the command line. - Browse and select the
FDOT255.lspfile, then click Load. - Type
FDOT255in the command line to execute the routine.
; Set drawing settings to FDOT.stb
(defun c:FDOT255 ()
(if (= (getvar "PStyleMode") 1)
(command "_convertpstyles" "acad - Convert.stb")
)
(cond
((= (getvar "DwgTitled") 0)
(alert "Drawing must be saved first!")
(exit)
)
)
(vla-put-StyleSheet
(vla-get-ActiveLayout
(vla-get-ActiveDocument (vlax-get-acad-object))
)
"FDOT.stb"
)
(setq layers (vla-get-layers (vla-get-ActiveDocument (vlax-get-acad-object))))
(vlax-for l layers
(progn
(cond
((equal (vla-get-color l) 8) (setvar "CPLOTSTYLE" "125") (vla-put-plotstylename l "125"))
((equal (vla-get-color l) 9) (setvar "CPLOTSTYLE" "125") (vla-put-plotstylename l "125"))
((equal (vla-get-color l) 250) (setvar "CPLOTSTYLE" "125") (vla-put-plotstylename l "125"))
((equal (vla-get-color l) 251) (setvar "CPLOTSTYLE" "125") (vla-put-plotstylename l "125"))
((equal (vla-get-color l) 252) (setvar "CPLOTSTYLE" "125") (vla-put-plotstylename l "125"))
((equal (vla-get-color l) 253) (setvar "CPLOTSTYLE" "125") (vla-put-plotstylename l "125"))
((equal (vla-get-color l) 254) (setvar "CPLOTSTYLE" "125") (vla-put-plotstylename l "125"))
((equal (vla-get-color l) 255) (setvar "CPLOTSTYLE" "Normal") (vla-put-plotstylename l "Normal"))
(T (setvar "CPLOTSTYLE" "255") (vla-put-plotstylename l "255"))
)
)
)
(setvar "CPLOTSTYLE" "ByLayer")
(princ)
)2. Customizing the Script
The script above is specific to the FDOT.stb file and assigns:
- Colors 8, 9, 250–254 → Plot style “125”.
- Color 255 → Plot style “Normal”.
- All other colors → Plot style “255”.
How to Adapt for Your STB File
- Replace “FDOT.stb” with your STB filename (e.g.,
"MyCustom.stb"). - Modify the
condblock to map layer colors to your desired plot styles.
Example:((equal (vla-get-color l) 1) (vla-put-plotstylename l "Thin")) ((equal (vla-get-color l) 2) (vla-put-plotstylename l "Dashed"))
3. Verify the Conversion
After running the script:
- Check the Plot Style Manager (
STYLESMANAGERcommand). - Ensure layers now use named plot styles (STB) instead of color-dependent styles (CTB).
- Plot a test sheet to confirm the output matches expectations.
Best Practices for CTB/STB Management
1. Start with a Template
- Always begin with a template file pre-configured with your preferred STB or CTB.
- Avoid manual conversions by using standardized templates for new projects.
2. Backup Your Drawing
- Save a copy of your drawing before running conversion scripts.
- Use AutoCAD’s
SAVEAScommand to create a backup version.
3. Test on a Sample Drawing
- Run the script on a non-critical drawing first to verify compatibility.
- Check for layer overrides or custom properties that may need adjustment.
4. Document Your Workflow
- Keep a record of plot style mappings (e.g., color → STB style).
- Share the LISP script and instructions with your team for consistency.
Troubleshooting Common Issues
| Issue | Solution |
|---|---|
| “Drawing must be saved first!” | Save the drawing (QSAVE or SAVEAS) before running the script. |
| Plot styles not applying | Ensure the STB file exists in AutoCAD’s plot style search path. |
| Script errors | Check for typos in the LISP code or unsupported AutoCAD versions. |
| Layers not updating | Verify layer colors match the script’s conditions (e.g., color 8 → “125”). |
Conclusion
Switching between CTB and STB plot styles in AutoCAD doesn’t have to be manual or error-prone. By leveraging AutoLISP, you can automate the process, ensuring consistency and efficiency—especially in Civil 3D and AEC workflows. The provided script is a starting point; customize it to fit your STB file and layer standards.
For seamless transitions, always:
✅ Use pre-configured templates.
✅ Test scripts on sample drawings.
✅ Document your plot style mappings.
Ready to streamline your plotting workflow? Load the script, run it, and experience the power of automated plot style conversion in AutoCAD!
References: AutoCAD 2023 Documentation, Civil 3D Forums, AEC Collection Best Practices.

