Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
andrew.nao
Posts: 217
Registered: ‎09-25-2008
Message 1 of 8 (919 Views)

is it possible to change the font style of 1 text item?

919 Views, 7 Replies
09-09-2010 11:07 AM

im my current coding project im attempting to change the font stlye of 1 text item

i tried used the simple method of

[code]

(command "STYLE" "simplex" "ARIAL" "" "" "" "" "")

[/code]

 

however, using this changes the text's font in the whole drawing

i searched the forums here and everything i found either didnt work or changed all the text.

 

is there a more elegant way of doing this with just a selected text item and not the text in the whole drawing?

 

Valued Mentor
SomeBuddy
Posts: 372
Registered: ‎06-07-2010
Message 2 of 8 (907 Views)

Re: is it possible to change the font style of 1 text item?

09-09-2010 01:47 PM in reply to: andrew.nao

What you are doing there is to change a font on a style, so all the text on that style will change the appearance. You need to change the style on a specific text entity:

 

(vla-put-stylename

  (vlax-ename->vla-object  (car  (entsel)))
  "newstyle"
)

 

HTH

*Expert Elite*
scot-65
Posts: 2,210
Registered: ‎12-11-2003
Message 3 of 8 (900 Views)

Re: is it possible to change the font style of 1 text item?

09-09-2010 04:12 PM in reply to: andrew.nao

Is it Christmas yet?

Try this. It's from 1999.

command CS

Change Style.

 

Scot-65
Dyslexia is a permanent physical disability that cannot be seen.
Introverts is proof that there is indeed intelligent life on this planet.
Distinguished Contributor
andrew.nao
Posts: 217
Registered: ‎09-25-2008
Message 4 of 8 (877 Views)

Re: is it possible to change the font style of 1 text item?

09-10-2010 07:39 AM in reply to: SomeBuddy

; error: Automation Error. Key not found

 

changing the font is what i want to do, but only on 1 text item while keeping the style and font for everything else the same

 

 

*Expert Elite*
Kent1Cooper
Posts: 5,879
Registered: ‎09-13-2004
Message 5 of 8 (868 Views)

Re: is it possible to change the font style of 1 text item?

09-10-2010 08:42 AM in reply to: andrew.nao

andrew.nao wrote:

; error: Automation Error. Key not found

 

changing the font is what i want to do, but only on 1 text item while keeping the style and font for everything else the same 


Did you put an actual Style name in place of the "newstyle" in SomeBuddy's code?  It works for me if I do, but if I leave it saying "newstyle", it gives me that error message.

 

I wonder whether you're confused about the relationship between fonts and Styles, especially with the original question talking about "attempting to change the font style".  A font is an ingredient in a Style definition, and you can only assign a font to a piece of Text through the Style assigned to that Text.  If you want a Text entity to have a different font, you need to have a Style that uses that font, and assign that Style to the Text.

 

You can assign a different font, without the intermediary of a Style, to content within Mtext entities [or portions of it], but not to Text entities.

Kent Cooper
Distinguished Contributor
andrew.nao
Posts: 217
Registered: ‎09-25-2008
Message 6 of 8 (865 Views)

Re: is it possible to change the font style of 1 text item?

09-10-2010 08:51 AM in reply to: Kent1Cooper

it worked after i removed the extension *smacks forehead*

 

oh ok, so i need to make a new style with the font i want instead of changing the font in the already existing style.

 

is it safe to assume that you cant have 2 different styles of text in the same dwg then?

*Expert Elite*
Kent1Cooper
Posts: 5,879
Registered: ‎09-13-2004
Message 7 of 8 (861 Views)

Re: is it possible to change the font style of 1 text item?

09-10-2010 08:55 AM in reply to: andrew.nao

andrew.nao wrote:

.... 

is it safe to assume that you cant have 2 different styles of text in the same dwg then?


You can have as many as you want [well, there may be some way-beyond-what-you'd-ever-want limit].  Way back in the early days [when I started on AutoCAD Version 1.4 in 1984], you could have only one font in a drawing, but you could define more than one Style using it.  But that limitation is long gone.

Kent Cooper
Distinguished Contributor
cadman777
Posts: 947
Registered: ‎06-30-2005
Message 8 of 8 (184 Views)

Re: is it possible to change the font style of 1 text item?

02-18-2013 08:41 AM in reply to: andrew.nao

Can someone tell me what causes and how to fix this problem?

 

When I "Save As" an Inventor 2010 idw file to an autocad dwg file, the font gets messed up this way:

The dwg "Style" shows the font as "romans" for the non-default text (the text note I added to the dimension in Inventor), but the default (="<>") shows another style (="RomanS_IV25"), being a font native to Inventor 2010, which I did NOT specify in the Inventor "Styles Editor" for my text entities.

 

This is messing up my drgs by making the plots show faint text where the "unauthorized" Inventor text is, so the shop and customer can't read the text strings. It happens when both dwg and pdf files are plotted.

 

Any help is appreciated ...

... Chris
IV 2010 Suite
Digital Storm PC:
EVGA & Intel components
Win 7 Pro 64 bit
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.