Hi,
Is it possible to "press enter" from command line?
similar to "(command)" for escape
Solved! Go to Solution.
Solved by DannyNL. Go to Solution.
No, that's not possible. AutoCAD will keep waiting until you close the dialogue with one of the buttons and commandline input is disabled.
When using scripts or LISP therefore code is always written to use the INSERT command without the dialogue box, like eg.
(command "-insert" "test" pause 1 1 0)
In this case the minus before the INSERT command isn't really necessary as AutoCAD will normally suppress the dialogue box automatically as it detects the command is run from a LISP command. But as a script just mimics keyboard input, there it will be necessary to prefix INSERT with the minus else your script will show the dialogue box and wait until this is closes before proceeding.
I'm not 100% clear on what you are asking, but if I understand, you want to close a pop up window with return? You can tab until the O.K. button is high lighted and hit enter if you are trying to close it without the mouse click.
Nick DiPietro
Cad Manager/Monkey
Thanks!!!
I'm trying to implement something like this:
-insert "path" ;block loaded into memory esc ;escape blockreplace block A block B y
Could you please fix my logic here? Thanks!
I think I'm seeing what you are trying to do.
You are inserting the block and only want to import the block into the drawing but not actually place it. After importing you want to replace an existing block with the new imported block.
But are you actually trying to redefine an existing block A in your drawing with a modified block A somewhere in a folder or do you really want to replace block A with a different block B?
But to make this work you will need to complete the INSERT command as an escape will stop your script. After inserting delete it immediately, before using BLOCKREPLACE.
Try this in scripting
-INSERT "c:\\folder\\block A.dwg" 0,0 1 1 0 ERASE L
-BLOCKREPLACE
"BLOCK A"
"BLOCK B"
Y
Creating a LISP for this would be even better as it will provide you with a custom command in AutoCAD and is more powerful than scripting.
@DannyNL wrote:I think I'm seeing what you are trying to do.
You are inserting the block and only want to import the block into the drawing but not actually place it. After importing you want to replace an existing block with the new imported block.
But are you actually trying to redefine an existing block A in your drawing with a modified block A somewhere in a folder or do you really want to replace block A with a different block B?
But to make this work you will need to complete the INSERT command as an escape will stop your script. After inserting delete it immediately, before using BLOCKREPLACE.
Try this in scripting
-INSERT "c:\\folder\\block A.dwg" 0,0 1 1 0 ERASE L
-BLOCKREPLACE
"BLOCK A"
"BLOCK B"
Y
Creating a LISP for this would be even better as it will provide you with a custom command in AutoCAD and is more powerful than scripting.
Danny, many thanks. Indeed logic is as you described. I'm replacing block A with block B.
My knowledge of LISP is limited therefore I'm trying to implement scripting here.
One more thing. How I can skip requests to fill in attributes in inserted block? Thanks
Glad I could help
To disable the request for attribute values after inserting a block, you need to set the system variable ATTREQ to 0. So your script would look something like this.
ATTREQ 0 -INSERT "c:\\folder\\block A.dwg" 0,0 1 1 0 ATTREQ 1 ERASE L -BLOCKREPLACE "BLOCK A" "BLOCK B" Y
I have a true "press enter" problem, with no solution found so far. This topic is similar so I hope someone here can answer without having to explain it in a new post.
I'm pasting strings of commands into the commandline. I need to set a layer to be current then draw a pline.
-LAYER SET mylayername PL 0,0 1,1
... I need to 'press enter' after the layer name, or else it assumes everything after is part of the layer name. Spaces are not sufficient because layer names can include spaces. Other typical 'enter' characters give an 'invalid layer name' error.
Put the layername in quotes. This also applies to paths and filenames with spaces. Remember to have 2 spaces after the layername to exit the layer command.
-LAYER SET "mylayername" PL 0,0 1,1
Nancy
@suraky wrote:I have a true "press enter" problem, with no solution found so far. This topic is similar so I hope someone here can answer without having to explain it in a new post.
I'm pasting strings of commands into the commandline. I need to set a layer to be current then draw a pline.-LAYER SET mylayername PL 0,0 1,1
... I need to 'press enter' after the layer name, or else it assumes everything after is part of the layer name. Spaces are not sufficient because layer names can include spaces. Other typical 'enter' characters give an 'invalid layer name' error.
Thanks for the fast reply, but having the layer name in quotes doesn't help, neither does having two spaces after it.
Interesting - I had to spell out PLINE instead of using the PL shortcut.
-layer set "layername" pline 0,0 1,1
Nancy
The attached script should work (delete the .txt-extension). Notice, that no spaces are at the end of the lines.
And - I used the MAKE option instead of SET. (If the layername doesn't exist it will be created automatically, if the name exists it works like SET).
cadder
Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
I missed that you were trying to copy and paste this into the command line. I can't get any combination to work that way but I can get it to work in a script, LISP or a Tool Palette.
Nancy
@suraky wrote:I'm pasting strings of commands into the commandline. I need to set a layer to be current then draw a pline.
Ok. I understand. A new try:
Open the attached test.txt. Mark the complete content (Ctrl+A) and copy into the clipboard (Ctrl+C).
In AutoCAD pick in the command line. Insert the clipbord with Ctrl+V. That's all.
cadder
Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Thanks for the help! I have it working now, compiling my commands into a .scr file as you've indicated.