本帖最后由 作者 于 2008-7-25 21:27:45 编辑
Sub TestHatch() '外边界和内边界 Dim OuterLoop(0) As Object 'AcadEntity Dim innerLoop(0) As Object 'AcadEntity ' 为填充创建外边界边界 Set OuterLoop(0) = CreateCircle ' 为填充创建内边界边界 Set innerLoop(0) = CreateCircle(2.5) Dim HatchObj As Object Dim PatternName As String Dim PatternType As Long Dim bAssociativity As Boolean ' 定义填充 PatternName = "ANSI31" PatternType = 0 bAssociativity = True ' 在模型空间中创建关联填充 Set HatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, PatternName, bAssociativity) HatchObj.AppendOuterLoop (OuterLoop) HatchObj.AppendInnerLoop (innerLoop) HatchObj.PatternScale = 0.25 HatchObj.Lineweight = acLnWtByLwDefault HatchObj.Color = acByBlock HatchObj.Evaluate End Sub ' 创建圆 Public Function CreateCircle(Optional Radius As Double = 3) As Object 'AcadCircle Dim ptBase(0 To 2) As Double ptBase(0) = 0: ptBase(1) = 0: ptBase(2) = 0 Set CreateCircle = ThisDrawing.ModelSpace.AddCircle(ptBase, Radius) End Function |