Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Equivalent (textscr) lisp function in C#

cadVDJ3M
Enthusiast

Equivalent (textscr) lisp function in C#

cadVDJ3M
Enthusiast
Enthusiast

Hello. This seems simple, but none of my attempts have been behaving well.

 

I've tried these ways and none of them have the correct result.

Autodesk.AutoCAD.ApplicationServices.Application.DisplayTextScreen = true;
//Nothing happens...


Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("(TEXTSCR) ", true, false, false);
//Nothing happens...

Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.Command("TEXTSCR");
//Displays undocked text window the first time, nothing in the second time, and display again in the third time.

I would like to display the text window exactly as the AutoLisp (textscr) function behaves, as below.

image.png

Thank you..

0 Likes
Reply
Accepted solutions (1)
342 Views
2 Replies
Replies (2)

norman.yuan
Mentor
Mentor

Do you have code still running after calling Application.DisplayTextScree=true? 

The purpose of showing Text string is to give user chances to look at the information showing in test screen, it is usually followed by asking user to interact with AutoCAD editor (i.e. you hold AutoCAD until user input something), typically something like:

 

Editor.GetString("\nPress any key to continue/end...);

 

Or it is the last line of the code execution.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes

cadVDJ3M
Enthusiast
Enthusiast
Accepted solution

Hello Norman.

 

I tried this but the result was the same, the text screen is not displayed.

 

CadApp.DisplayTextScreen = true;
ed.GetString("\nPress <ENTER> to continue...");

 

I am currently doing this.

Editor.Command("GRAPHSCR"); // to close undocked text window case its opened on a second plan. 
Editor.Command("TEXTSCR");

This isn't ideal, but it works.

0 Likes