access the members of a INSERT-entity

Discussion in 'AutoCAD' started by FloriB, Jul 31, 2003.

  1. FloriB

    FloriB Guest

    hello, i hope someone can help me with this problem. want to access the items that are included in a block (INSERT). but therefore i need to get the address of those items (dxf-code -1). already tried it this way: (setq memberitem (entnext blockitem))
    but it didn't work.
    does anyone have a solution?
     
    FloriB, Jul 31, 2003
    #1
  2. First, are you sure you want to access the entities within
    the INSERT or do you want to access the entities within
    the block definition that make up the INSERT? In either
    case the following function will work. Just feed it the ename
    of a block or insert.

    ; Jason Piercey . June 2nd, 2003
    ; get list of sub entity names
    ; [ename] - entity name or vla-object - block, insert or polyline
    ; [filter] - string, re: wcmatch()
    ; return: list of enames or nil
    ; revised: July 10th, 2003 - accepts ename or vla-object
    (defun nEnts (ename filter / data ent rtn)
    (or (= 'ename (type ename))
    (setq ename (vlax-vla-object->ename ename)) )
    (setq filter (strcase filter))
    (while (and ename (setq ename (entnext ename)))
    (setq data (entget ename))
    (setq ent (cdr (assoc 0 data)))
    (if (wcmatch ent filter)
    (setq rtn (cons ename rtn)) )
    (if (= "SEQEND" ent) (setq ename nil))
    )
    (reverse rtn)
    )

    For an insert:
    (nEnts (car (entsel "\nselect an insert: ")) "*")

    For a block definition of an insert
    (setq name (cdr (assoc 2 (entget (car (entsel "\nselect an insert: "))))))
    (nEnts (tblobjname "block" name) "*")

    PS: the above example were typed on the fly, so it
    wouldn't hurt to check them over.

    --

    -Jason
    Member of the Autodesk Discussion Forum Moderator Program


    included in a block (INSERT). but therefore i need to get the address of those items
    (dxf-code -1). already tried it this way: (setq memberitem (entnext blockitem))
     
    Jason Piercey, Jul 31, 2003
    #2
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.