Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Press "ENTER" from command line

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
AIR_123
11855 Views, 16 Replies

Press "ENTER" from command line

Hi,

 

Is it possible to "press enter" from command line?

similar to "(command)" for escape

16 REPLIES 16
Message 2 of 17
DannyNL
in reply to: AIR_123

(command "")

Message 3 of 17
AIR_123
in reply to: DannyNL


@DannyNL wrote:

(command "")


Thanks, that worked, but not solved what I expected to solve. I have to rephrase...

Is there a way to confirm INSERT dialog from command line? 

 

Message 4 of 17
DannyNL
in reply to: AIR_123

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.

Message 5 of 17
gotphish001
in reply to: DannyNL

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

Message 6 of 17
AIR_123
in reply to: DannyNL

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!

Message 7 of 17
DannyNL
in reply to: AIR_123

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.

Message 8 of 17
AIR_123
in reply to: DannyNL


@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

Message 9 of 17
DannyNL
in reply to: AIR_123

Glad I could help Smiley Happy

 

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
Message 10 of 17
suraky
in reply to: DannyNL

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. 

Message 11 of 17
neaton
in reply to: suraky

 

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. 


 

Message 12 of 17
suraky
in reply to: neaton

Thanks for the fast reply,  but having the layer name in quotes doesn't help,  neither does having two spaces after it.

Message 13 of 17
neaton
in reply to: suraky

Interesting - I had to spell out PLINE instead of using the PL shortcut.

-layer set "layername"  pline 0,0 1,1 

Nancy

Message 14 of 17
j.palmeL29YX
in reply to: neaton

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.

EESignature

Message 15 of 17
neaton
in reply to: suraky

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.

Message 16 of 17
j.palmeL29YX
in reply to: neaton

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.

EESignature

Message 17 of 17
suraky
in reply to: j.palmeL29YX

Thanks for the help! I have it working now, compiling my commands into a .scr file as you've indicated.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost