RE: Scripting: Create Text

Date : Tue, 19 Jun 2007 13:17:10 -0400
To : <XSI(at)Softimage.COM>
From : "Jeff McFall" <Jeff.McFall(at)sas.com>
Subject : RE: Scripting: Create Text
yes, always appreciate the samples- thank you very much
 
Jeff
 
 


From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Bradley Gabe
Sent: Tuesday, June 19, 2007 11:42 AM
To: XSI(at)Softimage.COM
Subject: Re: Scripting: Create Text

For anyone who likes to save code snippets, here is the solution in jscript:


item = 'Foo';
textObj = SIGetPrim("Text")(1);
textObj.name = item+'_TXT';
convertOp = SIConvert('NurbsCurve', textObj + '')(0);
textObj = convertOp.OutputPorts(0).Target2.Parent;
textObj.text = "_RTF_{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fscript\\fprq6 Arial;}}\r\n\\pard\\fs20\\f0 "+item+"\\par\r\n}



That was enough of a clue!
Thanks Joey.


...and here is a method using GetPrim instead of SIGetPrim. Not sure 
which is best but I'm sure one has an advantage over the other.


dim BradsCurves, BradsTextObj

Textname = "TextX"
set BradsCurves = GetPrim("Text", Textname, null, primitive)
set BradsTextObj = SIConvert( "NurbsCurve", BradsCurves)
Text = "Withanar"
SetValue BradsTextObj & ".text.text", 
"_RTF_{\rtf1\ansi\deff0{\fonttbl{\f0\fbidi\fprq8\fcharset0 Arial;}}" & 
vbCrLf & "\viewkind4\uc1\pard\lang1033\f0\fs20" & Text &"\par" & vbCrLf 
& "}" & vbCrLf & ""


Textname = "TextY"
set BradsCurves = GetPrim("Text", Textname, null, primitive)
set BradsTextObj = SIConvert( "NurbsCurve", BradsCurves)
Text = "Needs"
SetValue BradsTextObj & ".text.text", 
"_RTF_{\rtf1\ansi\deff0{\fonttbl{\f0\fbidi\fprq8\fcharset0 Arial;}}" & 
vbCrLf & "\viewkind4\uc1\pard\lang1033\f0\fs20" & Text &"\par" & vbCrLf 
& "}" & vbCrLf & ""


Textname = "TextZ"
set BradsCurves = GetPrim("Text", Textname, null, primitive)
set BradsTextObj = SIConvert( "NurbsCurve", BradsCurves)
Text = "Text Script"
SetValue BradsTextObj & ".text.text", 
"_RTF_{\rtf1\ansi\deff0{\fonttbl{\f0\fbidi\fprq8\fcharset0 Arial;}}" & 
vbCrLf & "\viewkind4\uc1\pard\lang1033\f0\fs20" & Text &"\par" & vbCrLf 
& "}" & vbCrLf & ""




Joey Ponthieux
NCI Information Systems Inc.
NASA Langley Research Center
____________________________________________________________
Opinions stated here-in are strictly those of the author and
do not represent the opinions of NASA or any other party.



Ponthieux, Joey wrote:
> Brad,
>    This should do the trick for you.
>
> dim BradsCurves, BradsTextObj
> set BradsCurves = SIGetPrim("Text", null, null, null, null, null)
> set BradsTextObj = SIConvert( "NurbsCurve", BradsCurves(1))
> Text = "Withanar"
> SetValue  BradsTextObj(0) & ".text.text", 
> "_RTF_{\rtf1\ansi\deff0{\fonttbl{\f0\fbidi\fprq8\fcharset0 Arial;}}" & 
> vbCrLf & "\viewkind4\uc1\pard\lang1033\f0\fs20" & Text &"\par" & 
> vbCrLf & "}" & vbCrLf & ""
>
>
>
>
> Joey Ponthieux
> NCI Information Systems Inc.
> NASA Langley Research Center
> ____________________________________________________________
> Opinions stated here-in are strictly those of the author and
> do not represent the opinions of NASA or any other party.
>
>
>
> Bradley Gabe wrote:
>> Does anyone know how to create multiple Text curve objects via 
>> scripting without the Text editor PPG popping open? I'm working on a 
>> script that creates many text items in a scene, and I get a unique 
>> PPG per text object.
>>
>> Thanks
>> -Brad
>>
>> -- 
>> Bradley R. Gabe | Senior Creature TD | Stan Winston Studio
>>        
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in 
> body:
> unsubscribe xsi
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
-- 
Bradley R. Gabe | Senior Creature TD | Stan Winston Studio
-- 
Bradley R. Gabe | Senior Creature TD | Stan Winston Studio

Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.