Hi,
How do I access only the model space xref layers?
Thanks
|
Hi,
How do I access only the model space xref layers?
Thanks
This is a way to get their names. Don't know exactly what you want though.
Code:Public Sub ModelXrefs() Dim Entity As AcadEntity For Each Entity In ThisDrawing.modelSpace If TypeOf Entity Is AcadExternalReference Then MsgBox Entity.Name & " is an xref, inserted on layer " & Entity.Layer & vbCrLf End If Next End Sub
Last edited by darfnuggi; 2008-10-28 at 11:24 AM.
That's good. But how do I get the nested xref layers?
The same way you get to the other layer the xref layer name will be the XrefName|layername
exp: if the xref name is xxx and has a layer name zzz the the layer name will be xxx|zzz
note: The 0 layer for xref will be layer 0
so if you need to get the xref layer, loop thru the drawing layer and get the layers that have the | in them
The following will list the xref layer names on the command line. is this what your trying to do?
Code:Sub xreflayprint() Dim xrefname As String Dim layname As String Dim i As Integer Dim ent As AcadEntity For Each ent In ThisDrawing.ModelSpace If TypeOf ent Is AcadExternalReference Then xrefname = ent.Name For i = 0 To ThisDrawing.Layers.Count - 1 layname = ThisDrawing.Layers.Item(i).Name If InStr(1, layname, xrefname) > 0 Then ThisDrawing.Utility.Prompt layname ThisDrawing.Application.ZoomExtents End If Next i End If Next ThisDrawing.Regen acAllViewports End Sub
Last edited by Ed Jobe; 2008-10-29 at 02:15 PM. Reason: Added Code tags.
I suppose you could make jason.bell's program ask for an extrenalreferenece within the externalreference.