Class CadTool
- Namespace
- OpenCAD2D
- Assembly
- OpenCAD2D.Core.dll
A tool of a tool palette: a block to insert, a hatch to lay, a command to run, or a line of text or a separator that
parts the others. A block tool names the block and the drawing it comes from, its scale, rotation, and whether the
scale or rotation is asked on the command line; a hatch tool the pattern, angle and scale; a command tool the command
line it runs. The three kinds that draw also carry what AutoCAD's Tool Properties calls overrides: the layer, colour,
linetype and lineweight the objects it makes are drawn with, each left null to use the current one. A tool is
made with one of the For methods, or from an object of a drawing with FromObject(CadDocument, DxfEntity).
public sealed class CadTool
- Inheritance
-
CadTool
- Inherited Members
Properties
- Angle
Gets or sets the rotation of a block tool's insertion, or the angle of a hatch tool's pattern or gradient, in degrees; 0 until set.
- Associative
Gets or sets whether the hatch a hatch tool makes follows its boundary; true until set.
- BlockName
Gets or sets the name of the block in its drawing; empty, with a File, for the whole drawing inserted as one block.
- Color
Gets or sets the colour of the objects the tool makes: ByLayer, ByBlock or an index 1 to 255 as text; null for the current colour.
- Command
Gets or sets the command line a command tool runs: a command's name or alias, then the answers to its first prompts, parted by spaces or semicolons, as typed (
CIRCLE 0,0 50); a leading^C^Cand an underscore, as a menu macro of AutoCAD writes them, are left off.
- Description
Gets or sets the description shown in the tool's tooltip.
- Explode
Gets or sets whether a block tool explodes what it inserts; false until set.
- File
Gets or sets the drawing a block tool's block comes from; null, or the drawing open, for a block the drawing has. A file that cannot be found falls back to the block of the drawing open of the same name.
- Gradient
Gets or sets the gradient of a hatch tool of the type Gradient, by the name AutoCAD's dialog gives it: GR_LINEAR.
- HasOverrides
Gets whether the tool sets a layer, colour, linetype or lineweight of its own.
- HatchType
Gets or sets what a hatch tool fills with: a pattern, lines of the user's, a solid fill or a gradient.
- Icon
Gets or sets the icon of a command tool, the name of one of the presenter's own: Line, Polyline, Circle, Arc, Text, MText, Rectangle, Ellipse, Spline, Point, Move, Copy, Rotate, Scale, Mirror, Offset, Trim, Extend, Fillet, Chamfer, Stretch, Explode, Erase, Dimension, Aligned, Angular, Radius, Diameter, Leader, Table and the others the ribbon has; null or a name it has not gives the plain command icon.
- Kind
Gets what the tool is; it does not change.
- Layer
Gets or sets the layer the objects the tool makes are on; null for the current layer. A layer the drawing has not is made.
- LineWeight
Gets or sets the lineweight of the objects the tool makes, in hundredths of a millimetre as DXF writes it (25 is 0.25 mm), or -1 for ByLayer, -2 for ByBlock, -3 for the default; null for the current lineweight.
- Linetype
Gets or sets the linetype of the objects the tool makes, as ByLayer, ByBlock or the name of one the drawing has; null for the current linetype.
- Name
Gets or sets the name shown under the tool's icon; for a text tool the words themselves, for a separator empty.
- Pattern
Gets or sets the pattern of a hatch tool of the type Pattern, as ANSI31; one of the presenter's own, or one a support folder of the drawing has.
- PromptForRotation
Gets or sets whether a block tool asks the rotation on the command line, as AutoCAD's Prompt for rotation; false until set.
- PromptForScale
Gets or sets whether a block tool asks the scale on the command line, as AutoCAD's Prompt for scale; false until set.
- Scale
Gets or sets the scale of a block tool's insertion, or of a hatch tool's pattern; 1 until set.
- Spacing
Gets or sets the spacing between the lines of a hatch tool of the type UserDefined; 1 until set.
Methods
- Clone()
Gets a copy, with every setting the tool has.
- ForBlock(string, string, string)
Makes a block tool.
- ForCommand(string, string, string)
Makes a command tool.
- ForHatch(string, string)
Makes a hatch tool of a pattern of the presenter's own set or a support folder, at angle 0 and scale 1.
- ForSeparator()
Makes a separator, a rule between tools.
- ForText(string)
Makes a line of text to part the tools with.
- FromObject(CadDocument, DxfEntity)
Makes a tool of an object of a drawing, as dragging it onto a palette does in AutoCAD: a block reference becomes a block tool (its block, the drawing open as source, the scale of the reference), a hatch a hatch tool (its pattern or fill, angle and scale), and a line, circle, arc, polyline, ellipse, spline, point, text, multiline text or dimension a command tool that runs the command which draws it. Each takes the object's layer, colour, linetype and lineweight as its overrides; a true colour, which a drawing's current colour cannot be, is left unset.