How to find parent & Child Relation ship of Xrefs in a drawing

How to find parent & Child Relation ship of Xrefs in a drawing

Anonymous
Not applicable
1,519 Views
3 Replies
Message 1 of 4

How to find parent & Child Relation ship of Xrefs in a drawing

Anonymous
Not applicable
HI

I am trying to list out all Xrefs from all drawings in a folder; the problem I face is how to determine the nested xrefs in an xref in the current drawing so that I could have the listing with hirer key such as that in the Xref manager.
I have a code below that gives me the xref names and path but does not tell me if this is a parent or child xref.

For Each tempBlock In ThisDrawing.Blocks
If tempBlock.IsXRef Then
xrlist.AddItem
xrlist.List(colno, 1) = tempBlock.Name
xrlist.List(colno, 2) = tempBlock.Path
End If
Next

Could someone tell me how to find out the parent and child xrefs in a drawing?
0 Likes
1,520 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
In AutoCAD open the DesignCenter and click the Search button.

From the Look For drop-down list, choose Xrefs.



From the drop-down list, choose the original files location.



E.g. C:\Documents and Settings\YourUserName\Desktop\Current\101-Sheets.



In the Search for the Name text box, enter the name of the Xref. You can use wildcards; for example SI*.



If you're really ambitious, you can just put * to search for all the Xrefs on your computer or network.



Click Search Now.



You can take snapshots by hitting the Print Screen/SysRq key and pasting it in Windows Paint, save as *.BMP or JPG.



Also, take a look to the ffollowing tip in the event you want your Xrefs names and paths in your drawing: http://www.cadforum.cz/cadforum_en/qaID.asp?tip=2513



I hope this may help.



Ruben Melara

CAD Manager

JAVITS II Architecture, LLC

New York, NY
0 Likes
Message 3 of 4

Anonymous
Not applicable
Go into the blocks, search for BlockReferences, if found these are nested. You could make a recursive method that does the same on every found nested BlockReference. Then find these Blockreferences in the block-table, that will give you it's path.
BTW keep track of which Block holds the nested Reference.
0 Likes
Message 4 of 4

MakCADD
Advocate
Advocate

Sub Find_Nested_Xrefs()
Dim ParentXref As AcadBlock
Dim NestedXref As AcadBlockReference
Dim xREF As AcadExternalReference

For Each ParentXref In ThisDrawing.Blocks
If ParentXref.IsXRef Then
For Each OBJECT In ParentXref
If OBJECT.EntityName = "AcDbBlockReference" Then
Set NestedXref = OBJECT
If ThisDrawing.Blocks(NestedXref.Name).IsXRef Then
debug.print NestedXref.Name & "-> Nested -> " & ParentXref.Name & vbCr
End If
End If
Next
End If
Next
End Sub

0 Likes