找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1522|回复: 1

[分享]:获得参照块xref的路径...

[复制链接]
发表于 2008-12-18 18:55:17 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×

  1. [FONT=courier new]
  2. How to get the path of an inserted xref?  
  3. ID    33923  
  4. Applies to:    AutoCAD 2000

  5. This document is part of    Block Reference   COM-ActiveX Interfaces   VBA   Xrefs     


  6. Question
  7. How can I get the path of an attached (inserted) external reference (xref) with
  8. ActiveX?
  9. Answer
  10. Use the ObjectIdToObject to reference an AcadBlockReference to an
  11. AcadExternalReference object. The external reference object has a path property
  12. that will return the path of the Xref.

  13. Here is a VBA example:
  14. Public Sub getXrefPath()
  15.   ' Declare two variables for a block reference and external reference
  16.    Dim pt As ACAD_POINT
  17.    Dim ob As AcadObject
  18.    Dim xR As AcadExternalReference
  19.             
  20.    ' Select an Object in AutoCAD
  21.    ThisDrawing.Utility.GetEntity ob, pt, "Select an XREF: "
  22.    
  23.    If (ob.ObjectName = "AcDbBlockReference") Then
  24.    
  25.         On Error GoTo TypeError
  26.        
  27.             ' Reference an AcDbBlockReference
  28.             Set xR = ob
  29.             ' Print the path in the immediate window
  30.             MsgBox xR.Path
  31.             Exit Sub
  32.             
  33. TypeError:
  34.             MsgBox "This is not an XREF!"
  35.             Exit Sub
  36.             
  37.         Resume Next
  38.        
  39.    Else
  40.    
  41.         MsgBox "This entity is of type: " + ob.ObjectName
  42.        
  43.    End If
  44. End Sub[/FONT]
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 10个

财富等级: 恭喜发财

发表于 2020-9-23 01:53:32 | 显示全部楼层
thank for code
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-6-8 07:21 , Processed in 0.353457 second(s), 34 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表