nhy12345678 发表于 2008-7-12 16:05:00

[已解决]VBA如何把对象前置或后置呢?

本帖最后由 作者 于 2008-8-11 0:21:54 编辑

请问VBA如何把对象前置或后置呢?也就是改变对象的绘图次序!谢谢大家。

nhy12345678 发表于 2008-8-11 00:20:00

<p>Sub dxzd()'选择对象然后更改绘图次序<br/>&nbsp;&nbsp;&nbsp; Dim ss As AcadSelectionSet<br/>&nbsp;&nbsp;&nbsp; Dim arr() As AcadObject<br/>&nbsp;&nbsp;&nbsp; Dim eDictionary As Object<br/>&nbsp;&nbsp;&nbsp; Dim sentityObj As Object</p><p>&nbsp;&nbsp;&nbsp; Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary<br/>&nbsp;&nbsp;&nbsp; Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")<br/>&nbsp;&nbsp;&nbsp; If sentityObj Is Nothing Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")<br/>&nbsp;&nbsp;&nbsp; End If</p><p>&nbsp;&nbsp;&nbsp; Set ss = ThisDrawing.SelectionSets.Add("ss")<br/>&nbsp;&nbsp;&nbsp; ss.SelectOnScreen</p><p>&nbsp;&nbsp;&nbsp; ReDim arr(0 To (ss.Count - 1)) As AcadObject<br/>&nbsp;&nbsp;&nbsp; For i = 0 To ss.Count - 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set arr(i) = ss.Item(i)<br/>&nbsp;&nbsp;&nbsp; Next<br/>&nbsp;&nbsp;&nbsp; ss.Delete</p><p>&nbsp;&nbsp;&nbsp; sentityObj.MoveToBottom arr'置底<br/>&nbsp;&nbsp;&nbsp; 'sentityObj.MoveToTop '置顶<br/>&nbsp;&nbsp;&nbsp; AcadApplication.Update<br/>End Sub</p>

muzi2005888 发表于 2008-8-14 18:13:00

<p>好久没来了</p><p>来了就有收获</p><p>我顺路问楼上个问题</p><p>就是关于面域(一个非连续的面域,分散开的,但是一个整体)填充</p><p>可以填充就是不能正常显示</p><p>连续的面域的填充就很理想</p><p>不知道我说明白没有</p><p>谢谢</p>

睡醒的蜗牛 发表于 2015-9-10 22:11:28

nhy12345678 发表于 2008-8-11 00:20 static/image/common/back.gif
Sub dxzd()'选择对象然后更改绘图次序&nbsp;&nbsp;&nbsp; Dim ss As AcadSelectionSet&nbsp;&nbsp;&nbsp; D ...

老师,我以前在win8上用cad2006测试你的代码没有错误,现在在win8上cad2006和xp上cad2008测试都提示未找到主键,是怎么回事呢?报错行为:Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
页: [1]
查看完整版本: [已解决]VBA如何把对象前置或后置呢?