明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1580|回复: 1

[求助]图案填充

[复制链接]
发表于 2006-7-21 17:53:00 | 显示全部楼层 |阅读模式

要填充的区域有圆弧和一些直线(如两个圆弧,两个多线段), 把它设成外环, 首尾相接, 怎么结果不对?请各位指教,说个思路就行.

    Dim hatchObj As AcadHatch
    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)
   
    Dim outerLoop(0 To 3) As AcadEntity 

    Dim ptArr(0 To 15) As Double
    ptArr(0) = 61.4125: ptArr(1) = 127.1766
    ptArr(2) = 80: ptArr(3) = 120.04
    ptArr(4) = 99: ptArr(5) = 120.04
    ptArr(6) = 100: ptArr(7) = 121.04
    ptArr(8) = 100: ptArr(9) = 184.96
    ptArr(10) = 99: ptArr(11) = 185.96
    ptArr(12) = 80: ptArr(13) = 185.96
    ptArr(14) = 61.4152: ptArr(15) = 178.8234

    Dim center1(0 To 2) As Double
    Dim radius1 As Double
    Dim startAngle1 As Double
    Dim endAngle1 As Double
    center1(0) = 65: center1(1) = 169.49: center1(2) = 0
    radius1 = 10
    startAngle1 = 111 * 3.1415926 / 180
    endAngle1 = 3.1415926

    Dim ptArr1(0 To 11) As Double
    ptArr1(0) = 55: ptArr1(1) = 169.4881
    ptArr1(2) = 55: ptArr1(3) = 156.75
    ptArr1(4) = 56: ptArr1(5) = 156.75
    ptArr1(6) = 56: ptArr1(7) = 149.25
    ptArr1(8) = 55: ptArr1(9) = 149.25
    ptArr1(10) = 55: ptArr1(11) = 136.5119

    Dim center2(0 To 2) As Double
    Dim radius2 As Double
    Dim startAngle2 As Double
    Dim endAngle2 As Double
    center2(0) = 65: center2(1) = 136.5119: center2(2) = 0
    radius2 = 10
    startAngle2 = 3.1415926
    endAngle2 = 249 * 3.1415926 / 180

    Set outerLoop(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(ptArr)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddArc(center1, radius1, startAngle1, endAngle1)
    Set outerLoop(2) = ThisDrawing.ModelSpace.AddLightWeightPolyline(ptArr1)
    Set outerLoop(3) = ThisDrawing.ModelSpace.AddArc(center2, radius2, startAngle2, endAngle2)
    hatchObj.AppendOuterLoop (outerLoop)
   
    Dim innerLoop(0 To 0) As AcadEntity
    Dim ptArrr(0 To 9) As Double
    ptArrr(0) = 56: ptArrr(1) = 155
    ptArrr(2) = 71: ptArrr(3) = 155
    ptArrr(4) = 72: ptArrr(5) = 153
    ptArrr(6) = 71: ptArrr(7) = 151
    ptArrr(8) = 56: ptArrr(9) = 151
   
    Set innerLoop(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(ptArrr)
    innerLoop(0).Closed = True
    hatchObj.AppendInnerLoop (innerLoop)
   
    hatchObj.Evaluate
    ThisDrawing.Regen True

 楼主| 发表于 2006-7-22 09:53:00 | 显示全部楼层
请大家帮帮忙,谢谢了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 01:36 , Processed in 0.153921 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表