Results 1 to 8 of 8

Thread: "invalid owner object" Error

  1. #1
    Active Member
    Join Date
    2008-07
    Posts
    78
    Login to Give a bone
    0

    Default "invalid owner object" Error

    Has anyone successfully used the CopyObjects method?

    I get an error "Invalid Owner Object" when I run this:
    Code:
        Dim objContainFile As AcadDocument
        Dim CopyObjects(1) As AcadBlock
     
        Set objContainFile = ThisDrawing.Application.Documents.Open("T:\Border.dwg")
     
        Set CopyObjects(0) = objContainFile.Blocks.Item("WD_M")
        Set CopyObjects(1) = objContainFile.Blocks.Item("WD_PNLM")
     
        objContainFile.CopyObjects CopyObjects, ThisDrawing.Blocks
    Anyone know what that means? Help files don't seem to be very helpful.

    Thanks

  2. #2
    Active Member
    Join Date
    2007-06
    Posts
    97
    Login to Give a bone
    0

    Default Re: "invalid owner object" Error

    What if this change were made:

    Dim CopyObjects(1) As Object

  3. #3
    Active Member
    Join Date
    2008-07
    Posts
    78
    Login to Give a bone
    0

    Default Re: "invalid owner object" Error

    Quote Originally Posted by seant61 View Post
    What if this change were made:

    Dim CopyObjects(1) As Object
    Unfortunately not. Still the same

  4. #4
    Active Member
    Join Date
    2007-06
    Posts
    97
    Login to Give a bone
    0

    Default Re: "invalid owner object" Error

    This is interesting. It seems there is a rather unintuitive setup required. Try:

    Code:
    . . . .
    Dim RecieverDocSpace As AcadBlock
    . . . . 
    
       Set RecieverDocSpace = ThisDrawing.ModelSpace
       Set objContainFile = ThisDrawing.Application.Documents.Open("T:\Border.dwg") 'now becomes ThisDrawing
    
    . . . . 
       
       objContainFile.CopyObjects CopyObjects, RecieverDocSpace 'Transfered to original drawings Blocks, will need insert to actually show in MS

  5. #5
    Active Member
    Join Date
    2008-07
    Posts
    78
    Login to Give a bone
    0

    Default Re: "invalid owner object" Error

    Quote Originally Posted by seant61 View Post
    This is interesting. It seems there is a rather unintuitive setup required. Try:

    Code:
    . . . .
    Dim RecieverDocSpace As AcadBlock
    . . . . 
     
       Set RecieverDocSpace = ThisDrawing.ModelSpace
       Set objContainFile = ThisDrawing.Application.Documents.Open("T:\Border.dwg") 'now becomes ThisDrawing
     
    . . . . 
     
       objContainFile.CopyObjects CopyObjects, RecieverDocSpace 'Transfered to original drawings Blocks, will need insert to actually show in MS
    Hi seant61,

    Thanks for that...it is rather unintuitive isn't it

    The message has gone away now but it still doesn't work with regard to copying the blocks across, so thats something i'll have to look into.

    Thanks again

  6. #6
    Active Member
    Join Date
    2008-07
    Posts
    78
    Login to Give a bone
    0

    Angry Re: "invalid owner object" Error

    Well this is what I have so far...
    Code:
        Set RecieverDocSpace = ThisDrawing.ModelSpace
        Set objContainFile = ThisDrawing.Application.Documents.Open("T:\BLBorder.dwg")
     
        Set CopyObjects(0) = objContainFile.Blocks.Item("WD_M")
        Set CopyObjects(1) = objContainFile.Blocks.Item("WD_PNLM")
     
        retvar = objContainFile.CopyObjects(CopyObjects, RecieverDocSpace)
     
        objContainFile.Close False
    Although it doesn't bring up the original error, it does not copy the blocks either!!

    As far as I can see I have done everything in the help files and what seant61was kind enough to suggest but I just cannot see what the problem is!!

    Anyone any further ideas?

  7. #7
    Active Member
    Join Date
    2007-06
    Posts
    97
    Login to Give a bone
    0

    Default Re: "invalid owner object" Error

    To clarify, the lines of code in my last post only transferred the items in “CopyObjects” (presumably blocks WD_M and WD_PNLM) from objContainFile to the original documents Block collection.

    The part that is a bit odd is that the transfer required access to the collection through Modelspace – the blocks have not been inserted into Modelspace. At this stage the blocks are ready for insertion i.e., are visible only as options from the INSERT command.

    To actually insert them via code would require:
    Code:
    Dim entRef As AcadBlockReference
    Dim dblInsPt(0 to 2) as Double
    
     . . . .
    
    Set entRef = ThisDrawing.ModelSpace.InsertBlock(dblInsPt, " WD_M", 1#, 1#, 1#, 0#)

  8. #8
    Active Member
    Join Date
    2008-07
    Posts
    78
    Login to Give a bone
    0

    Default Re: "invalid owner object" Error

    Quote Originally Posted by seant61 View Post
    To clarify, the lines of code in my last post only transferred the items in “CopyObjects” (presumably blocks WD_M and WD_PNLM) from objContainFile to the original documents Block collection.

    The part that is a bit odd is that the transfer required access to the collection through Modelspace – the blocks have not been inserted into Modelspace. At this stage the blocks are ready for insertion i.e., are visible only as options from the INSERT command.

    To actually insert them via code would require:
    Code:
    Dim entRef As AcadBlockReference
    Dim dblInsPt(0 to 2) as Double
     
     . . . .
     
    Set entRef = ThisDrawing.ModelSpace.InsertBlock(dblInsPt, " WD_M", 1#, 1#, 1#, 0#)
    Oh!! I see now!!

    I shall try inserting the blocks and see how I get on.

    Thanks

Similar Threads

  1. Replies: 5
    Last Post: 2011-11-11, 11:53 AM
  2. error message "invalid uri"
    By tomcarver in forum AutoCAD General
    Replies: 1
    Last Post: 2011-02-28, 05:02 PM
  3. Replies: 7
    Last Post: 2006-07-24, 08:57 AM
  4. ERROR: "INVALID I/O TYPE OR PORT NAME"
    By madcadder in forum AutoCAD Plotting
    Replies: 3
    Last Post: 2005-03-15, 07:15 PM
  5. Delete Sweep Error - "Base sketch for roof is invalid"
    By slmaher in forum Revit Architecture - General
    Replies: 1
    Last Post: 2005-02-03, 12:31 AM

Posting Permissions

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