Author Topic: LISP similar to "BLOCK" command  (Read 4289 times)

0 Members and 1 Guest are viewing this topic.

d2010

  • Bull Frog
  • Posts: 326
Re: LISP similar to "BLOCK" command
« Reply #15 on: August 14, 2020, 07:07:33 AM »
Thank you again.

http://lisp2arx.3xforum.ro/post/148/pp_entblock_eterracad_vlax_-_Convert_selection_to_Blocks/

New Tips  & Hints
1)Always you add (princ) after (entmake...)
2) Warning . The Dimenstion/s can not re-make inside Blocks
Code: [Select]
Command: stb
GiveMe LayerName forBrlock<0>:0
Select objects: Specify opposite corner: 153 found
Select objects:

Insertion point:
Invalid complex object.
Invalid complex object.
Invalid complex object.
Invalid complex object.
Invalid complex object.
Invalid complex object.
Invalid complex object.
Invalid complex object.
Erase old entities(y.yes)(n.no)(d.yes-da)(c.ci-yes): Y*Cancel*
3)You  see here two version (autofcol_ldc1 ll all entities will be set newcolor for inside Block).
« Last Edit: August 14, 2020, 07:31:23 AM by d2010 »

like_citrus

  • Newt
  • Posts: 114
Re: LISP similar to "BLOCK" command
« Reply #16 on: August 14, 2020, 08:34:05 AM »
@d2010, there's a lot there and I can't understand it, what is it for?
Is the comment "2) Warning . The Dimenstion/s can not re-make inside Blocks" equivalent to "Note that with the proposed method, entget-entmake cloning, all associative relations between the selected objects will be lost." from @roy_043?
Thanks for sending anyway.

d2010

  • Bull Frog
  • Posts: 326
Re: LISP similar to "BLOCK" command
« Reply #17 on: August 14, 2020, 08:40:08 AM »
« Last Edit: August 17, 2020, 06:44:56 AM by d2010 »

like_citrus

  • Newt
  • Posts: 114
Re: LISP similar to "BLOCK" command
« Reply #18 on: August 26, 2020, 01:53:23 AM »
@ronjop
I've noticed that when copying and pasting between 2 drawings with the same block names, there are issues.
I expected the block from the source drawing to be pasted, but if there are common names with the recipient drawing, then the block in the recipient drawing is pasted.
Is there a way to make the name with the "A$" random format as when done when you copy and paste as block using the cell menu commands.
This way names are unique.

like_citrus

  • Newt
  • Posts: 114
Re: LISP similar to "BLOCK" command
« Reply #19 on: August 28, 2020, 03:39:49 AM »
This seemed to work, use the date function.

Replace
Code: [Select]
(while (tblobjname "block" (setq nm (strcat "Block-" (itoa (setq i (1+ i)))))))
With
Code: [Select]
(while (tblobjname "block" (setq nm (strcat "Block-" (rtos (getvar "cdate") 2 4)))))

ronjonp

  • Needs a day job
  • Posts: 7527
Re: LISP similar to "BLOCK" command
« Reply #20 on: August 28, 2020, 02:07:53 PM »
This seemed to work, use the date function.

Replace
Code: [Select]
(while (tblobjname "block" (setq nm (strcat "Block-" (itoa (setq i (1+ i)))))))
With
Code: [Select]
(while (tblobjname "block" (setq nm (strcat "Block-" (rtos (getvar "cdate") 2 4)))))
Glad you got this sorted!  :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC