objectdbx and copyblock

Discussion in 'AutoCAD' started by mark, Apr 13, 2004.

  1. mark

    mark Guest

    hi,

    the sample by TT to copy a block definition
    from one drawing to another, is very helpful,
    what if the block already exists and i want
    to update the dfinition...

    TIA
     
    mark, Apr 13, 2004
    #1
  2. Not quite sure if this is the 'correct' way but.....

    you could remove the objects from the existing
    definition and populate it with objects from the
    new definition.
     
    Jason Piercey, Apr 13, 2004
    #2
  3. I wasn't suggesting removing the block definition,
    just removing the contents of the block and then
    replace the contents with the new objects.
     
    Jason Piercey, Apr 13, 2004
    #3
  4. mark

    mark Guest

    intersting idea, will give it a shot...
    i was thinking of renaming the old block,
    then bringing in the new definition under the original name,
    then go thru the entire database, search for the inserts
    and vla-put-name the new block...

    thanks
    mark
     
    mark, Apr 13, 2004
    #4
  5. mark

    Mark Ingram Guest

    Can you post a copy of this, or a link?

    Thanks,
    Mark
     
    Mark Ingram, Apr 14, 2004
    #5
  6. mark

    John Uhden Guest

    If the block definition exists, use CopyObjects from the source definition to
    the current block object. Not sure, but I'd bet you have to vla-delete the
    objects in the current definition, otherwise you'd have both. Do a Google
    search for CloneBlock.
     
    John Uhden, Apr 14, 2004
    #6
  7. mark

    Joe Burke Guest

    John,

    CloneBlock crossed my mind as well. Good example of how to do it, especially since
    it's heavily commented. The subject title is "Duplicate a block definition" dated
    12/31/2003.

    Joe Burke
     
    Joe Burke, Apr 14, 2004
    #7
  8. Copying the defining entities from one block to
    another does not redefine a block.

    You would for example, loose the Block's properties
    like layer and other things like the block icon;
    description; base point; design center data; and
    anything attached to the extension dictionary; etc.

    To redefine a block:

    1. Get _all_ insertions of the block, in the
    destination drawing.

    2. Rename the block in the destination drawing
    (use any name that does not already exist).

    3. Using CopyObjects, copy the new block object,
    rather than its contents, to the destination
    drawing (this works because the existing block
    in the destination drawing was renamed).

    4. Process all insertions of the block gathered
    in step 1, and change the Name property to the
    name of the block that was redefined (renaming
    the block changes the name property, so now you
    must change it to point to the new definition).

    5. Delete the old, renamed block (it shouldn't
    have any references after step 4).
     
    Tony Tanzillo, Apr 14, 2004
    #8
  9. Not really.

    See my other post.
     
    Tony Tanzillo, Apr 14, 2004
    #9
  10. mark

    mark Guest

    Tony,
    thanks, that was the direction i was going
    if you read my answer to JP yesterday...

    before i go further with this, will it be possible
    to redefine a block from a drawing into
    another, none of the 2 drawings being active
    or current...

    thanks again
    mark
     
    mark, Apr 14, 2004
    #10
  11. It depends on whether you can use vlax-vla-object->ename
    on objects in drawings that are not active, and I've
    not confirmed whether that's possible.

    Yes, it can be done exactly as I outlined, when you're
    redefining a block in the active document, but otherwise
    I've not verified if it will work.
     
    Tony Tanzillo, Apr 14, 2004
    #11
  12. mark

    mark Guest

    why would i need vlax-vla-object->ename
    i am going to browse the entire database
    one object at a time, modelspace and layouts,
    and then process them accordingly
    (vlax-for layo (vla-get-layouts interfaceobject)
    (vlax-for itm (vla-get-Block layo)
    (setq obnm (vla-get-objectname itm)) etc....

    thanks
     
    mark, Apr 14, 2004
    #12
  13. Well, you can always do that too, but in a very large
    drawing, it takes much longer than getting the list of
    block references directly from the block.
     
    Tony Tanzillo, Apr 14, 2004
    #13
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.