关于编辑填充图案 (VBA/ActiveX)
您可以更改现有填充图案的角度或间距,也可以将其替换为实体填充或 AutoCAD 提供的预定义图案之一。 “边界填充线”(Boundary Hatch) 对话框中的“图案”(Pattern) 选项将显示这些图案的列表。为了减小文件大小,在图形中将填充定义为单个图形对象。 使用以下属性和方法来编辑填充图案:
更改图案填充的图案间距本示例创建一个填充。然后,它将填充的当前图案间距增加 2。 Sub Ch4_ChangeHatchPatternSpace() 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 loop for the hatch. Dim outerLoop(0 To 0) As AcadEntity Dim center(0 To 2) As Double Dim radius As Double center(0) = 5 center(1) = 3 center(2) = 0 radius = 3 Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius) hatchObj.AppendOuterLoop (outerLoop) hatchObj.Evaluate ' Change the spacing of the hatch pattern by ' adding 2 to the current spacing hatchObj.patternSpace = hatchObj.patternSpace + 2 hatchObj.Evaluate ThisDrawing.Regen True End Sub |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 11:35
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.