Access to "SEQUEND" object

Discussion in 'AutoCAD' started by Tony Burba, Jul 13, 2004.

  1. Tony Burba

    Tony Burba Guest

    Does anyone know how to access in VBA the "sequend" object that terminates a
    block or block reference? I've got a program that programatically changes
    the layer of block references, but the "sequend" object layer (why does it
    even need one?) remains the same as before the change; and this prevents the
    old, nonstandard layer from being purged. I'd like to be able to modify the
    layer property of the sequend object. This would be easy in Lisp.
     
    Tony Burba, Jul 13, 2004
    #1
  2. Tony Burba

    MP Guest

    code posted here in past
    sorry dont' remember who posted it
    if someone recognizes it, I'd like to add the credits to my notes
    couldn't find it again through google, but I'm sure i got it here.

    '//GET SEQUENCE END//
    '//While you can pass any entity to this function, only entities
    '//That actually HAVE an end sequence will return an object. All
    '//Others return nothing, so be sure to test the return value
    '//Of this function IE:
    '//Set objSeqEnd = GetSeqEnd(objBlkRef)
    '//If Not objSeqEnd Is Nothing Then

    Public Function GetSeqEnd(objEntity As AcadEntity) As AcadEntity
    Dim objSeqEnd As AcadEntity
    Dim strIHex As String
    Dim strHandle As String
    Dim strLeftHex As String
    Dim strOwner As String
    On Error GoTo Err_Control
    strHandle = objEntity.Handle
    strLeftHex = Left(strHandle, Len(strHandle) - 2)
    strIHex = "&H" & Right(objEntity.Handle, 2)
    Do
    strIHex = strIHex + 1
    Set objSeqEnd = _
    ThisDrawing.HandleToObject(strLeftHex & Hex(strIHex))
    strOwner = objSeqEnd.OwnerID
    If objSeqEnd.ObjectName = "AcDbSequenceEnd" Then
    Set GetSeqEnd = objSeqEnd
    Exit Do
    End If
    'Keep the loop from exceeding the reference members
    Loop Until strOwner <> objEntity.ObjectID
    Exit_Here:
    Exit Function
    Err_Control:
    Select Case Err.Number
    Case -2145386484
    'Not a valid handle
    'So no SeqEnd entity, Exit
    Err.Clear
    Resume Exit_Here
    Case Else
    MsgBox Err.Description
    Err.Clear
    Resume Exit_Here
    End Select
    End Function
     
    MP, Jul 13, 2004
    #2
  3. Tony Burba

    Tony Burba Guest

    That works. Thanks to you and to the original author.
     
    Tony Burba, Jul 14, 2004
    #3
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.