feld.spar 发表于 2009-1-4 09:35:00

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

<p>这是代码,红色这句老提示不支持该方法,请各位大侠帮看看.小弟不胜感激!!!!!!</p><p>Dim insertionpnt1(2) As Double<br/>Dim points5(9) As Double<br/>insertionpnt1(0) = 5000: insertionpnt1(1) = 5000: insertionpnt1(2) = 0<br/>Set blockobj = acadapp.ActiveDocument.Blocks.Add(insertionpnt1, "jiaocha")<br/>Dim hatchobj As AcadHatch<br/>Dim patternname As String<br/>Dim patterntype As Long<br/>Dim bassociativity As Boolean</p><p>patterntype = 0<br/>patternname = "SOLID"<br/>bassociativity = True<br/>Set hatchobj = acadapp.ActiveDocument.ModelSpace.AddHatch(patterntype, patternname, bassociativity)</p><p>Dim plineobj11 As AcadEntity<br/>points(0) = 5000: points(1) = 5011<br/>points(2) = 5007: points(3) = 5011<br/>points(4) = 5005: points(5) = 5012<br/>points(6) = 5000: points(7) = 5012<br/>Set plineobj11 = blockobj.AddLightWeightPolyline(points)<br/>plineobj11.Closed = True<br/>plineobj11.Update<br/><font color="#f70909">hatchobj.AppendOuterLoop (plineobj11)</font><br/>hatchobj.Evaluate<br/>acadapp.ActiveDocument.Regen True</p>

bagssr 发表于 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

hgo1984924 发表于 2011-7-24 17:36:35

plineobj11.Closed = True ,这就算封闭了 不是这个问题

woaishuijia 发表于 2011-7-25 15:34:53

边界必须是数组......
Dim plineobj11(0) 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(0) = blockobj.AddLightWeightPolyline(points)
plineobj11(0).Closed = True
plineobj11(0).Update
hatchobj.AppendOuterLoop (plineobj11)
......
页: [1]
查看完整版本: 怎么用vb来控制对cad里的一个四边形进行填充老出问题?