明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1566|回复: 7

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

[复制链接]
发表于 2004-6-10 21:57:00 | 显示全部楼层 |阅读模式
我编写了以下程序,可是报错????? 请问大家为什末???????????????? Dim hatchObj As AcadHatch
Dim patternName As String
Dim PatternType As Long
Dim PatternScale As Long
Dim bAssociativity As Boolean patternName = "ANSI31"
PatternType = 0
PatternScale = 2
bAssociativity = True Dim outerLoop(0 To 0) As AcadEntity Dim pLineObj12 As AcadLWPolyline
Dim points12(0 To 31) As Double
points12(0) = 82: points12(1) = 150 + dg / 2
points12(2) = 82: points12(3) = 160 + df / 2
points12(4) = 106: points12(5) = 160 + df / 2
points12(6) = 106: points12(7) = 160 + 3 + dg / 2
points12(8) = 109: points12(9) = 160 + dg / 2
points12(10) = 125: points12(11) = 160 + dg / 2
points12(12) = 128: points12(13) = 160 + 3 + dg / 2
points12(14) = 128: points12(15) = 160 + df / 2
points12(16) = 152: points12(17) = 160 + df / 2
points12(18) = 152: points12(19) = 160 + dg / 2 + 3
points12(20) = 155: points12(21) = 160 + dg / 2
points12(22) = 181 - 7: points12(23) = 160 + dg / 2
points12(24) = 184 - 7: points12(25) = 160 + dg / 2 - 3
points12(26) = 184 - 7: points12(27) = 150 + dg / 2
points12(28) = 182 - 7: points12(29) = 148 + dg / 2
points12(30) = 84: points12(31) = 148 + dg / 2 Set outerLoop(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(points12) hatchObj.AppendOuterLoop (outerLoop)
hatchObj.Evaluate
ThisDrawing.Regen True 还有这样执行,剖面线的边界也是剖面线的颜色,请问怎样去掉边界?????
发表于 2004-6-10 22:05:00 | 显示全部楼层
多段线没有闭合,outerLoop(0).closed=true。


边界就多段线,删除即可,outerLoop(0).delete。
发表于 2004-6-10 22:07:00 | 显示全部楼层
hatchObj没有生成 加一句: Set hatchObj = ThisDrawing.ModelSpace.AddHatch(0, "ansi31", False)
 楼主| 发表于 2004-6-10 22:27:00 | 显示全部楼层
Dim hatchObj As AcadHatch
Dim patternName As String
Dim PatternType As Long
Dim PatternScale As Long
Dim bAssociativity As Boolean patternName = "ANSI31"
PatternType = 0
PatternScale = 2
bAssociativity = True Dim outerLoop(0 To 0) As AcadEntity Dim pLineObj12 As AcadLWPolyline
Dim points12(0 To 31) As Double
points12(0) = 82: points12(1) = 150 + dg / 2
points12(2) = 82: points12(3) = 160 + df / 2
points12(4) = 106: points12(5) = 160 + df / 2
points12(6) = 106: points12(7) = 160 + 3 + dg / 2
points12(8) = 109: points12(9) = 160 + dg / 2
points12(10) = 125: points12(11) = 160 + dg / 2
points12(12) = 128: points12(13) = 160 + 3 + dg / 2
points12(14) = 128: points12(15) = 160 + df / 2
points12(16) = 152: points12(17) = 160 + df / 2
points12(18) = 152: points12(19) = 160 + dg / 2 + 3
points12(20) = 155: points12(21) = 160 + dg / 2
points12(22) = 181 - 7: points12(23) = 160 + dg / 2
points12(24) = 184 - 7: points12(25) = 160 + dg / 2 - 3
points12(26) = 184 - 7: points12(27) = 150 + dg / 2
points12(28) = 182 - 7: points12(29) = 148 + dg / 2
points12(30) = 84: points12(31) = 148 + dg / 2
Set outerLoop(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(points12)
Set hatchObj = ThisDrawing.ModelSpace.AddHatch(0, "ansi31", False) outerLoop(0).Closed = True
outerLoop(0).Delete ThisDrawing.Regen True 我将语句改为这样,不报错了。可是没有显示剖面线啊!!!! 怎样解决??????????
发表于 2004-6-10 22:28:00 | 显示全部楼层
hatchObj.AppendOuterLoop (outerLoop)
hatchObj.Evaluate
怎么又丢了呢?晕 另外,感叹和问号太多了
 楼主| 发表于 2004-6-10 22:33:00 | 显示全部楼层
Set outerLoop(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(points12)
Set hatchObj = ThisDrawing.ModelSpace.AddHatch(0, "ansi31", False) outerLoop(0).Closed = True
outerLoop(0).Delete hatchObj.AppendOuterLoop (outerLoop)
hatchObj.Evaluate
ThisDrawing.Regen True
我在后面加上这两句后,就报错了? 怎样解决?
发表于 2004-6-10 23:09:00 | 显示全部楼层
outerLoop(0).Delete放在最后
 楼主| 发表于 2004-6-10 23:20:00 | 显示全部楼层
谢谢L兄弟的多次指点,已经可以了,谢谢!!!!!!!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-28 05:36 , Processed in 0.157284 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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