Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

TomBeauford
en respuesta a: Anonymous

Safest bet is to start with a template file that's already set up to use whatever STB or CTB file you want to use!

 

I have a lisp to convert a drawing with the standard Civil 3D layers from an old CTB we used years ago to the STB we use now by assigning the STB Plot Style names to layers after switching to STB. While it's written specifically for the STB we use it could be modified to set the plot style names to layers for a different template and STB file.

; Set drawing settings to FDOT.stb
; (load "FDOT255.lsp") FDOT255
; ^P(or C:FDOT255(load "FDOT255.lsp"));FDOT255
(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)
 )

 

64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter