Table of Contents

Method SetHatchPattern

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

SetHatchPattern(DxfHatchPatternType, string)

Gives the HATCH a pattern, as AutoCAD's SetHatchPattern: its type (group 76) and name (2). SOLID fills it solid (70 of 1) and takes out the pattern's angle, scale and lines and any gradient; any other name fills it with a pattern (70 of 0) at the angle and scale it has, its gradient taken out. A pattern made by the user is given its lines, one family at PatternAngle PatternSpace apart, crossed where it is double, as AutoCAD makes them; a pattern of the name it has keeps its lines; the lines of any other pattern are in AutoCAD's pattern file, not in the drawing, and are left out, for AutoCAD to draw the pattern by its name, the count of its lines (78) written as 0, since AutoCAD refuses a file whose pattern HATCH has no 78. Where the drawing's PatternSearchPath finds the pattern in the caller's own files, the HATCH is given its lines from there as AutoCAD 2021 gives them, turned and scaled with it, its name written in capitals and its type that of the file it is found in, and so is a pattern of the name it has that holds no lines; a HATCH in no drawing is given them when it is added to one: a square 30 by 20 given ANSI31 of acadiso.pat holds the one line at 45 degrees, offset (-2.245, 2.245), and explodes to 11 LINEs.

public void SetHatchPattern(DxfHatchPatternType patternType, string patternName)

Parameters

patternType DxfHatchPatternType

Where the pattern comes from.

patternName string

The name of the pattern, as ANSI31; _USER for one made by the user, as AutoCAD names it.

Exceptions

ArgumentNullException

Thrown when the name is null.

ArgumentException

Thrown when the name is empty or has a line break in it.

ArgumentOutOfRangeException

Thrown when the type is not one of DxfHatchPatternType.

InvalidOperationException

Thrown when the HATCH is erased.