马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- [FONT=courier new]
- How to get the path of an inserted xref?
- ID 33923
- Applies to: AutoCAD 2000
-
- This document is part of Block Reference COM-ActiveX Interfaces VBA Xrefs
- Question
- How can I get the path of an attached (inserted) external reference (xref) with
- ActiveX?
- Answer
- Use the ObjectIdToObject to reference an AcadBlockReference to an
- AcadExternalReference object. The external reference object has a path property
- that will return the path of the Xref.
- Here is a VBA example:
- Public Sub getXrefPath()
- ' Declare two variables for a block reference and external reference
- Dim pt As ACAD_POINT
- Dim ob As AcadObject
- Dim xR As AcadExternalReference
-
- ' Select an Object in AutoCAD
- ThisDrawing.Utility.GetEntity ob, pt, "Select an XREF: "
-
- If (ob.ObjectName = "AcDbBlockReference") Then
-
- On Error GoTo TypeError
-
- ' Reference an AcDbBlockReference
- Set xR = ob
- ' Print the path in the immediate window
- MsgBox xR.Path
- Exit Sub
-
- TypeError:
- MsgBox "This is not an XREF!"
- Exit Sub
-
- Resume Next
-
- Else
-
- MsgBox "This entity is of type: " + ob.ObjectName
-
- End If
- End Sub[/FONT]
|