明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1307|回复: 2

[求助]菜鸟求助_阴影问题

[复制链接]
发表于 2009-3-12 16:50:00 | 显示全部楼层 |阅读模式
<br/>Dim outerLoop(0 To 0) As AcadEntity<br/>Set outerLoop(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(Bb)<br/>'填充封口处()<br/>Dim hatchObj As AcadHatch<br/>Dim patternName As String '填充图案名<br/>Dim PatternScale As Double '填充图案比例<br/>Dim PatternType As Long<br/>Dim Associativity As Boolean<br/><br/>Associativity = True<br/>atternType = 0<br/>patternName = "AR-CONC"<br/>atternScale = 0.02<br/><br/><br/>Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, Associativity)<br/>hatchObj.AppendOuterLoop (outerLoop)<br/>hatchObj.Evaluate<br/>ThisDrawing.Regen True<br/><br/>如果patternname="ansi31"就可以通过,为什么patternName = "AR-CONC"就出现输出不确定的错误呢?<br/>
发表于 2009-3-12 18:05:00 | 显示全部楼层
本帖最后由 作者 于 2009-3-12 18:07:54 编辑

你的代码只有部分,我重写了下测试没有问题,你看看是不是你的其他部分有问题

Sub tttt()
Dim outerLoop(0 To 0) As AcadEntity
Dim sss As AcadLWPolyline
Dim bb(0 To 7) As Double
bb(0) = 0: bb(1) = 0
bb(2) = 100: bb(3) = 0
bb(4) = 100: bb(5) = 100
bb(6) = 0: bb(7) = 100
Set sss = ThisDrawing.ModelSpace.AddLightWeightPolyline(bb)
sss.closed = True
Set outerLoop(0) = sss
'填充封口处()
Dim hatchObj As AcadHatch
Dim patternName As String '填充图案名
Dim PatternScale As Double '填充图案比例
Dim PatternType As Long
Dim Associativity As Boolean

Associativity = True
PatternType = 0
patternName = "AR-CONC"
PatternScale = 0.02


Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, Associativity)
hatchObj.AppendOuterLoop (outerLoop)
hatchObj.Evaluate
ThisDrawing.Regen True

End Sub

另外看看是不是你的范围太大,把填充比例放大试试

 楼主| 发表于 2009-3-13 08:56:00 | 显示全部楼层
X(0) = 0: X(1) = TxtL.Text: X(2) = X(1) + TxtFw.Text: X(3) = X(2) + TxtLw.Text
Y(0) = 0: Y(1) = Y(0) + TxtW.Text

Bb(0) = X(1): Bb(1) = Y(0)
Bb(2) = X(2): Bb(3) = Y(0)
Bb(4) = X(2): Bb(5) = Y(1)
Bb(6) = X(1): Bb(7) = Y(1)
Bb(8) = X(1): Bb(9) = Y(0)

Set sss = ThisDrawing.ModelSpace.AddLightWeightPolyline(bb)
Set outerLoop(0) = sss

大师,有些地方我还是不是很懂,
原代码没改什么地方,只是改了这里就可以了,请指教一下好吗>?
原来的代码
Set outerLoop(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(bb)
修改后
Set sss = ThisDrawing.ModelSpace.AddLightWeightPolyline(bb)
Set outerLoop(0) = sss

为什么加了个二次赋值就可以呢?

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 04:41 , Processed in 0.147877 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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