Specifies the type of the hatch, classic or gradient.
Supported platforms: Windows only
Read-only: No
Type: AcHatchObjectType enum
The default value of this property is 0, acHatchObject, which creates a classic hatch.
If the value of this property is 1, acGradientObject, a gradient is created by the AddHatch method for hatch creation. If a gradient is created, then PatternType should be AcGradientPatternType and PatternName should contain a gradient pattern name of LINEAR, CYLINDER, INVCYLINDER, SPHERICAL, HEMISPHERICAL, CURVED, INVSPHERICAL, INVHEMISPHERICAL, or INVCURVED.
VBA:
Sub Example_HatchObjectType() ' This example changes the value of the HatchObjectType property. ' The example requires that the active drawing contain an existing hatch. AppActivate ThisDrawing.Application.Caption Dim ent As AcadHatch Dim util As AcadUtility Set util = ThisDrawing.Utility Dim pt As Variant Call util.GetEntity(ent, pt, "Select hatch :") With ent MsgBox "Initial value of HatchObjectType = " & .HatchObjectType .HatchObjectType = acGradientObject .GradientAngle = 3.1415 / 4 .GradientCentered = False .GradientName = "SPHERICAL" Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20") Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20") col1.SetRGB 255, 0, 0 col2.SetRGB 0, 255, 0 .GradientColor1 = col1 .GradientColor2 = col2 MsgBox "New value of HatchObjectType = " & .HatchObjectType End With End Sub
Visual LISP:
(vl-load-com) (defun c:Example_HatchObjectType() ;; This example changes the value of the HatchObjectType property. ;; The example requires that the active drawing contain an existing hatch. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq util (vla-get-Utility doc)) (vla-GetEntity util 'ent 'pt "Select hatch :") (alert (strcat "Initial value of HatchObjectType = " (itoa (vla-get-HatchObjectType ent)))) (vla-put-HatchObjectType ent acGradientObject) (vla-put-GradientAngle ent (/ 3.1415 4)) (vla-put-GradientCentered ent :vlax-false) (vla-put-GradientName ent "SPHERICAL") (setq col1 (vlax-create-object "AutoCAD.AcCmColor.20")) (setq col2 (vlax-create-object "AutoCAD.AcCmColor.20")) (vla-SetRGB col1 255 0 0) (vla-SetRGB col2 0 255 0) (vla-put-GradientColor1 ent col1) (vla-put-GradientColor2 ent col2) (alert (strcat "New value of HatchObjectType = " (itoa (vla-get-HatchObjectType ent)))) (vlax-release-object col1) (vlax-release-object col2) )