[VBA]图案填充[Hatch]出错!
<FONT id=text1 style="FONT-SIZE: 10pt" face="宋体,verdana, arial, helvetica"><FONT color=#ff0000>自己写了一个填充图案的过程,如下:</FONT><BR><BR><FONT color=#1111ee>Sub aaa()<BR>Dim dd As AcadHatch<BR>Dim s As AcadSelectionSet<BR>Dim obj() As AcadEntity<BR>Dim i As Long<BR><BR>' On Error Resume Next<BR><BR>ThisDrawing.SelectionSets.Item("fda").Delete<BR>Set s = ThisDrawing.SelectionSets.Add("fda")<BR><BR>s.SelectOnScreen<BR><BR>If s.Count > 0 Then<BR>ReDim Preserve obj(s.Count)<BR>For i = 0 To s.Count - 1<BR>Set obj(i) = s.Item(i)<BR>Next<BR>End If<BR><BR>Set dd = ThisDrawing.ModelSpace.AddHatch(0, "SOLID", True)<BR><BR><FONT color=#55aa99>dd.AppendOuterLoop obj<BR></FONT>dd.Evaluate<BR>ThisDrawing.Regen acActiveViewport<BR>End Sub<BR></FONT><BR><BR><FONT color=red>当运行上面的函数,总是提示-2147418133错误,方法“AppendOuterLoop”作用于对象“IAcadHatch”时失败!<BR>不知道是那里出错了,请各位大虾指点!</FONT></FONT> <BR> <FONT color=#1111ee size=2>ReDim Preserve obj(s.Count-1)</FONT><BR> 楼上的好像不对吧! 你再试试看,我运行完全正确啊!
页:
[1]