Edit Hatch Patterns
From AutoCAD ActiveX
You can change the angle or spacing of an existing hatch pattern or replace it with a solid-fill or one of the predefined patterns that AutoCAD offers. The Pattern option in the Boundary Hatch dialog box displays a list of these patterns. To reduce file size, the hatch is defined in the drawing as a single graphic object.
Use the following properties and methods to edit the hatch patterns:
Change the pattern spacing of a hatch
This example creates a hatch. It then adds two to the current pattern spacing for the hatch.
Sub Ch4_ChangeHatchPatternSpace()
Dim hatchObj As AcadHatch
Dim patternName As String
Dim PatternType As Long
Dim bAssociativity As Boolean
' Define the hatchpatternName = "ANSI31"PatternType = 0bAssociativity = True' Create the associative Hatch objectSet hatchObj = ThisDrawing.ModelSpace. _AddHatch(PatternType, patternName, bAssociativity)' Create the outer loop for the hatch.Dim outerLoop(0 To 0) As AcadEntityDim center(0 To 2) As DoubleDim radius As Doublecenter(0) = 5center(1) = 3center(2) = 0radius = 3Set outerLoop(0) = ThisDrawing.ModelSpace. _AddCircle(center, radius)hatchObj.AppendOuterLoop (outerLoop)hatchObj.Evaluate' Change the spacing of the hatch pattern by' adding 2 to the current spacinghatchObj.patternSpace = hatchObj.patternSpace + 2hatchObj.EvaluateThisDrawing.Regen TrueEnd Sub