finding "space" of BlockRef

Discussion in 'AutoCAD' started by Nathan Withers, Jun 11, 2004.

  1. Is there a way to find the "space" or layout of a BlockRef using only
    ActiveX? I know that the DXF code 410 shows this, but I want to know if
    there is a way to do that without going back to vanilla lisp.

    For a little background... I am trying to find a better way to update
    existing INSERTS with attributes than by using ATTSYNC, BATTMAN, or
    ATTREDEF. I want to be able to pick a block, and have all existing INSERTS
    reinserted, while maintaining all attribute information. I have figured out
    just about everything except how to determine which layout the INSERT is in.
     
    Nathan Withers, Jun 11, 2004
    #1
  2. I don't know of a way off the top of my head
    (I looked briefly and didn't notice anything)

    Since you are wanting to stick to activeX, wouldn't
    you already know what layout an insert belongs to?

    I mean, if you are iterating the layout collection
    for specific insert names then just build a list.

    '( (<layoutObject> <insertName> <insertName>) )
     
    Jason Piercey, Jun 11, 2004
    #2
  3. Use this function (see the sample test command function for usage).

    (defun I:BlockRefOnLayout (blkref)
    (vl-load-com)
    (vla-Get-Name
    (vla-Get-Layout (vla-ObjectIDToObject
    (vla-Get-ActiveDocument (vlax-Get-Acad-Object))
    (vla-Get-OwnerID blkref)))))

    (defun C:Test1 (/ ss)
    (setq ss (ssget "X" '((0 . "INSERT") (2 . "TestBlk 1"))))
    (princ (I:BlockRefOnLayout (vlax-EName->vla-Object (ssname ss 0))))
    (princ))


    --
    R. Robert Bell


    Is there a way to find the "space" or layout of a BlockRef using only
    ActiveX? I know that the DXF code 410 shows this, but I want to know if
    there is a way to do that without going back to vanilla lisp.

    For a little background... I am trying to find a better way to update
    existing INSERTS with attributes than by using ATTSYNC, BATTMAN, or
    ATTREDEF. I want to be able to pick a block, and have all existing INSERTS
    reinserted, while maintaining all attribute information. I have figured out
    just about everything except how to determine which layout the INSERT is in.
     
    R. Robert Bell, Jun 12, 2004
    #3
  4. Note how this doesn't needlessly couple to the
    active document. Instead, it uses the database
    of the object that contains it:

    (defun GetLayout (AcadEntity)
    (vla-get-Layout
    (vla-ObjectIdToObject
    (vla-get-Database AcadEntity)
    (vla-get-OwnerId AcadEntity)
    )
    )
    )

    The above gets the Layout object.

    Use (vla-get-Name) on it to get its name.


    --
    http://www.caddzone.com

    AutoCAD based Security Planning Solutions:
    http://www.caddzone.com/securityplanning

    AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
    http://www.acadxtabs.com
     
    Tony Tanzillo, Jun 12, 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.