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