PDA

View Full Version : Set Text height, then issue the MText command


dhurtubise
2006-02-17, 07:01 PM
I want to create a button so that the mtext command is issue and the text height is also set.
Meaning that i need the desired text height * dimscale to already be fill in. Any ideas ?
here is what i got so far
(DEFUN C:STDTHFMT ()
(setq TH (getvar "dimscale"))
(setq STDTH 0.09375)
(setq TITTH 0.25)
(setq THF (* TH TITTH))
(setvar "textstyle" "STANDARD-LM")
(command "mtext" )
)Now i need to pass THF to the Height parameter in the Mtext command, Any ideas ?

[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]

Mike.Perry
2006-02-17, 11:44 PM
Hi Daniel

Please note I have *moved* this thread from the AutoCAD Customization (http://forums.augi.com/forumdisplay.php?f=118) forum to this one as I believe it would be better served here.

Thanks, Mike

Forum Moderator

rkmcswain
2006-02-18, 12:07 AM
Here is a start.
It could really use some more error checking, etc., and you could create the textstyle if it doesn't exist.


(DEFUN C:STDTHFMT ( / th stdth titth thf)
(setq TH (getvar "dimscale"))
(setq STDTH 0.09375)
(setq TITTH 0.25)
(setq THF (* TH TITTH))
(if (tblsearch "style" (setq sn "STANDARD-LM"))
(setvar "textstyle" "STANDARD-LM")
)
(command "mtext" (getpoint "\nSelect Point: ") "_H" thf)
)

dhurtubise
2006-02-20, 01:31 PM
Here's what i'm getting when running your code :
Command: stdthfmt
; error: bad argument type: numberp: nil

jwanstaett
2006-02-20, 02:23 PM
just add the line in red

(DEFUN C:STDTHFMT ()
(setq TH (getvar "dimscale"))
(setq STDTH 0.09375)
(setq TITTH 0.25)
(setq THF (* TH TITTH))
(setvar "textstyle" "STANDARD-LM")
(setvar "textsize" THF)
(command "mtext" )
)

kennet.sjoberg
2006-02-20, 02:37 PM
Here's what i'm getting when running your code :
Command: stdthfmt
; error: bad argument type: numberp: nilEven the Sun have flaws ;)
add a pause to the command line in rkmcswain code.

(command "._mtext" (getpoint "\nSelect Point: ") "_H" Thf pause )


(setvar "textsize" THF)
(command "._mtext" (getpoint "\nSelect Point: ") "_H" Thf <- sets the textheight



; ) Happy Computing !

kennet

rkmcswain
2006-02-20, 02:44 PM
(command "._mtext" (getpoint "\nSelect Point: ") "_H" Thf pause )



What am I missing? It works fine here without the "pause".

kennet.sjoberg
2006-02-20, 04:05 PM
What am I missing? It works fine here without the "pause".
Sort of strange . . . first time hrrrmm . . . second time OK. Sorry.
Even the Sun have flaws ;)

; ) Happy Computing !

kennet