Message 1 of 5
hatch with polyline

Not applicable
01-24-2006
05:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to hatch a box and the code would not work. Am I doing something wrong???
Sub hatchTestlala()
' Define the hatch
Dim hatchObj As AcadHatch
Dim patternName As String
Dim PatternType As Long
Dim bAssociativity As Boolean
' Define the hatch
patternName = "SOLID"
PatternType = 0
bAssociativity = True
' Create the associative Hatch object in model space
Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)
Dim PL(0 To 14)
PL(0) = 1
PL(1) = 1
PL(2) = 0
PL(3) = 1
PL(4) = 5
PL(5) = 0
PL(6) = 5
PL(7) = 5
PL(8) = 0
PL(9) = 5
PL(10) = 1
PL(11) = 0
PL(12) = 1
PL(13) = 1
PL(14) = 0
Dim outerLoop(0 To 0) As AcadEntity
Set outerLoop(0) = ThisDrawing.ModelSpace.AddPolyline(PL)
hatchObj.AppendOuterLoop (outerLoop)
hatchObj.Evaluate
End Sub
Sub hatchTestlala()
' Define the hatch
Dim hatchObj As AcadHatch
Dim patternName As String
Dim PatternType As Long
Dim bAssociativity As Boolean
' Define the hatch
patternName = "SOLID"
PatternType = 0
bAssociativity = True
' Create the associative Hatch object in model space
Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)
Dim PL(0 To 14)
PL(0) = 1
PL(1) = 1
PL(2) = 0
PL(3) = 1
PL(4) = 5
PL(5) = 0
PL(6) = 5
PL(7) = 5
PL(8) = 0
PL(9) = 5
PL(10) = 1
PL(11) = 0
PL(12) = 1
PL(13) = 1
PL(14) = 0
Dim outerLoop(0 To 0) As AcadEntity
Set outerLoop(0) = ThisDrawing.ModelSpace.AddPolyline(PL)
hatchObj.AppendOuterLoop (outerLoop)
hatchObj.Evaluate
End Sub