Evaluate Example

Using Programming Languages other than VBA

Sub Example_Evaluate()
	' This example creates an associative hatch in model space.
	' It uses the Evaluate method to calculate the hatch
	' lines for the given boundary.

	Dim hatchObj As AcadHatch
	Dim patternName As String
	Dim PatternType As Long
	Dim bAssociativity As Boolean

	' Define the hatch
	patternName = "ANSI31"
	PatternType = 0
	bAssociativity = True

	' Create the associative Hatch object in model space
	Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

	' Create the outer boundary for the hatch. (a circle)
	Dim outerLoop(0 To 0) As AcadEntity
	Dim center(0 To 2) As Double
	Dim radius As Double
	center(0) = 3: center(1) = 3: center(2) = 0
	radius = 1
	Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)

	' Append the outerboundary to the hatch object, and display the hatch
	hatchObj.AppendOuterLoop (outerLoop)
	ThisDrawing.Regen True

End Sub