Accessing Xref Filenames
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Accessing Xref Filenames

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
Edward Bagby
Guest





Posted: Fri Apr 01, 2005 10:26 pm    Post subject: Accessing Xref Filenames Reply with quote

I want to get the actual filename of the attached xref in a drawing, not the
xref "name"

In my case the actual filename and xref name is different. How can I get
this info?

The structure of my code is basically:

Dim xref As AcadBlock
Dim strXRefFileName As String

For Each xref In ThisDrawing.Blocks

If xref.IsXRef Then

strXRefFileName = [Need to get xref filename here]

End If

Next


Thank you for the help.

Edward

Back to top
Jeff Mishler
Guest





Posted: Fri Apr 01, 2005 10:45 pm    Post subject: Re: Accessing Xref Filenames Reply with quote

The path is stored with the actual insert of the block. Expanding on your
code:

Dim blk As AcadBlock
Dim xref As AcadExternalReference
Dim ss As AcadSelectionSet
Dim iCode(1) As Integer
Dim vVal(1) As Variant
Dim strXRefFileName As String

Set ss = ThisDrawing.PickfirstSelectionSet
iCode(0) = 0: iCode(1) = 2
vVal(0) = "INSERT"
For Each blk In ThisDrawing.Blocks

If blk.IsXRef Then
vVal(1) = blk.Name
ss.Select acSelectionSetAll, , , iCode, vVal
If ss.Count > 0 Then
Set xref = ss.Item(0)
strXRefFileName = xref.Path
End If
ss.Clear
Set xref = Nothing
End If

Next



--
Jeff
check out www.cadvault.com
"Edward Bagby" <ebagby@superstructures.com> wrote in message
news:424d844a$1_1@newsprd01...
Quote:
I want to get the actual filename of the attached xref in a drawing, not
the xref "name"

In my case the actual filename and xref name is different. How can I get
this info?

The structure of my code is basically:

Dim xref As AcadBlock
Dim strXRefFileName As String

For Each xref In ThisDrawing.Blocks

If xref.IsXRef Then

strXRefFileName = [Need to get xref filename here]

End If

Next


Thank you for the help.

Edward

Back to top
Edward Bagby
Guest





Posted: Sat Apr 02, 2005 3:43 am    Post subject: Re: Accessing Xref Filenames Reply with quote

Worked like a charm!

This solution seems so inobvious. How did you ever figure that out. It was
not in any documentation that I saw.

Thanks,

Edward


"Jeff Mishler" <jeff_m@cadvault.com> wrote in message
news:424d88b7_2@newsprd01...
Quote:
The path is stored with the actual insert of the block. Expanding on your
code:

Dim blk As AcadBlock
Dim xref As AcadExternalReference
Dim ss As AcadSelectionSet
Dim iCode(1) As Integer
Dim vVal(1) As Variant
Dim strXRefFileName As String

Set ss = ThisDrawing.PickfirstSelectionSet
iCode(0) = 0: iCode(1) = 2
vVal(0) = "INSERT"
For Each blk In ThisDrawing.Blocks

If blk.IsXRef Then
vVal(1) = blk.Name
ss.Select acSelectionSetAll, , , iCode, vVal
If ss.Count > 0 Then
Set xref = ss.Item(0)
strXRefFileName = xref.Path
End If
ss.Clear
Set xref = Nothing
End If

Next



--
Jeff
check out www.cadvault.com
"Edward Bagby" <ebagby@superstructures.com> wrote in message
news:424d844a$1_1@newsprd01...
I want to get the actual filename of the attached xref in a drawing, not
the xref "name"

In my case the actual filename and xref name is different. How can I get
this info?

The structure of my code is basically:

Dim xref As AcadBlock
Dim strXRefFileName As String

For Each xref In ThisDrawing.Blocks

If xref.IsXRef Then

strXRefFileName = [Need to get xref filename here]

End If

Next


Thank you for the help.

Edward





Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB