Results 1 to 10 of 10

Thread: Model space xref layers

  1. #1
    Member
    Join Date
    2006-02
    Posts
    39
    Login to Give a bone
    0

    Default Model space xref layers

    Hi,

    How do I access only the model space xref layers?

    Thanks

  2. #2
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Default Re: Model space xref layers

    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.

  3. #3
    Member
    Join Date
    2006-02
    Posts
    39
    Login to Give a bone
    0

    Default Re: Model space xref layers

    That's good. But how do I get the nested xref layers?

  4. #4
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Default Re: Model space xref layers

    Command: LAYWALK
    Select the xref

  5. #5
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: Model space 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
    Note:
    update to 2011
    I am using ADT 2007 08/06/2008

    PS. If you use any Code I post or Down Load Attachment I would like to know if it was helpful. So please post reply to this thread, on how you use the code or down load. Thank You

  6. #6
    Member jason.bell's Avatar
    Join Date
    2008-02
    Location
    New York
    Posts
    29
    Login to Give a bone
    0

    Default Re: Model space xref layers

    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.

  7. #7
    Member
    Join Date
    2006-02
    Posts
    39
    Login to Give a bone
    0

    Default Re: Model space xref layers

    Quote Originally Posted by jason.bell View Post
    The following will list the xref layer names on the command line. is this what your trying to do?


    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
    That does the work. But what about the nested xref layers?

  8. #8
    Member
    Join Date
    2006-02
    Posts
    39
    Login to Give a bone
    0

    Default Re: Model space xref layers

    Quote Originally Posted by jwanstaett View Post
    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
    I tried the method you mentioned. But it retrieves the xref in the layout too. I need the xrefs only in the model space.

  9. #9
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Default Re: Model space xref layers

    I suppose you could make jason.bell's program ask for an extrenalreferenece within the externalreference.

  10. #10
    Member
    Join Date
    2006-02
    Posts
    39
    Login to Give a bone
    0

    Default Re: Model space xref layers

    Thanks darfnuggi. I solved it.

Similar Threads

  1. Replies: 2
    Last Post: 2014-02-18, 01:25 AM
  2. 2010: XREF block visibility states & Batch plot on Model Space
    By Buh in forum AutoCAD General
    Replies: 1
    Last Post: 2013-08-23, 11:10 AM
  3. Replies: 0
    Last Post: 2011-10-21, 06:44 PM
  4. xref in model or paper space?
    By cadprog in forum VBA/COM Interop
    Replies: 1
    Last Post: 2008-07-24, 04:16 PM
  5. Replies: 3
    Last Post: 2006-09-22, 08:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •