Get Block insertion point without selecting it

Discussion in 'AutoCAD' started by Jim Leonard, Aug 9, 2004.

  1. Jim Leonard

    Jim Leonard Guest

    I need to get the insertion point of a specific block so I can insert
    additional blocks based on its insertion point. The block name is
    consistently the same. Any ideas on how I would go about this?
     
    Jim Leonard, Aug 9, 2004
    #1
  2. Jim Leonard

    T.Willey Guest

    If you know the name, just search the drawing data base using (ssget "x" with your filters. But if it is inserted more then once you will have to step through each one and grab the (cdr (assoc 10 for each block.

    Tim
     
    T.Willey, Aug 9, 2004
    #2
  3. Jim Leonard

    Jürg Menzi Guest

    Hi Jim

    Code:
    (defun GetBlockPoints (Nme / CurEnt CurSet FltLst InsLst)
    (setq FltLst (list (cons 0 "INSERT") (cons 2 Nme)))
    (if (setq CurSet (ssget "X" FltLst))
    (while (setq CurEnt (ssname CurSet 0))
    (setq InsLst (cons (cdr (assoc 10 (entget CurEnt))) InsLst))
    (ssdel CurEnt CurSet)
    )
    )
    (reverse InsLst)
    )
    
    Use:
    (GetBlockPoints "BlockNameToFind")
    returns a list of all inserted blocks with this name or nil if nothing found

    Cheers
     
    Jürg Menzi, Aug 10, 2004
    #3
  4. Jim Leonard

    Juerg Menzi Guest

    Typo...
    must be
    returns a list of insertion points from all inserted blocks with this name or nil if nothing found.

    Cheers
     
    Juerg Menzi, Aug 10, 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.