remove xref name and pipe from the layername to get a string value

Discussion in 'AutoCAD' started by Eugene, Sep 10, 2004.

  1. Eugene

    Eugene Guest

    Hello,

    How can I drop the xref name and pipe symbol from a referenced layer. I don't need to physically change the layername, just get a string variable to compare to our database.

    For example

    If the xref layer name is called XREF|LAYERNAME
    how can I achieve the string value LAYERNAME

    Split? Like? Instr? ?????

    I plan to loop through all layers in a file and not all will be a reference layer and contain a pipe symbol

    Sorry If this is confusing.

    Thanks in advance for your help!

    Eugene
     
    Eugene, Sep 10, 2004
    #1
  2. Eugene

    Matt W Guest

    Actually.... This will work better.
    This will give you just the xref layer names (minus the xref drawing part).

    Sub Test()
    Dim x As AcadLayer
    Dim varLay As Variant
    For Each x In ThisDrawing.Layers
    If x.Name Like (("*") & ("|") & ("*")) Then
    varLay = Split(x.Name, "|", , vbTextCompare)
    Debug.Print varLay(1)
    End If
    Next x
    End Sub


    --
    Matt W

    I love deadlines
    I like the whooshing sound they make as they fly by.

    | Here's a quick, down and dirty way of doing it.
    | By down and dirty I mean I used "On Error Resume Next". :)
    | This will print ALL layers name (xref or not) to the Immediate Window.
    |
    | Sub Test()
    | Dim x As AcadLayer
    | Dim varLay As Variant
    | For Each x In ThisDrawing.Layers
    | On Error Resume Next
    | varLay = Split(x.Name, "|", , vbTextCompare)
    | Debug.Print varLay(1)
    | Next x
    | End Sub
    |
    | --
    | Matt W
    |
    | I love deadlines
    | I like the whooshing sound they make as they fly by.
    |
    | | Hello,
    |
    | How can I drop the xref name and pipe symbol from a referenced layer. I
    | don't need to physically change the layername, just get a string variable
    to
    | compare to our database.
    |
    | For example
    |
    | If the xref layer name is called XREF|LAYERNAME
    | how can I achieve the string value LAYERNAME
    |
    | Split? Like? Instr? ?????
    |
    | I plan to loop through all layers in a file and not all will be a
    reference
    | layer and contain a pipe symbol
    |
    | Sorry If this is confusing.
    |
    | Thanks in advance for your help!
    |
    | Eugene
    |
    |
    |
    |
    |
     
    Matt W, Sep 10, 2004
    #2
  3. Eugene

    Eugene Guest

    I think that's what I'm looking. No offense but, your first reply looked
    like something my fine programming : ) LOL
    I'll wrap this into my code, thanks again!

    -Eugene
     
    Eugene, Sep 10, 2004
    #3
  4. Eugene

    Matt W Guest

    Thaaaaaanks!
    I couldn't let that first one go so I took that other chunk from one of my
    old proggys.

    --
    Matt W

    I love deadlines
    I like the whooshing sound they make as they fly by.

    | I think that's what I'm looking. No offense but, your first reply looked
    | like something my fine programming : ) LOL
    | I'll wrap this into my code, thanks again!
    |
    | -Eugene
    |
    |
    | | > Actually.... This will work better.
    | > This will give you just the xref layer names (minus the xref drawing
    | part).
    | >
    | > Sub Test()
    | > Dim x As AcadLayer
    | > Dim varLay As Variant
    | > For Each x In ThisDrawing.Layers
    | > If x.Name Like (("*") & ("|") & ("*")) Then
    | > varLay = Split(x.Name, "|", , vbTextCompare)
    | > Debug.Print varLay(1)
    | > End If
    | > Next x
    | > End Sub
    | >
    | >
    | > --
    | > Matt W
    | >
    | > I love deadlines
    | > I like the whooshing sound they make as they fly by.
    | >
    | > | > | Here's a quick, down and dirty way of doing it.
    | > | By down and dirty I mean I used "On Error Resume Next". :)
    | > | This will print ALL layers name (xref or not) to the Immediate Window.
    | > |
    | > | Sub Test()
    | > | Dim x As AcadLayer
    | > | Dim varLay As Variant
    | > | For Each x In ThisDrawing.Layers
    | > | On Error Resume Next
    | > | varLay = Split(x.Name, "|", , vbTextCompare)
    | > | Debug.Print varLay(1)
    | > | Next x
    | > | End Sub
    | > |
    | > | --
    | > | Matt W
    | > |
    | > | I love deadlines
    | > | I like the whooshing sound they make as they fly by.
    | > |
    | > | | > | Hello,
    | > |
    | > | How can I drop the xref name and pipe symbol from a referenced layer.
    I
    | > | don't need to physically change the layername, just get a string
    | variable
    | > to
    | > | compare to our database.
    | > |
    | > | For example
    | > |
    | > | If the xref layer name is called XREF|LAYERNAME
    | > | how can I achieve the string value LAYERNAME
    | > |
    | > | Split? Like? Instr? ?????
    | > |
    | > | I plan to loop through all layers in a file and not all will be a
    | > reference
    | > | layer and contain a pipe symbol
    | > |
    | > | Sorry If this is confusing.
    | > |
    | > | Thanks in advance for your help!
    | > |
    | > | Eugene
    | > |
    | > |
    | > |
    | > |
    | > |
    | >
    | >
    |
    |
     
    Matt W, Sep 10, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.