明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1461|回复: 3

怎么用vb来控制对cad里的一个四边形进行填充老出问题?

[复制链接]
发表于 2009-1-4 09:35:00 | 显示全部楼层 |阅读模式

这是代码,红色这句老提示不支持该方法,请各位大侠帮看看.小弟不胜感激!!!!!!

Dim insertionpnt1(2) As Double
Dim points5(9) As Double
insertionpnt1(0) = 5000: insertionpnt1(1) = 5000: insertionpnt1(2) = 0
Set blockobj = acadapp.ActiveDocument.Blocks.Add(insertionpnt1, "jiaocha")
Dim hatchobj As AcadHatch
Dim patternname As String
Dim patterntype As Long
Dim bassociativity As Boolean

patterntype = 0
patternname = "SOLID"
bassociativity = True
Set hatchobj = acadapp.ActiveDocument.ModelSpace.AddHatch(patterntype, patternname, bassociativity)

Dim plineobj11 As AcadEntity
points(0) = 5000: points(1) = 5011
points(2) = 5007: points(3) = 5011
points(4) = 5005: points(5) = 5012
points(6) = 5000: points(7) = 5012
Set plineobj11 = blockobj.AddLightWeightPolyline(points)
plineobj11.Closed = True
plineobj11.Update
hatchobj.AppendOuterLoop (plineobj11)
hatchobj.Evaluate
acadapp.ActiveDocument.Regen True

发表于 2011-7-19 14:44:28 | 显示全部楼层
好像你的点没给全,图形未封闭,我想应该改成这样,不知道行不行。
points(0) = 5000: points(1) = 5011
points(2) = 5007: points(3) = 5011
points(4) = 5005: points(5) = 5012
points(6) = 5000: points(7) = 5012
points(8) = 5000: points(9) = 5011
发表于 2011-7-24 17:36:35 | 显示全部楼层
plineobj11.Closed = True ,这就算封闭了 不是这个问题
发表于 2011-7-25 15:34:53 | 显示全部楼层
边界必须是数组
  1. ......
  2. Dim plineobj11(0) As AcadEntity
  3. points(0) = 5000: points(1) = 5011
  4. points(2) = 5007: points(3) = 5011
  5. points(4) = 5005: points(5) = 5012
  6. points(6) = 5000: points(7) = 5012
  7. Set plineobj11(0) = blockobj.AddLightWeightPolyline(points)
  8. plineobj11(0).Closed = True
  9. plineobj11(0).Update
  10. hatchobj.AppendOuterLoop (plineobj11)
  11. ......
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 18:23 , Processed in 0.160019 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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