Author Topic: Redefining blocks through lisp  (Read 7465 times)

0 Members and 1 Guest are viewing this topic.

TJAM51

  • Guest
Redefining blocks through lisp
« on: March 25, 2005, 10:38:23 AM »
We receive drawings from our client. All equipment and fixtures are on the same layer. The client will not change his layer setup. What I am seeking is this......have the identified blocks that require certain utilities such as electrical redefined to a specific color sitting in a directory. When we receive the new background updates we run this routine and it brings the redefined blocks in from the specified directory and redefines them in the new drawing just received from our client....any chance?

Thanks

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

TJAM51

  • Guest
Redefining blocks through lisp
« Reply #2 on: March 25, 2005, 11:07:39 AM »
What I need if possible is that the blocks cannot be selected within the drawing. The routine needs to actually "reach" out to a directory with the modified blocks and bring them back into the parent drawing and redefine the old blocks leaving them on the same location and insertion point.  The blocks in the directory and in the parent drawing have the same name. For example 1=1, 2=2, 3=3, and so on.......

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

TJAM51

  • Guest
Redefining blocks through lisp
« Reply #4 on: March 25, 2005, 11:26:24 AM »
Here is the code on the earlier posted message...


(command "-insert" "titleblock=c:/blks/titleblocks/titleblock")
(command)



How can this be modified to include more blocks such as 10 or 15 blocks........thanks for the assist

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Redefining blocks through lisp
« Reply #5 on: March 25, 2005, 11:32:57 AM »
So you see it can be done with the = in the Insert command

Code: [Select]
Pseudo Code
o  Get all blocks in the drawing [not Inserts]
o  Loop through the list of blocks
o  If the block exist in the directory
o    replace it in the drawing
o      (command "-insert" "blockname=c:/path/blockname")
o  Done
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

TJAM51

  • Guest
Redefining blocks through lisp
« Reply #6 on: March 25, 2005, 11:39:50 AM »
I have tried the routine but it failed somehow. Here is the code within a toolbar button with the block name.

(command "-insert" "lf033j=c:/blks/lf033j/lf033j")(command)


For the rest

Pseudo Code
o  Get all blocks in the drawing [not Inserts]
o  Loop through the list of blocks
o  If the block exist in the directory
o    replace it in the drawing
o      (command "-insert" "blockname=c:/path/blockname")
o  Done



I am not sure how to retrieve the blocks in the drawing...sorry my lisp expertise is not all that great.