Command Line – How to Paste String

Command Line – How to Paste String

orders3
Contributor Contributor
1,934 Views
8 Replies
Message 1 of 9

Command Line – How to Paste String

orders3
Contributor
Contributor

Need assistance with pasting a string in the Command Line.

I am attempting to select a text style “style4” and then present a text message at a specific location on the display

I am using Excel to generate the following command lines for AutoCAD 2017.

       textstyle style4 text 30,30 12 This is a test

 

  • The text style is selected correctly - “style4”
  • The cursor is positioned correctly - “30,30”
  • The angle of the cursor is displayed correctly - “12” degrees
  • But the text is not displayed. I can then manually enter text, but I want to display the text from the command line string.

What I do not understand is the control characters between the AutoCAD commands.

I am a novice with AutoCAD, so please explain in layman terms.  Perhaps with the appropriate string for above.  Any assistance greatly appreciated.

 

 

0 Likes
Accepted solutions (1)
1,935 Views
8 Replies
Replies (8)
Message 2 of 9

Moshe-A
Mentor
Mentor

@orders3  hi,

 


I am using Excel to generate the following command lines for AutoCAD 2017.

       textstyle style4 text 30,30 12 This is a test

 

 


i do not think you can do this with excel?! macros or lisps is the 2 way to go (of course there are others)

 

macro:

^C^CTEXT S style4 30,30 12  0 "Your text";

 

lisp:

(command "TEXT" "S" "style4' "30,30," 12 0 "Your text" "")

 

enjoy

moshe

 

0 Likes
Message 3 of 9

orders3
Contributor
Contributor

Thanks for the prompt reply.  Could you provide the actual test that would be pasted in the AutoCAD command line?

0 Likes
Message 4 of 9

orders3
Contributor
Contributor

Typo - "Text"

0 Likes
Message 5 of 9

Moshe-A
Mentor
Mentor

copy & paste the lisp line into the command line

 

0 Likes
Message 6 of 9

orders3
Contributor
Contributor

Certainly appreciate your patience.  Here is the results:

 

Pasted following:
    "TEXT" "S" "style4' "30,30," 12 0 "Your text" ""
Results:
   Command: "TEXT" Unknown command ""TEXT"". Press F1 for help.
   Command: "S" Unknown command ""S"". Press F1 for help.
   Command: "style4' "30,30," 12 0 "Your Unknown command ""STYLE4' "30,30," 12 0 "YOUR". Press F1 for help.
   Command: text" Unknown command "TEXT"". Press F1 for help.

 

Pasted following:
   (command "TEXT" "S" "style4' "30,30," 12 0 "Your text" "")
Results:
   Command: (command "TEXT" "S" "style4' "30,30," 12 0 "Your text" "")
And in the command line:
   ("_>

 

Apparently, with my original string that I pasted, everything works, except AutoCAD is waiting for me to enter text via the keyboard instead on accepting the string.  What do I need to tell AutoCAD to accept the text?

Really appreciate your assistance....

 

0 Likes
Message 7 of 9

leeminardi
Mentor
Mentor

That should be a quote " not an apostrophe ' after style4 as follows:

 

 (command "TEXT" "S" "style4" "30,30," 12 0 "Your text" "")

image.png

lee.minardi
0 Likes
Message 8 of 9

orders3
Contributor
Contributor

Thanks for the correction lee.  But I still have a problem.  Don't know what I am doing wrong.

 

Pasted to Command Line....

(command "TEXT" "S" "style4" "30,30," 12 0 "Your text" "")

AutoCAD Response:

Command: (command "TEXT" "S" "style4" "30,30," 12 0 "Your text" "")
TEXT
Current text style: "style4" Text height: 4.0000 Annotative: No Justify: Left
Specify start point of text or [Justify/Style]: S
Enter style name or [?] : style4
Current text style: "style4" Text height: 4.0000 Annotative: No Justify: Left
Specify start point of text or [Justify/Style]: 30,30,
Point or option keyword required.
; error: Function cancelled

0 Likes
Message 9 of 9

orders3
Contributor
Contributor
Accepted solution

Thanks Lee  for all the assistance.  I finally got this to work. 

(command "TEXT" "S" "style4" "30,30" 12 "Your text").

 

It appears to be simple and I am embarrassed that I could not figure it out myself.

 

Have a good day....

 

0 Likes