Class CadPlotStyleResolver
- Namespace
- OpenCAD2D
- Assembly
- OpenCAD2D.Core.dll
Looks up the plot style of the items of a plot, as AutoCAD plots with a plot style table: with a colour-dependent table (.ctb) the style of the item's colour of AutoCAD's index; with a named one (.stb) the style named by the item's entity or, ByLayer, by its layer, Normal where none is named. It is made once for a plot (Create(CadDocument, CadPlotSettings)) and read for each item (PenFor(DisplayItem2)).
public sealed class CadPlotStyleResolver
- Inheritance
-
CadPlotStyleResolver
- Inherited Members
Remarks
An item of a colour of the index takes the style of that index, as the display item carries it (resolved ByLayer and ByBlock as the display does): colour 10 has the RGB of colour 1 (255, 0, 0) and plots with its own style, 0.50 mm where the table gives colour 1 0.13 mm. A colour that is not one of AutoCAD's 255 (a true colour) takes the style of the index nearest it, and plots in its own colour where the style's colour is the object's. An object's white (colour 7 on a dark screen, or within 2 per cent of it) plots black where the style's colour is the object's, as on the white sheet; a colour the style sets plots as it is set, white too.
A named style is found for an item by its entity's group 380 and 390 (0 or none: ByLayer, 1: ByBlock, taken as Normal, 2: Normal, 3: the entry of the drawing's ACAD_PLOTSTYLENAME the handle names) and then the layer's group 390; the items of a block reference share its entity, so a reference given a style gives it to all it draws, and one that is ByLayer lets each item take its own layer's. A drawing with no entry of that name, or no dictionary, plots Normal. Where no table is named, or its file is not found and is none of the built-in ones, the plot is as before tables were files: Map(CadPlotStyleTable, int) of the legacy table the name stands for.
A resolver keeps what it has looked up and is not safe to use from two threads: each plot makes its own.
Properties
- IsNamed
Gets whether the table is a named one: styles are found by the name an item's entity or layer gives.
- Sheet
Gets the table the plot reads; null where there is none, or it was not found and the colours go through the three legacy tables' rules.
Methods
- Create(CadDocument, CadPlotSettings)
Makes the resolver of a plot: the table the settings name (EffectiveStyleSheet), read from the document's PlotStyleFolder.
- Create(CadDocument, string)
Makes the resolver of a table of a document's folder, by its file name.
- PenFor(DisplayItem2)
Gets the pen of an item: its colour, and what its style sets.
- PenFor(int, string, string)
Gets the pen of an object of a colour, a layer and an entity.
- PlottedColor(int)
Gets the colour an object of a colour plots in where it has no plot style of its own to name: through the style of the colour in a colour-dependent table, Normal's in a named one.
- StyleNameOf(string, string)
Gets the name of the plot style an entity on a layer has in a drawing of named plot styles: its own where it names one, else its layer's, else Normal.