Plot Style Files (CTB/STB)¶
CTB and STB files store plot styles used by AutoCAD and BricsCAD for printing and plotting.
If the plot style table is attached to a Paperspace
or the Modelspace
,
a change of a plot style affects any object that uses that plot style. CTB files contain color dependent plot
style tables, STB files contain named plot style tables.
See also
AUTODESK KNOWLEDGE NETWORK: How to install CTB files in AutoCAD
- ezdxf.addons.acadctb.load(filename: str | PathLike) ColorDependentPlotStyles | NamedPlotStyles ¶
Load the CTB or STB file filename from file system.
- ezdxf.addons.acadctb.new_ctb() ColorDependentPlotStyles ¶
Create a new CTB file.
- ezdxf.addons.acadctb.new_stb() NamedPlotStyles ¶
Create a new STB file.
ColorDependentPlotStyles¶
Color dependent plot style table (CTB file), table entries are PlotStyle
objects.
- class ezdxf.addons.acadctb.ColorDependentPlotStyles¶
- description¶
Custom description of plot style file.
- scale_factor¶
Specifies the factor by which to scale non-ISO linetypes and fill patterns.
- apply_factor¶
Specifies whether or not you want to apply the
scale_factor
.
- custom_lineweight_display_units¶
Set
1
for showing lineweight in inch in AutoCAD CTB editor window, but lineweights are always defined in millimeters.
- lineweights¶
Lineweights table as
array.array
- __getitem__(aci: int) PlotStyle ¶
Returns
PlotStyle
for AutoCAD Color Index (ACI) aci.
- __iter__()¶
Iterable of all plot styles.
- new_style(aci: int, data: dict | None = None) PlotStyle ¶
Set aci to new attributes defined by data dict.
- Parameters:
data –
dict
ofPlotStyle
attributes: description, color, physical_pen_number, virtual_pen_number, screen, linepattern_size, linetype, adaptive_linetype, lineweight, end_style, join_style, fill_style
- get_lineweight_index(lineweight: float) int ¶
Get index of lineweight in the lineweight table or append lineweight to lineweight table.
- get_table_lineweight(index: int) float ¶
Returns lineweight in millimeters of lineweight table entry index.
- Parameters:
index – lineweight table index =
PlotStyle.lineweight
- Returns:
lineweight in mm or
0.0
for use entity lineweight
- set_table_lineweight(index: int, lineweight: float) int ¶
Argument index is the lineweight table index, not the AutoCAD Color Index (ACI).
- Parameters:
index – lineweight table index =
PlotStyle.lineweight
lineweight – in millimeters
- save()¶
Save CTB file as filename to the file system.
- write(stream: BinaryIO) None ¶
Compress and write CTB file to binary stream.
NamedPlotStyles¶
Named plot style table (STB file), table entries are PlotStyle
objects.
- class ezdxf.addons.acadctb.NamedPlotStyles¶
- description¶
Custom description of plot style file.
- scale_factor¶
Specifies the factor by which to scale non-ISO linetypes and fill patterns.
- apply_factor¶
Specifies whether or not you want to apply the
scale_factor
.
- custom_lineweight_display_units¶
Set
1
for showing lineweight in inch in AutoCAD CTB editor window, but lineweights are always defined in millimeters.
- lineweights¶
Lineweights table as
array.array
- __delitem__(name: str) None ¶
Delete plot style name. Plot style
'Normal'
is not deletable.
- __iter__() Iterable[str] ¶
Iterable of all plot style names.
- new_style(name: str, data: dict | None = None, localized_name: str | None = None) PlotStyle ¶
Create new class:PlotStyle name by attribute dict data, replaces existing class:PlotStyle objects.
- Parameters:
name – plot style name
localized_name – name shown in plot style editor, uses name if
None
data –
dict
ofPlotStyle
attributes: description, color, physical_pen_number, virtual_pen_number, screen, linepattern_size, linetype, adaptive_linetype, lineweight, end_style, join_style, fill_style
- get_lineweight_index(lineweight: float) int ¶
Get index of lineweight in the lineweight table or append lineweight to lineweight table.
- get_table_lineweight(index: int) float ¶
Returns lineweight in millimeters of lineweight table entry index.
- Parameters:
index – lineweight table index =
PlotStyle.lineweight
- Returns:
lineweight in mm or
0.0
for use entity lineweight
- set_table_lineweight(index: int, lineweight: float) int ¶
Argument index is the lineweight table index, not the AutoCAD Color Index (ACI).
- Parameters:
index – lineweight table index =
PlotStyle.lineweight
lineweight – in millimeters
- save()¶
Save STB file as filename to the file system.
- write()¶
Compress and write STB file to binary stream.
PlotStyle¶
- class ezdxf.addons.acadctb.PlotStyle¶
- index¶
Table index (0-based). (int)
- aci¶
AutoCAD Color Index (ACI) in range from
1
to255
. Has no meaning for named plot styles. (int)
- description¶
Custom description of plot style. (str)
- virtual_pen_number¶
Only used by non-pen plotters and only if they are configured for virtual pens. valid range from
1
to255
orAUTOMATIC
. (int)
- screen¶
Specifies the color intensity of the plot on the paper, valid range is from
0
to100
. (int)If you select
100
the drawing will plotted with its full color intensity. In order for screening to work, thedithering
option must be active.
- linetype¶
Overrides the entity linetype, default value is
OBJECT_LINETYPE
. (bool)
- adaptive_linetype¶
True
if a complete linetype pattern is more important than a correct linetype scaling, default isTrue
. (bool)
- linepattern_size¶
Line pattern size, default =
0.5
. (float)
- lineweight¶
Overrides the entity lineWEIGHT, default value is
OBJECT_LINEWEIGHT
. This is an index into theUserStyles.lineweights
table. (int)
- end_style¶
Line end cap style, see table below, default is
END_STYLE_OBJECT
(int)
- join_style¶
Line join style, see table below, default is
JOIN_STYLE_OBJECT
(int)
- fill_style¶
Line fill style, see table below, default is
FILL_STYLE_OBJECT
(int)
- dithering¶
Depending on the capabilities of your plotter, dithering approximates the colors with dot patterns. When this option is
False
, the colors are mapped to the nearest color, resulting in a smaller range of colors when plotting.Dithering is available only whether you select the object’s color or assign a plot style color.
- grayscale¶
Plot colors in grayscale. (bool)
Default Line Weights¶
# |
[mm] |
---|---|
0 |
0.00 |
1 |
0.05 |
2 |
0.09 |
3 |
0.10 |
4 |
0.13 |
5 |
0.15 |
6 |
0.18 |
7 |
0.20 |
8 |
0.25 |
9 |
0.30 |
10 |
0.35 |
11 |
0.40 |
12 |
0.45 |
13 |
0.50 |
14 |
0.53 |
15 |
0.60 |
16 |
0.65 |
17 |
0.70 |
18 |
0.80 |
19 |
0.90 |
20 |
1.00 |
21 |
1.06 |
22 |
1.20 |
23 |
1.40 |
24 |
1.58 |
25 |
2.00 |
26 |
2.11 |
Predefined Values¶
- ezdxf.addons.acadctb.AUTOMATIC¶
- ezdxf.addons.acadctb.OBJECT_LINEWEIGHT¶
- ezdxf.addons.acadctb.OBJECT_LINETYPE¶
- ezdxf.addons.acadctb.OBJECT_COLOR¶
- ezdxf.addons.acadctb.OBJECT_COLOR2¶
Line End Style¶
END_STYLE_BUTT |
|
END_STYLE_SQUARE |
|
END_STYLE_ROUND |
|
END_STYLE_DIAMOND |
|
END_STYLE_OBJECT |
|
Line Join Style¶
JOIN_STYLE_MITER |
|
JOIN_STYLE_BEVEL |
|
JOIN_STYLE_ROUND |
|
JOIN_STYLE_DIAMOND |
|
JOIN_STYLE_OBJECT |
|
Fill Style¶
FILL_STYLE_SOLID |
|
FILL_STYLE_CHECKERBOARD |
|
FILL_STYLE_CROSSHATCH |
|
FILL_STYLE_DIAMONDS |
|
FILL_STYLE_HORIZONTAL_BARS |
|
FILL_STYLE_SLANT_LEFT |
|
FILL_STYLE_SLANT_RIGHT |
|
FILL_STYLE_SQUARE_DOTS |
|
FILL_STYLE_VERICAL_BARS |
|
FILL_STYLE_OBJECT |
|
Linetypes¶
Linetype name |
Value |
---|---|
Solid |
0 |
Dashed |
1 |
Dotted |
2 |
Dash Dot |
3 |
Short Dash |
4 |
Medium Dash |
5 |
Long Dash |
6 |
Short Dash x2 |
7 |
Medium Dash x2 |
8 |
Long Dash x2 |
9 |
Medium Lang Dash |
10 |
Medium Dash Short Dash Short Dash |
11 |
Long Dash Short Dash |
12 |
Long Dash Dot Dot |
13 |
Long Dash Dot |
14 |
Medium Dash Dot Short Dash Dot |
15 |
Sparse Dot |
16 |
ISO Dash |
17 |
ISO Dash Space |
18 |
ISO Long Dash Dot |
19 |
ISO Long Dash Double Dot |
20 |
ISO Long Dash Triple Dot |
21 |
ISO Dot |
22 |
ISO Long Dash Short Dash |
23 |
ISO Long Dash Double Short Dash |
24 |
ISO Dash Dot |
25 |
ISO Double Dash Dot |
26 |
ISO Dash Double Dot |
27 |
ISO Double Dash Double Dot |
28 |
ISO Dash Triple Dot |
29 |
ISO Double Dash Triple Dot |
30 |
Use entity linetype |
31 |