HatchObjectType 属性 (ActiveX)
指定填充线的类型,经典或渐变。 支持的平台:仅限 Windows 属性值只读:不 类型:枚举AcHatchObjectType
言论此属性的默认值为 0, ,这将创建一个经典的填充线。acHatchObject 如果此属性的值为 1, ,则通过创建填充线的方法创建渐变。如果创建了渐变,则应且应包含梯度图案名称 LINEAR、CYLINDER、INVCYLINDER、SPHERICAL、HEMISPHERICAL、CURVED、INVSPHERICAL、INVHEMISPHERICAL 或 INVCURVED。acGradientObjectAddHatchPatternTypeAcGradientPatternTypePatternName 例子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." & 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 可视化 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, 2024-12-15 22:08
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.