创建 Hatch 对象后,可以添加填充边界。边界可以是直线、圆弧、圆、二维折线、椭圆、样条和区域的任意组合。 添加的第一个边界必须是外部边界,该边界定义了要由填充填充的最外层限制。若要添加外部边界,请使用该方法。AppendOuterLoop 定义外部边界后,可以继续添加内部边界。使用该方法添加内部边界。AppendInnerLoop 内部边界定义了舱口内的岛屿。对象如何处理这些岛屿取决于属性的设置。该属性可以设置为下列条件之一:HatchHatchStyleHatchStyle
完成填充定义后,必须先对其进行评估,然后才能显示它。使用该方法执行此操作。Evaluate 创建 Hatch 对象本示例在模型空间中创建一个关联填充。创建填充后,可以更改与填充关联的圆的大小。填充将更改以匹配当前的圆圈大小。 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 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:16
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.