LISP Routine to shortcut common phrases?

LISP Routine to shortcut common phrases?

Anonymous
Not applicable
2,400 Views
8 Replies
Message 1 of 9

LISP Routine to shortcut common phrases?

Anonymous
Not applicable

Is there a way to create keyboard shortcuts or a lisp routine for common phrases or common fractions I use in my drawings? For example, how do I get "Ctrl + 1" to simply input the number 1/16"? Even more, is there a way to make a command or lisp routine for multiples of 1/16"?  so "Ctrl + 11" would input 1/8", "Ctrl + 111" for 3/16", "Ctrl + 1111" 1/4, etc.?

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

ronjonp
Mentor
Mentor

You could use something like THIS

0 Likes
Message 3 of 9

Anonymous
Not applicable

Seems great but I'm doing something wrong likely. "TINSERT" allows me to insert blocks into table cells. That's all I can do though. If I type "TINS" I get "Could not load data tid file or dcl file." Am I supposed to load the .tid files somehow? Sorry I'm quite stupid at these things.

0 Likes
Message 4 of 9

Anonymous
Not applicable

Also, do I load both lsp's? Is TextInsertDCL9_9 an earlier and obsolete version of TextInsertDCL11_2?

0 Likes
Message 5 of 9

ronjonp
Mentor
Mentor

Make sure all the files within the zip are located in folder included in your support files search paths. I just tested here and it loaded fine. Did not try to make my own notes though. You also might post at TheSwamp and see if Charles has any insight on it.

0 Likes
Message 6 of 9

Anonymous
Not applicable

Thanks, that worked! I'll have to play around with it but what I was looking for specifically was a LISP routine for a series of preset shortcuts for common fractions I use. So Ctrl+1 would input 1/16", Ctrl+2 1/8", and so on. Do you know if anything like this exists?

0 Likes
Message 7 of 9

ronjonp
Mentor
Mentor

When you say 'input' is this inserting a text object with that value? Or do you want to 'insert' this value into a note that is being edited? I wouldn't use CNTRL+# since cad has them defined already ( ie CNTRL+1 = properties palette )

0 Likes
Message 8 of 9

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

Is there a way to create keyboard shortcuts or a lisp routine for common phrases or common fractions I use in my drawings? For example, how do I get "Ctrl + 1" to simply input the number 1/16"? Even more, is there a way to make a command or lisp routine for multiples of 1/16"?  so "Ctrl + 11" would input 1/8", "Ctrl + 111" for 3/16", "Ctrl + 1111" 1/4, etc.?


 

Assuming you're talking about using these inside Text or Mtext input/editing operations, I don't know of a way.  Shortcut keys can be created with Ctrl + other keys, or Alt or Shift or combinations, and many are already defined as AutoCAD default settings [e.g. Ctrl+2 brings up or hides the Design Center].  But those don't function in Text/Mtext input/editing.

 

I tried getting into the CUI Shortcut Keys area and setting 5/8" into Ctrl+5 [the only Ctrl+number key combination not used by AutoCAD 2019 by default].  The assignment "worked" in the sense that if I invoke it with no command running, it does  feed it in -- I get an unknown-command message.  But when I hit that combination inside Text/Mtext input/editing, nothing happens at all, just as nothing happens if I hit other shortcut keys when in there.

 

It does  work when inputting Text content at the command line, rather than in an on-screen input/editing window, either in the command-line-only [hyphen-prefixed] -TEXT command or giving new content in the CHANGE command, but those are old-fashioned and cumbersome ways to deal with text content, and command-line input is not possible at all with Mtext.

 

AutoLisp functions could be defined, such as:

  (defun T5 (command "5/8\""))

[you can't use just a number as a function name, hence the T].  But they don't work inside Text/Mtext input/editing, either, nor in the command-line Text operations that shortcut keys do  work in.  You can use that at the command line with no command running, getting the same unknown-command message as with the shortcut key, but if you have to type it in with parentheses -- (T5) -- to get it, you may as well just type in 5/8" directly.

 

AutoLisp commands  with the  (defun C:T5 ...  would be pointless, since they can't be called inside Text input under any circumstances, but only at the command prompt.

 

There are fonts  out there which substitute fractions as specially-defined individual characters, used in place of some less-used punctuation characters.  For instance, one called ARCH.shx that's built to look like hand lettering, and gives you the following for the text string that in "normal" fonts says   _ [ { ] } \ |   i.e. the underscore, square and curly brackets, backslash and "pipe":

TextFractions.PNG

[I think it dates from before AutoCAD would make its own stacked fractions in Mtext.]  But I don't like that approach, because of translation problems if the font gets changed [and that font changes other punctuation characters in other ways], and because you then don't have those punctuation characters available to you at all in that font.  And if you want all the possible sixteenths, too, you'd have to define more, either stealing other punctuation characters, or adding specials that would again be more cumbersome to use than just typing the fraction yourself.

Kent Cooper, AIA
0 Likes
Message 9 of 9

Anonymous
Not applicable

You put it much better than I could. That's exactly what I was wondering. I'll just have to do it manually. Thank you all for the help!

0 Likes