How to find a layer name on a item i a selection set ?

Discussion in 'AutoCAD' started by Henrik, Oct 28, 2004.

  1. Henrik

    Henrik Guest

    how do I find the layer on an item i a selection set, I want to get the
    layer witch the text is on, but .....

    My selectionset is ssetobj
    my code so far....

    Dim elem As Object

    Dim bref As AcadText
    Dim acad_blk As AcadBlockReference

    Dim insertionPoint(0 To 2) As Double

    For Each elem In ssetobj

    If elem.EntityName = "AcDbText" Then
    ' MsgBox "det er en tekst"
    Set bref = elem
    ' MsgBox "the text is: " & bref.TextString
    Debug.Print bref.TextString ' print the content of the text



    End If


    Next



    .....thanks Henrik
     
    Henrik, Oct 28, 2004
    #1
  2. Henrik

    Warren M Guest

    Hello Henrik.

    In the code you've shown...

    elem.Layer

    Should return the layer name.

    Hope this helps
    Warren M
     
    Warren M, Oct 28, 2004
    #2
  3. Henrik

    Henrik Guest

    yaah, thanks

    Henrik
     
    Henrik, Oct 28, 2004
    #3
  4. Henrik

    Mikko Guest

    Quick, Cheap and Dirty

    acadDoc.StartUndoMark()
    For Each elem In ssetobj
    Dim explodedObjects As Object
    explodedObjects = elem.explode()
    Dim I As Integer
    For I = 0 To UBound(explodedObjects)
    explodedObjects(I).Update()
    If explodedObjects(I).ObjectName = "AcDbText" Then
    MsgBox(explodedObjects(I).Layer.ToString)
    End If
    Next
    Next
    acadDoc.EndUndoMark()
    acadDoc.SendCommand("undo" & vbCrLf)
     
    Mikko, Oct 28, 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.