TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: bmossman on January 11, 2008, 10:36:20 AM
-
using lisp...ie, control whether it's roman, bold, italic?
(defun c:SIMPLEX (/)
(command "-style"
"SIMPLEX" ; name of text style
"SIMPLEX" ; font name
"0" ; height of text
"1" ; width factor
"0" ; obliquing angle
"n" ; text backwards
"n" ; text upside-down
""
)
(princ)
)
-
For starters, you can't apply the bold property to SIMPLEX.
BUT... If you use Arial and want to make it bold, you have to enter ARIALBD.TTF to make the text style Arial Bold. Confused?
(command "-style" "TAGS1" "arialbd.ttf" "20.0" "1" "0" "n" "n")
-
What about swiss.ttf? How would you control the font style using lisp?
-
What I just did was create a text style that uses the Swiss 721 Black BT.ttf font style, then from the command line, found out what the name is...
Command: -style
Enter name of text style or [?] <TAGS1>:
Existing style. Full font name = Swiss 721 Black BT
Specify full font name or font filename (TTF or SHX) <swissk.ttf>:
Specify height of text or [Annotative] <1'-8">:
Specify width factor <1.0000>:
Specify obliquing angle <0.00>:
Display text backwards? [Yes/No] <No>:
Display text upside-down? [Yes/No] <No>:
"TAGS1" is now the current text style.
Command:
-
I just figured it out after I explored the fonts directory & saw the different font types. Thanks for your help!
-
Here is what I use:
(defun c:af (/ doc txtstyle)
(setq doc (vla-get-activedocument (vlax-get-acad-object))
txtstyle (vla-add (vla-get-textstyles doc) "Arial")
)
(vlax-put-property txtstyle 'fontfile "arial.ttf")
(vlax-put-property txtstyle 'width 1.0)
(vlax-put-property txtstyle 'height 0.0)
(vla-put-activetextstyle doc txtstyle)
(princ "\nARIAL is now the current text style")
(princ)
)
-
I just figured it out after I explored the fonts directory...
Lucky.... I can't see my "C" drive. They've locked us out, so I've learned to do things the hard way.
And, you're welcome.
-
Man, I hate when ITwit's do that. I worked at a company that made it so we couldn't alter one word in a folder structure to switch to another folder, like:
c:\this\that\images
to
c:\this\these\images
Had to go about it the long way. Annoying.
-
Lucky.... I can't see my "C" drive. They've locked us out, so I've learned to do things the hard way.
Damn communists! :-D
-
Man, I hate when ITwit's do that. I worked at a company that made it so we couldn't alter one word in a folder structure to switch to another folder, like:
c:\this\that\images
to
c:\this\these\images
Had to go about it the long way. Annoying.
Yup.... we've got that too.
-
Here is what I use:
(defun c:af (/ doc txtstyle)
(setq doc (vla-get-activedocument (vlax-get-acad-object))
txtstyle (vla-add (vla-get-textstyles doc) "Arial")
)
(vlax-put-property txtstyle 'fontfile "arial.ttf")
(vlax-put-property txtstyle 'width 1.0)
(vlax-put-property txtstyle 'height 0.0)
(vla-put-activetextstyle doc txtstyle)
(princ "\nARIAL is now the current text style")
(princ)
)
Dear Ron,
When I use your program. I get:
Error: Automation Error. Filer error
Regards
-
Not sure about that one.....maybe add (vl-load-com) to the top line?
-
Not sure about that one.....maybe add (vl-load-com) to the top line?
Ron
That was it. I also get the error.
Command: af
; error: Automation Error. Filer error
Command:
Gary
-
Wonder if it can't find the file. Try (findfile "arial.ttf") and see what it returns.
/guess
-
Not sure about that one.....maybe add (vl-load-com) to the top line?
Ron
That was it. I also get the error.
Command: af
; error: Automation Error. Filer error
Command:
Gary
Good to hear...thanks Gary.
-
Remember this thread?
http://www.theswamp.org/index.php?topic=15317.msg186243#msg186243