LISP expression in TEXT

Alexander V. Koshman

Usenet Archive
Joined
Dec 16, 2003
Messages
61
Reaction score
0
Good evening (here's evening!)
or any another time of the day!
I would know how to pass a LISP expression
or variable to any of single-line text commands
to get the *beginning* of the string and allow
to user to type the *rest* of it while

(while (= (getvar "CMDACTIVE") 1)
(command pause)
) ; - 'command'

if it's possible.

I tried TEXTEVAL with (command txt) and (princ txt)
and (eval txt) and TEXT and -TEXT and DTEXT...
Without any success...

If there is some way or it IS hopeless?

Thank you in advance!
 
If I understand what you're asking for, this might point you in the right direction. It sits in a loop and accepts one character at a time and appends them into a string. As soon as you press enter, it quits. The end result is a variable named newTxt.

(setq tst 1 newTxt "")
(while tst
(setq char(grread nil))
; (alert (itoa (cadr char)))
(if(= 2(car char))
(cond
;if it's 13, then return was pressed.
((=(cadr char)13)(setq tst nil))

;if it's 8 then a backspace was pressed
((and (> (strlen newTxt) 0)(=(cadr char) 8))(setq newTxt(substr newTxt 1 (- (strlen newTxt) 1))))

;if it's NOT a backspace or return then append the character to the string ((and (or (< (cadr char) 13)(>(cadr char)13)) (or (< (cadr char) 8)(>(cadr char)8))) ;append the string here (setq newTxt(strcat newTxt (chr (cadr char)))) );end of last condition ) ) ;(alert newTxt)
)

HTH
 
Hello!
I think about making something like "in-place" Single-line Text editing if it's possible.
My plan was:
1. ask the user to select a text string ("TEXT" object);
2. get its content, height, style, justification, start point, rotation ...;
3. then I want to run the Text or DText command that write the beginning of the string with old content:
4. and
(while (= (getvar "CMDACTIVE") 1)
(command pause)
)
then to allow user to enter the rest of or modify the old string content.

What do you think?
I think it is impossible.
 
Hello Mark!
I don't understand.
how is that different from "Tedit" command?
I want to edit the string similar to creating it
In-place - directly IN THE DRAWING
and not in some Dialog as DDEDIT did...
It was not a good idea I see...
 
There are only (2) places to accept 'text' imput. 1>Dialog box, 2>at Command prompt. Attached Lisp modifies the text entry, adds string (char at a time) until <Enter>. Is this what you wanted ?
Bob
 
Alexander,
This might get you going in the right direction:

(defun chang_text
(setq txt (car (entsel "\nSelect Text: "))
ent (entget txt)
txt_ht (cdr (assoc 40 ent))
txt_val (cdr (assoc 1 ent))
xbase (cadr (assoc 10 ent))
ybase (caddr (assoc 10 ent))
)
(setq start_pt (list (+ xbase (caadr (textbox (entget txt))))(+ ybase(cadar (textbox (entget txt))))) ) (command "dtext" start_pt txt_ht "0") (setq txt2 (entlast) 2nd_val (entget txt2) new_txt_val (strcat txt_val (cdr (assoc 1 2nd_val))) ent (subst (cons 1 new_txt_val)(assoc 1 ent) ent)
)

(entmod ent)
(entdel txt2)
(princ)
)

Bill
 
Bill,
Kool ! I didn't think to use 'textbox'. Works great.
Bob
 
Sorry Bill!
It's really cool with textbox, but it isn't that I want because the user *can not* press BackSpace and really EDIT the source string content!
He can *only* ADD a new part!

Now I'm a pessimist...
 

Latest threads

Back
Top