delete引起的错误
<p> For ii = 0 To ThisDrawing.ModelSpace.Count - 1<br/> ThisDrawing.ModelSpace(ii).Delete<br/> Next ii</p><p>如果要单独运行这条,想将ModleSpace中所有的实体册除,肯定会出现如下提示."无效的过程调用或参数"</p><p>原因何在.</p><p></p> <p class="1-liner">删除指定对象或一组保存了的图层设置。</p><p class="h1-access"><a href="http://www.mjtd.com/object/acad2004/delete_see_also.htm">参阅</a> | <a href="http://www.mjtd.com/object/acad2004/ex_delete.htm">示例</a></p><p class="Heading-2">语法 </p><p class="syntax">object.Delete </p><p class="element">Object</p><p class="element-desc"><a href="http://www.mjtd.com/object/acad2004/all_drawing_objects.htm">所有图形对象</a>, <a href="http://www.mjtd.com/object/acad2004/idh_block_object.htm">Block</a>, <a href="http://www.mjtd.com/object/acad2004/idh_dictionary_object.htm">Dictionary</a>, <a href="http://www.mjtd.com/object/acad2004/idh_dimstyle_object.htm">DimStyle</a>, <a href="http://www.mjtd.com/object/acad2004/idh_group_object.htm">Group</a>, <a href="http://www.mjtd.com/object/acad2004/idh_hyperlink_object.htm">Hyperlink</a>, <a href="http://www.mjtd.com/object/acad2004/idh_layer_object.htm">Layer</a>, <a href="http://www.mjtd.com/object/acad2004/idh_layerstatemanager.htm">LayerStateManager</a>, <a href="http://www.mjtd.com/object/acad2004/idh_layout_object.htm">Layout</a>, <a href="http://www.mjtd.com/object/acad2004/idh_linetype_object.htm">Linetype</a>, <a href="http://www.mjtd.com/object/acad2004/idh_plotconfiguration_object.htm">PlotConfiguration</a>, <a href="http://www.mjtd.com/object/acad2004/idh_popupmenuitem_object.htm">PopupMenuItem</a>, <a href="http://www.mjtd.com/object/acad2004/idh_pviewport_object.htm">PViewport</a>, <a href="http://www.mjtd.com/object/acad2004/idh_registeredapp_object.htm">RegisteredApplication</a>, <a href="http://www.mjtd.com/object/acad2004/idh_selectionset_object.htm">SelectionSet</a>, <a href="http://www.mjtd.com/object/acad2004/idh_textstyle_object.htm">TextStyle</a>, <a href="http://www.mjtd.com/object/acad2004/idh_toolbar_object.htm">Toolbar</a>, <a href="http://www.mjtd.com/object/acad2004/idh_toolbaritem_object.htm">ToolbarItem</a>, <a href="http://www.mjtd.com/object/acad2004/idh_ucs_object.htm">UCS</a>, <a href="http://www.mjtd.com/object/acad2004/idh_view_object.htm">View</a>, <a href="http://www.mjtd.com/object/acad2004/idh_viewport_object.htm">Viewport</a>, <a href="http://www.mjtd.com/object/acad2004/idh_xrecord_object.htm">XRecord</a><br/>使用该方法的对象。 </p><p class="Heading-2">说明 </p><p class="body-code-begin">当用户删除集合中的对象时,集合中所有剩余项目会依据目前的计数重新指定新的索引。因此当处理整个集合时,应避免执行删除对象的循环。例如,下面的VBA代码竟会导致执行错误:<br/>For i = 0 To ThisDrawing.Groups.Count - 1<br/> ThisDrawing.Groups.Item(i).Delete<br/>Next I<br/></p><p class="body-code-begin">相反,用下列VBA程序代码可删除集合中的所有对象:</p><pre class="code">for each obj in ThisDrawing.Groupsobj.Delete
next obj
</pre><p class="body-code-begin">用户也可以使用下列VBA程序代码来删除集合中单一的成员:</p><pre class="code">ThisDrawing.Groups.item("group1").Delete
</pre><p class="body">假如用户试图删除集合对象,将导致错误产生。 </p><p class="body">ToolbarItem: 用户只能在工具栏为可见时才可以加入或删除工具栏项目。 </p><p class="body">AcadLayerStateManager: 该对象带有一个Name的参数,它是一个表示将要删除的图层状态的字符串。<script language="javascript" src="ac.acad_mc.js"></script>
</p><p class="body"><a href="http://www.mjtd.com/object/acad2004/idh_delete.htm">http://www.mjtd.com/object/acad2004/idh_delete.htm</a></p>
页:
[1]