wensent 发表于 2004-6-10 21:57:00

新手紧急求教5 !!!!!!!!!!!!!

我编写了以下程序,可是报错?????


请问大家为什末????????????????


Dim hatchObj As AcadHatch<BR>Dim patternName As String<BR>Dim PatternType As Long<BR>Dim PatternScale As Long<BR>Dim bAssociativity As Boolean


patternName = "ANSI31"<BR>PatternType = 0<BR>PatternScale = 2<BR>bAssociativity = True


Dim outerLoop(0 To 0) As AcadEntity


Dim pLineObj12 As AcadLWPolyline<BR>Dim points12(0 To 31) As Double<BR>points12(0) = 82: points12(1) = 150 + dg / 2<BR>points12(2) = 82: points12(3) = 160 + df / 2<BR>points12(4) = 106: points12(5) = 160 + df / 2<BR>points12(6) = 106: points12(7) = 160 + 3 + dg / 2<BR>points12(8) = 109: points12(9) = 160 + dg / 2<BR>points12(10) = 125: points12(11) = 160 + dg / 2<BR>points12(12) = 128: points12(13) = 160 + 3 + dg / 2<BR>points12(14) = 128: points12(15) = 160 + df / 2<BR>points12(16) = 152: points12(17) = 160 + df / 2<BR>points12(18) = 152: points12(19) = 160 + dg / 2 + 3<BR>points12(20) = 155: points12(21) = 160 + dg / 2<BR>points12(22) = 181 - 7: points12(23) = 160 + dg / 2<BR>points12(24) = 184 - 7: points12(25) = 160 + dg / 2 - 3<BR>points12(26) = 184 - 7: points12(27) = 150 + dg / 2<BR>points12(28) = 182 - 7: points12(29) = 148 + dg / 2<BR>points12(30) = 84: points12(31) = 148 + dg / 2


Set outerLoop(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(points12)


hatchObj.AppendOuterLoop (outerLoop)<BR>hatchObj.Evaluate<BR>ThisDrawing.Regen True


还有这样执行,剖面线的边界也是剖面线的颜色,请问怎样去掉边界?????

efan2000 发表于 2004-6-10 22:05:00

多段线没有闭合,outerLoop(0).closed=true。


边界就多段线,删除即可,outerLoop(0).delete。

雪山飞狐_lzh 发表于 2004-6-10 22:07:00

hatchObj没有生成


加一句:


Set hatchObj = ThisDrawing.ModelSpace.AddHatch(0, "ansi31", False)<BR>

wensent 发表于 2004-6-10 22:27:00

Dim hatchObj As AcadHatch<BR>Dim patternName As String<BR>Dim PatternType As Long<BR>Dim PatternScale As Long<BR>Dim bAssociativity As Boolean


patternName = "ANSI31"<BR>PatternType = 0<BR>PatternScale = 2<BR>bAssociativity = True


Dim outerLoop(0 To 0) As AcadEntity


Dim pLineObj12 As AcadLWPolyline<BR>Dim points12(0 To 31) As Double<BR>points12(0) = 82: points12(1) = 150 + dg / 2<BR>points12(2) = 82: points12(3) = 160 + df / 2<BR>points12(4) = 106: points12(5) = 160 + df / 2<BR>points12(6) = 106: points12(7) = 160 + 3 + dg / 2<BR>points12(8) = 109: points12(9) = 160 + dg / 2<BR>points12(10) = 125: points12(11) = 160 + dg / 2<BR>points12(12) = 128: points12(13) = 160 + 3 + dg / 2<BR>points12(14) = 128: points12(15) = 160 + df / 2<BR>points12(16) = 152: points12(17) = 160 + df / 2<BR>points12(18) = 152: points12(19) = 160 + dg / 2 + 3<BR>points12(20) = 155: points12(21) = 160 + dg / 2<BR>points12(22) = 181 - 7: points12(23) = 160 + dg / 2<BR>points12(24) = 184 - 7: points12(25) = 160 + dg / 2 - 3<BR>points12(26) = 184 - 7: points12(27) = 150 + dg / 2<BR>points12(28) = 182 - 7: points12(29) = 148 + dg / 2<BR>points12(30) = 84: points12(31) = 148 + dg / 2


<BR>Set outerLoop(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(points12)<BR>Set hatchObj = ThisDrawing.ModelSpace.AddHatch(0, "ansi31", False)


outerLoop(0).Closed = True<BR>outerLoop(0).Delete


ThisDrawing.Regen True


我将语句改为这样,不报错了。可是没有显示剖面线啊!!!!


怎样解决??????????

雪山飞狐_lzh 发表于 2004-6-10 22:28:00

hatchObj.AppendOuterLoop (outerLoop)<BR>hatchObj.Evaluate<BR>怎么又丢了呢?晕


另外,感叹和问号太多了

wensent 发表于 2004-6-10 22:33:00

Set outerLoop(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(points12)<BR>Set hatchObj = ThisDrawing.ModelSpace.AddHatch(0, "ansi31", False)


outerLoop(0).Closed = True<BR>outerLoop(0).Delete


hatchObj.AppendOuterLoop (outerLoop)<BR>hatchObj.Evaluate


<BR>ThisDrawing.Regen True<BR>


我在后面加上这两句后,就报错了?


怎样解决?

雪山飞狐_lzh 发表于 2004-6-10 23:09:00

outerLoop(0).Delete放在最后

wensent 发表于 2004-6-10 23:20:00

谢谢L兄弟的多次指点,已经可以了,谢谢!!!!!!!!!
页: [1]
查看完整版本: 新手紧急求教5 !!!!!!!!!!!!!