TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Luke on April 11, 2008, 04:42:31 PM
-
I want to run a script to replace BlockA with BlockA and BlockB with BlockB.
I have the following code:(command "-INSERT" "LCC_BRD_LANDSCAPE_11x17=S:/Engineer/Borders/LCC_BRD_LANDSCAPE_11x17")
(command)
(command "-INSERT" "LCC_BRD_LANDSCAPE_8x11=S:/Engineer/Borders/LCC_BRD_LANDSCAPE_8x11")
(command)
So the first (command) after the first insert stops the inserting of the block, that is what I want it to do. Unfortunately it also stops the remainder of the script from running.
Can anybody tell me what to change.
-
in a script, it is likely an errant or space
-
When I try to run each section individually they both work. But when I put them together it stops after the first (11x17)
-
Note the errant space
-
Yes I see now.
I have adjusted
(command "-INSERT" "LCC_BRD_LANDSCAPE_11x17=S:/Engineer/Borders/LCC_BRD_LANDSCAPE_11x17")
(command)
(command "-INSERT" "LCC_BRD_LANDSCAPE_8x11=S:/Engineer/Borders/LCC_BRD_LANDSCAPE_8x11")
(command)
but still seems to stop at same point...
From Command line:
Command: _script
Enter script file name <C:\Documents and Settings\user\Desktop\Block
Replace.scr>: LCC_BORDER_UPDATE.scr
Command: (command "-INSERT"
"LCC_BRD_LANDSCAPE_11x17=S:/Engineer/Borders/LCC_BRD_LANDSCAPE_11x17")
-INSERT Enter block name or [?]:
LCC_BRD_LANDSCAPE_11x17=S:/Engineer/Borders/LCC_BRD_LANDSCAPE_11x17 Block
"LCC_BRD_LANDSCAPE_11x17" redefined
Units: Inches Conversion: 1.0000
Specify insertion point or
[Basepoint/Scale/X/Y/Z/Rotate/PScale/PX/PY/PZ/PRotate]: nil
Specify insertion point or
[Basepoint/Scale/X/Y/Z/Rotate/PScale/PX/PY/PZ/PRotate]: (command)
Command: nil
-
Try loading this into your startup suite then call in your script using RB.
(defun c:rb (/)
(if (tblobjname "block" "LCC_BRD_LANDSCAPE_11x17")
(progn
(command
".-INSERT"
"LCC_BRD_LANDSCAPE_11x17=S:/Engineer/Borders/LCC_BRD_LANDSCAPE_11x17"
'(0 0 0)
"1"
"1"
"0"
)
(command "._erase" (entlast) "")
)
)
)
-
I notice when I highlight my inserted code it shows the same as you saw Keith, but when I highlight it in the actual notepad editor it shows up like this...(http://CODE.jpg)
Is there a better way to skin this cat?
-
Thanks ronjonp, I need this to also replace my 8x11 border all in one click...
-
See if you can modify it :wink: ... if you're having trouble let me know.
-
I appreciate the help, but I'm not sure if I like this route... (no disrespect just sort of outloud thinking on "paper")
I do not want the block to actually insert, this makes me cycle through the attributes of my title block and it inserts it.
I just need to overwrite my old block with my new one. Is lisp the better way to do it or can my script be tweaked to get it to keep on running after the first command stops the insert?
-
Look into ATTREQ and ATTDIA :)...I'll see if i can throw something together.
-
Also look into designcenter. It allows you to insert and updated block definition without inserting the block.
-
Not necessary to try anything else. I got my script to work...
(command "-INSERT" "LCC_BRD_LANDSCAPE_11x17=S:/Engineer/Borders/LCC_BRD_LANDSCAPE_11x17")
(command)(command "-INSERT" "LCC_BRD_LANDSCAPE_8x11=S:/Engineer/Borders/LCC_BRD_LANDSCAPE_8x11")(command)
Thanks all for your help!
-
good to hear...
This works as well:
(defun c:rb (/ atr)
(setq atr (getvar 'attreq))
(if (tblobjname "block" "LCC_BRD_LANDSCAPE_11x17")
(progn
(setvar 'attreq 0)
(command
".-INSERT"
"LCC_BRD_LANDSCAPE_11x17=S:/Engineer/Borders/LCC_BRD_LANDSCAPE_11x17"
'(0 0 0)
"1"
"1"
"0"
)
(setvar 'attreq atr)
(command "._erase" (entlast) "")
)
)
)