Author Topic: 2012 text command in lisp  (Read 7640 times)

0 Members and 1 Guest are viewing this topic.

hmspe

  • Bull Frog
  • Posts: 362
2012 text command in lisp
« on: April 02, 2011, 05:40:30 PM »
I like the on-screen entry when using the TEXT command in 2012, but I don't like having to enter a text height and rotation for every new text entity.  It should be easy to wrap a lisp routine around the text command, but every approach I've tried in lisp inputs the text on the command line rather than in-place on-screen.

(command "text")    shows the input on-screen and in-place
(command "text" pause "" "")    shows the input on the command line and nothing shows on-screen until the command completes.

Using getpoint to select the insertion point and passing that value instead of pause doesn't change things.

Anyone have any suggestions?  Thanks in advance.
"Science is the belief in the ignorance of experts." - Richard Feynman

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: 2012 text command in lisp
« Reply #1 on: April 02, 2011, 06:26:51 PM »
This works for me:
Code: [Select]
(defun c:mytxt ()
  (command "text" pause "" "")
  (princ)
  )

hmspe

  • Bull Frog
  • Posts: 362
Re: 2012 text command in lisp
« Reply #2 on: April 02, 2011, 08:38:23 PM »
Jeff,

Thanks.  I tried identical code before my first post.  When I run it here the mytxt lisp shows the text characters being entered at the command line, and the text appears in the drawing area only after pressing Enter.  If I just type TEXT at the command line or run (command "text") Autocad 2012 places the text directly in the drawing, WYSIWYG.  I'm trying to find a way to have WYSIWIG entry without having to respond to the size and rotation prompts.  I use the text command hundreds of times a day and the extra Enters to accept the last used height and rotation add up. 

Martin 

 
"Science is the belief in the ignorance of experts." - Richard Feynman

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: 2012 text command in lisp
« Reply #3 on: April 02, 2011, 09:35:17 PM »
Ok, I misunderstood, sorry about that. I thought you meant the dynamic input wasn't reacting as expected. I'll look into the other as soon as I can.

stevej

  • Newt
  • Posts: 30
Re: 2012 text command in lisp
« Reply #4 on: April 02, 2011, 11:33:44 PM »
Set your text height to something other than 0.000 and try again.

for example, If I do this:
(command "style" "standard" "txt.shx" ".08" "1.00" "" "" "" "" )

then I can use my macro:
^C^C_DTEXT;J;MC

and it all works together.

Steve
« Last Edit: April 02, 2011, 11:38:33 PM by stevej »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: 2012 text command in lisp
« Reply #5 on: April 03, 2011, 08:36:33 AM »
Martin,
I have a subroutine to do just that but I will need to clean it up.
Off to tennis but I should have some time later today.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12916
  • London, England
Re: 2012 text command in lisp
« Reply #6 on: April 03, 2011, 09:04:51 AM »
Perhaps change the macro for the text command to be:

Code: [Select]
^C^C_.text;\;;

hmspe

  • Bull Frog
  • Posts: 362
Re: 2012 text command in lisp
« Reply #7 on: April 03, 2011, 11:48:16 AM »
Thanks for all the replies.

Two things I've found.  First, running Jeff's code as written does not give in-place display for me.  If I change TEXT to DTEXT in Jeff's code I get the in-place display.  This seems a bit strange since the pgp file lists DTEXT as an alias for TEXT, and says that DTEXT was eliminated in 2004.

Second, the TEXTED setting changes how the TEXT/DTEXT command works.  I've had TEXTED set to 1, which in 2011 and earlier let me enter a single line of text (no pressing Enter on an empty line to exit).  In 2012 with TEXTED set to 1 the in-place text is actual size but the arrow keys do not work, and I have to press Enter on an empty line to exit.  With TEXTED set to 0 or 2 the arrow keys work, but the in-place text may not be actual size.  My preference is in-place, actual size, and one line only since at least 80% of the text I enter is one line only.  For me they had it right when TEXT and DTEXT were separate commands. 

I tried the macro approach.  The problem there is that the command is not encapsulated.  If you repeat the command (I have Enter set to repeat the last command) you get the basic TEXT command, not the full macro. 

"Science is the belief in the ignorance of experts." - Richard Feynman

hmspe

  • Bull Frog
  • Posts: 362
Re: 2012 text command in lisp
« Reply #8 on: April 03, 2011, 12:42:39 PM »
Martin,
I have a subroutine to do just that but I will need to clean it up.
Off to tennis but I should have some time later today.


Cab,

Would this be Get_String.lsp from October 2008?  I think I was the OP of the thread that sparked the idea for your code.  I have a hybrid version that I use for input in some lisp routines that I can adapt to replace the 2012 TEXT command.  I generally prefer to use the built-in commands if I can, but it may be that the best approach here may be to write my own. 

I'm rather disappointed with the direction Autodesk is headed, and I'm finding more and more things I cobble code together for to keep things simple and efficient.  Dynamic dialogs generally take more clicks than single purpose dialogs, and they take my attention away from design since I have to read through the menus to find what I'm looking for.  I'll take special purpose dialogs where everything is in the same place every time any day.  On my list right now are ODCL replacements for the layer dialog and xref dialog.  The 2004 versions were more than adequate for what I do.  In 2012 the classic dialogs are still there, but they've removed the settings to make the classic versions the default.  Easy enough to edit the pgp file to fix this for 2012, but who knows what 2013 will bring? 
"Science is the belief in the ignorance of experts." - Richard Feynman

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: 2012 text command in lisp
« Reply #9 on: April 03, 2011, 12:43:51 PM »
OK i extracted the meat of my routine & will provide this code:
I can not test TEXTED because I only have ACAD2006.

<edit: code remove for further evaluation>
« Last Edit: April 03, 2011, 02:39:58 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: 2012 text command in lisp
« Reply #10 on: April 03, 2011, 02:15:05 PM »
Martin, that did not work for you?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

hmspe

  • Bull Frog
  • Posts: 362
Re: 2012 text command in lisp
« Reply #11 on: April 03, 2011, 05:47:00 PM »
Martin, that did not work for you?

Not sure what you're referring to here.  The code from your 8:43 post was removed while I was off at church.
"Science is the belief in the ignorance of experts." - Richard Feynman

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: 2012 text command in lisp
« Reply #12 on: April 03, 2011, 08:27:14 PM »
See mp PM.

I am working on this routine.
« Last Edit: May 06, 2011, 08:09:29 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

stevej

  • Newt
  • Posts: 30
Re: 2012 text command in lisp
« Reply #13 on: April 04, 2011, 08:47:45 PM »
I can not test TEXTED because I only have ACAD2006.

I believe in 2006 the command is DTEXTED.

Steve

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: 2012 text command in lisp
« Reply #14 on: April 04, 2011, 09:07:47 PM »
Right you are.

Thanks Steve. 8-)


Quote
DTEXTED
Specifies the user interface for editing single-line text.

0  Displays the In-Place Text Editor
 
1  Displays the Edit Text dialog box


When set to zero you may click outside the text and the text command will end.
When set to one clicking will start a new line of plain text and you have to press Enter twice to exit the command.


The inplace method is used in both cases when using my routine.


« Last Edit: April 04, 2011, 09:17:46 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.