乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 50|回复: 3

通过VBA使用绘制顺序

[复制链接]

1

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
7
发表于 2006-2-16 04:06:43 | 显示全部楼层 |阅读模式

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

16

主题

168

帖子

39

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
197
发表于 2006-2-16 06:18:07 | 显示全部楼层
您使用的是哪个版本的acad?
我还在欧特克知识库中找到了这http://usa.autodesk.com/adsk/servlet/ps/item?id=2878365&linkID=2475323&siteID=123112。他们提供的解决方案可能适合您通过VBA工作吗?
回复

使用道具 举报

1

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
7
发表于 2006-2-16 06:56:01 | 显示全部楼层

2006
Draworder适用于2006年的xref(至少在我们的办公室是这样的!)
我刚刚意识到我把这个贴在了错误的论坛上,这是一个很好的开始,真是糟糕!:丑陋:
克里斯
回复

使用道具 举报

1

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
7
发表于 2006-2-18 19:54:03 | 显示全部楼层
嗯...有几点。
1.您永远不应该在反应堆/事件中发出“命令”调用。有一件事可能会陷入无休止的循环。
2.在VBA中没有“可靠”的方法来判断命令是否被取消。所以你必须处理“命令结束”事件不会触发的可能性。
3.此外,有人可以进入参考管理器,除了查看列表什么也不做。您的事件会触发,但用户没有附加另一个xref。
我想你可以开始看到这并不像听起来那么容易。
然而,话虽如此,这里有一个非常快速的敲门砖。将其粘贴到“ThisDrawing”模块中并试一试...
  1. Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
  2.     Select Case CommandName
  3.         Case "XREF", "XATTACH"
  4.             ' Get the last entity in the current space. The command *might* not have done anything...
  5.             Dim pEnt As AcadEntity
  6.             Set pEnt = ThisDrawing.CurrentSpace(ThisDrawing.CurrentSpace.Count - 1)
  7.             ' Bail out if it's NOT an xref...
  8.             If Not TypeOf pEnt Is AcadExternalReference Then Exit Sub
  9.             
  10.             'Gxet an extension dictionary and, if necessary, add a SortentsTable object
  11.             Dim pXDict As AcadObject
  12.             Set pXDict = ThisDrawing.CurrentSpace.GetExtensionDictionary
  13.             ' Enable in-line error handling...
  14.             On Error Resume Next
  15.             Dim pSortEntsTbl As AcadSortentsTable
  16.             ' Try and get a pointer to the existing (if there is one) SortEntsTable...
  17.             Set pSortEntsTbl = pXDict.GetObject("ACAD_SORTENTS")
  18.             If Err Then Err.Clear
  19.             If pSortEntsTbl Is Nothing Then
  20.                  ' No SortentsTable object, so add one
  21.                  Set pSortEntsTbl = pXDict.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
  22.             End If
  23.             ' Resume 'normal' error handling...
  24.             On Error GoTo 0
  25.             
  26.             Dim entArray(0) As AcadObject
  27.             Set entArray(0) = pEnt
  28.             
  29.             ' Move the object to the bottom of the draworder...
  30.             pSortEntsTbl.MoveToBottom entArray
  31.             AcadApplication.Update
  32.     End Select
  33. End Sub
  34. Public Property Get CurrentSpace() As AcadBlock
  35.     If ThisDrawing.GetVariable("CVPORT") = 1 Then
  36.         Set CurrentSpace = PaperSpace
  37.     Else
  38.         Set CurrentSpace = ModelSpace
  39.     End If
  40. End Property

BTW,在AutoCAD VBA帮助中查找AcadSortEntsTable。这是Draworder表。
干杯,
Glenn。
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-5 06:26 , Processed in 0.881395 second(s), 60 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表