updBLK and attributes?

Discussion in 'AutoCAD' started by GARYNTX, Aug 30, 2004.

  1. GARYNTX

    GARYNTX Guest

    I got a function from this discussion group that takes one block and copies its entities to another block. This seems to work fine, except that when attributes are involved, The new block acts as if they are not there. Am I doing something wrong or is there another way around this?


    Private Function updBlk(strFile As String, oBlock) As Boolean
    Dim dbxDwg As AxDbDocument, blkObjs() As AcadObject
    Dim iMSCount As Integer, i As Integer
    On Error GoTo err_handler
    'open remote file
    Set dbxDwg = New AxDbDocument
    'Set dbxDwg = Application.GetInterfaceObject("ObjectDBX.AxDbDocument.16")
    dbxDwg.Open strFile
    iMSCount = dbxDwg.ModelSpace.Count - 1
    'store the block object(s) in an array
    ReDim blkObjs(0 To iMSCount)
    For i = 0 To iMSCount
    Set blkObjs(i) = dbxDwg.ModelSpace(i)
    Next i
    'Deepclone the objects into the block
    dbxDwg.CopyObjects blkObjs(), oBlock
    updBlk = True

    exit_sub:
    Set dbxDwg = Nothing
    Exit Function

    err_handler:
    updBlk = False
    'Debug.Print Err.Description
    Err.Clear
    Resume exit_sub
    End Function
     
    GARYNTX, Aug 30, 2004
    #1
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.