Originally Posted by
peter
You can create a script file
(since you cannot run the express tools function by re-entering lisp from lisp)
Call it blockreplace.scr
Code:
(c:-blockreplace)
CD-RELAY
CDE-RELAY
Y
Then you can call that script from lisp
(command "script" "blockreplace.scr")
And replace the blocks.
P-
Neat idea Peter... Just look out for errors:
Code:
Command: _SCRIPT
Enter script file name "foo.scr"
Command: (c:-blockreplace)
Initializing...
Select the block to be replaced or [?/= (select object)]: CD-RELAY
The block 'CD-RELAY' was not found.
Select the block to be replaced or [?/= (select object)]: CDE-RELAY
The block 'CDE-RELAY' was not found.
Select the block to be replaced or [?/= (select object)]: Y
The block 'Y' was not found.
Select the block to be replaced or [?/= (select object)]: *Cancel*
Command:
Perhaps instead, it would be prudent to have a LISP file call the script (.SCR), only _if_ the predefined blocks exist:
Code:
(defun c:MyBlkRep ()
(if (and (tblsearch "block" "CD-RELAY")
(tblsearch "block" "CDE-RELAY")
)
(command "._script" "<YourFilePath>\\<YourFileName>.scr")
(prompt "\n** Block not found ** ")
)
(princ)
)
I would simply store this LISP, and the associated Script in the same location, with the same file names (obviously different extensions).
HTH