Author Topic: Get all blocks in modelspace except XREF, how?  (Read 9822 times)

0 Members and 1 Guest are viewing this topic.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Get all blocks in modelspace except XREF, how?
« Reply #15 on: March 16, 2011, 08:40:46 AM »
Hi,

To get block references w/out using ssget, you can use gc:GetReferences.

In the following example returns a list of all block references inserted in model space.
The list type is: ((blockName1 (refEname refEname ...)) (blockName2 (refEname refEname ...)))

Code: [Select]
((lambda (/ name refs blst)
   (while (setq bl (tblnext "block" (not bl)))
     (setq name (cdr (assoc 2 bl)))
     (if (setq refs (gc:GetReferences name 2))
       (setq blst (cons (list name refs) blst))
     )
   )
   blst
 )
)
Nice work, Gile!
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Get all blocks in modelspace except XREF, how?
« Reply #16 on: September 12, 2011, 11:18:17 AM »
well,...by searching one of my post...I see this post..
I know it is an old one..
but no one consider the AI_TABLE as an option.

so, just to add this idea.

Code: [Select]
(ai_table "BLOCK" 4)
Keep smile...

GDF

  • Water Moccasin
  • Posts: 2081
Re: Get all blocks in modelspace except XREF, how?
« Reply #17 on: September 12, 2011, 02:23:36 PM »
well,...by searching one of my post...I see this post..
I know it is an old one..
but no one consider the AI_TABLE as an option.

so, just to add this idea.

Code: [Select]
(ai_table "BLOCK" 4)

Be sure the routine ai_utils.lsp is loaded.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64