Mtext lisp

Mtext lisp

C.Utzinger
Collaborator Collaborator
2,179 Views
5 Replies
Message 1 of 6

Mtext lisp

C.Utzinger
Collaborator
Collaborator

HI

 

I have this code. Now i want to add some text for the commandline while im making the Window for the mtext, i tried a lot, but nothing works...

 

 

(defun C:<T-1-50-2mm()
	(command "-layer" "_m" "-I-Text_020" "_co" "2" "-I-Text_020" "_l" "continuous" "-I-Text_020" "")
	(command "-stil" "simplex7-10" "simplex.shx" "10" "0.7" "0" "_n" "_n" "_n")
	(command "_.mtext" pause pause "")
	(command "_mtedit" "l")
	(command "layerp")
	(command "-layer" "_co" "2" "-I-Text_020" "_l" "continuous" "-I-Text_020" "")(prin1)	
) ; end of defun

 

 

Please help!!!

0 Likes
Accepted solutions (2)
2,180 Views
5 Replies
Replies (5)
Message 2 of 6

ВeekeeCZ
Consultant
Consultant
Accepted solution

Not sure what you want... try this...

 

(defun C:<T-1-50-2mm( / p1 p2)
  (command "-layer" "_m" "-I-Text_020" "_co" "2" "-I-Text_020" "_l" "continuous" "-I-Text_020" "")
  (command "_.-style" "simplex7-10" "simplex.shx" "10" "0.7" "0" "_n" "_n" "_n")
  (setq p1 (getpoint "\nMtext: first point of window: "))
  (setq p2 (getcorner p1 "\nMtext: second point of window: "))
  (command "_.mtext" "_none" p1 "_none" p2 "")
  (command "_mtedit" "l")
  (command "layerp")
  (command "-layer" "_co" "2" "-I-Text_020" "_l" "continuous" "-I-Text_020" "")(prin1)
  ) ; end of defun
Message 3 of 6

C.Utzinger
Collaborator
Collaborator

Yes!!!!!!!!!!!!!!!!!!!!

 

Thank you again and again.... 🙂

 

 

Regards

0 Likes
Message 4 of 6

C.Utzinger
Collaborator
Collaborator

The text appears perfectly, but with this code there is no Windows while drawing the two Points.

 

Is it possible to have also the Windows like with the normal command  "_.mtext"?

0 Likes
Message 5 of 6

ВeekeeCZ
Consultant
Consultant
Accepted solution

Well, just different one... Anyway, either you can add some prompts... (version 1) or you can even suppress some of original prompts by setting the CMDECHO sysvar off (version 2).

 

(defun C:<T-1-50-2mm1()
  
  (command "-layer" "_m" "-I-Text_020" "_co" "2" "-I-Text_020" "_l" "continuous" "-I-Text_020" "")
  (command "_.style" "simplex7-10" "simplex.shx" "10" "0.7" "0" "_n" "_n" "_n")
  (command "_.mtext")
  (princ "\nMtext: first point: ")
  (command pause)
  (princ "\nMtext: second point: ")
  (command pause "")
  (command "_mtedit" "l")
  (command "layerp")
  (command "-layer" "_co" "2" "-I-Text_020" "_l" "continuous" "-I-Text_020" "")(prin1)
  ) ; end of defun


(defun C:<T-1-50-2mm2( / ocmd *error*)

    (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
      (princ (strcat "\nError: " errmsg)))
    (setvar 'CMDECHO ocmd)
    (princ))

  (setq ocmd (getvar 'CMDECHO))
  (setvar 'CMDECHO 0)
  (command "-layer" "_m" "-I-Text_020" "_co" "2" "-I-Text_020" "_l" "continuous" "-I-Text_020" "")
  (command "_.-style" "simplex7-10" "simplex.shx" "10" "0.7" "0" "_n" "_n" "_n")
  (command "_.mtext")
  (princ "\nMtext: first point: ")
  (command pause)
  (princ "\nMtext: second point: ")
  (command pause "")
  (command "_mtedit" "l")
  (command "layerp")
  (command "-layer" "_co" "2" "-I-Text_020" "_l" "continuous" "-I-Text_020" "")
  (setvar 'CMDECHO ocmd)
  (prin1)
  ) ; end of defun
0 Likes
Message 6 of 6

C.Utzinger
Collaborator
Collaborator

Perfect that's better (Option 1)

 

Thank you very much!!!!

0 Likes