Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / simple script for cchanging font
  RSS 2.0 ATOM  

simple script for cchanging font
Rate this thread
 
46639
 
Permlink of this thread  
avatar
  • Location: Sarnia, Ontario CANADA (ehh)
  • Total Posts: 262
  • Joined: 22 August 2006 08:13 AM

i have some cad style 3ds files
but the font is wrong

all text has an edit mesh applied on top

so for one text item in selected it would be?

foo=$
foo.baseobject.font."technics"

i have never worked with a string and wonder what
the syntax is.

help show quotes but it doesn’t work

thanks



Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

foo.baseobject.font "Arial"

n.b. You must spell the font exactly as shown in the dropdown list, including capitals and spaces (if any).



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 0
avatar
  • Location: Sarnia, Ontario CANADA (ehh)
  • Total Posts: 262
  • Joined: 22 August 2006 08:13 AM
  • Permlink of this post

Thanks it works with one text object but please read my
maxscript window as follows

--typed in the finder selection set=1 text (text with mesh select)

foo=$
$Text:Text96 @ [-710.805725,-0.000026,842.500000]
foo.baseobject.font ="Technic"
“Technic”

--this works with one text selected

--trying with two text selected -both text objects have mesh select

foo=$
$selection
foo.baseobject.font= “Technic”
-- Unknown property: “baseObject” in $selection

--lets try this maxscript

---------------foo=$

---------------for x in 1 to foo.count do
---------------(
---------------foo[x].baseoject.font="Technic"

----------------)

--pressing evaluate$selection
-- Error occurred in i loop
-- Frame:
-- i: 1
-- Unknown property: “baseoject” in $Text:Text98 @ [-661.802307,-0.000023,762.500000]
OK

i had to change the display from i to x as bracket i bracket is the same
command as italics in this viewer!!

Steve_Curley 27 August 2010 11:01 AM
foo.baseobject.font "Arial"

n.b. You must spell the font exactly as shown in the dropdown list, including capitals and spaces (if any).



Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

1) Always wrap any code inside CODE tags - it prevents the italic issue amongst other things.

2) The baseobject part cannot, AFAIK, be “mappable”, so the foo.baseobject construct won’t work. Without the Edit Mesh modifiers, it would work. foo.font = “Arial”, for example.

3) You can’t spell :P it’s baseobject not baseoject ;-)

foo = $
for 
1 to foo.count do
   
foo[i].baseobject.font "Impact"

or

foo = $
for 
i in foo do
   
i.baseobject.font "Arial"

Because $ (and therefore foo) is a collection rather than an array, you don’t need to count your way though them - it’s sort of automatic, but see (2) above.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 0
avatar
  • Location: Sarnia, Ontario CANADA (ehh)
  • Total Posts: 262
  • Joined: 22 August 2006 08:13 AM
  • Permlink of this post

Thanks for the help.
Never noticed the spelling part.
I do spell badly for someone born in Bucks!

I am having one of those “brain power not detected” days

Anyhow,I no longet have to manually change the fonts on 130 text objects!

Cheers from Sarnia, Ontario, Canada <ehhhh>

Steve_Curley 27 August 2010 01:05 PM

1) Always wrap any code inside CODE tags - it prevents the italic issue amongst other things.

2) The baseobject part cannot, AFAIK, be “mappable”, so the foo.baseobject construct won’t work. Without the Edit Mesh modifiers, it would work. foo.font = “Arial”, for example.

3) You can’t spell :P it’s baseobject not baseoject ;-)

foo = $
for 
1 to foo.count do
   
foo[i].baseobject.font "Impact"

or

foo = $
for 
i in foo do
   
i.baseobject.font "Arial"

Because $ (and therefore foo) is a collection rather than an array, you don’t need to count your way though them - it’s sort of automatic, but see (2) above.



Replies: 0