创建图案填充对象后,可以添加图案填充边界。边界可以是直线、圆弧、圆、二维折线、椭圆、样条曲线和面的任意组合。 添加的第一个边界必须是外部边界,它定义了要由填充填充的最外层边界。若要添加外部边界,请使用方法。AppendOuterLoop 定义外部边界后,可以继续添加内部边界。使用方法添加内部边界。AppendInnerLoop 内部边界定义图案填充内的岛屿。对象如何处理这些岛屿取决于属性的设置。该属性可以设置为以下条件之一:HatchHatchStyleHatchStyle
定义完图案填充后,必须先对其进行评估,然后才能显示图案填充。使用方法执行此操作。Evaluate 创建图案填充对象本示例在模型空间中创建一个关联图案填充。创建图案填充后,可以更改与图案填充关联的圆的大小。图案填充将更改以匹配当前的圆圈大小。 Sub Ch4_CreateHatch() 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 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 outer boundary to the hatch ' object, and display the hatch hatchObj.AppendOuterLoop (outerLoop) hatchObj.Evaluate ThisDrawing.Regen True End Sub |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )
GMT+8, 2024-5-12 17:34
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.