Author Topic: AddToBlock addition so it also works within "Edit Block In-place".  (Read 872 times)

0 Members and 1 Guest are viewing this topic.

dexus

  • Newt
  • Posts: 196
AddToBlock addition so it also works within "Edit Block In-place".
« on: September 13, 2022, 04:25:29 PM »
I've been using the AddToBlock function by Lee Mac.
Which can be found here: http://www.lee-mac.com/addobjectstoblock.html

I thought it would be a good addition if it also worked within the block editor. The "Edit Block In-place" editor that is.
There you can select the grayed out items that are outside of the block and add it to the current block.

In the gif below I tried to show how it works.
Below is the code to be added to AddObjectsToBlockV1-2.lsp on line 49 right after the first cond statement.
Please note it also requires to have these functions loaded: http://www.lee-mac.com/draworderfunctions.html

Code - Auto/Visual Lisp: [Select]
  1.         (   (/= (getvar 'refeditname) "")
  2.                 (if (setq sel (LM:ssget "\nSelect object to copy to current block: " '("_:L")))
  3.                         (progn
  4.                                 (setq sel2 (ssadd))
  5.                                 (repeat (setq idx (sslength sel))
  6.                                         (setq idx (1- idx)
  7.                                               ent (ssname sel idx)
  8.                                               enx (entget ent)
  9.                                         )
  10.                                         (ssadd (entmakex enx) sel2)
  11.                                 )
  12.                                 (LM:movetotop sel2)
  13.                         )
  14.                 )
  15.         )