指定图案填充的类型:经典或渐变。 支持的平台:仅窗口 属性值只读:不 类型:枚举AcHatchObjectType
言论此属性的默认值为 0,,这将创建经典图案填充。acHatchObject 如果此属性的值为 1,则通过用于创建图案填充的方法创建渐变。如果创建了渐变,则应包含线性、圆柱、圆柱、球形、半球形、弯曲、半球形、半球形或弯曲的渐变图案名称。acGradientObjectAddHatchPatternTypeAcGradientPatternTypePatternName 例子工 务 局: 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." & Left(AcadApplication.Version, 2)) Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor." & Left(AcadApplication.Version, 2)) 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 (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2)))) (setq col2 (vlax-create-object (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2)))) (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) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:42
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.