PDA

View Full Version : adding 2D text via script


V.shazzle
09-19-2005, 12:54 PM
In Vizard 2.53, what is the script equivalent of using 'Add Text' in the Resource box?

ie. 'Add Text' -> text name is 'sample text' - how would I do that in code?


thanks!

farshizzo
09-19-2005, 02:04 PM
Hi,

Here is sample code to add a text object to the screen.MyText = viz.add(viz.TEXT3D,'Message',viz.SCREEN)
MyText.translate(0.5,0.5)

V.shazzle
09-19-2005, 02:31 PM
is there a way to add 2D text label or text that sticks to one positon on the screen regardless of the viewpoint?

for example: in Beginner's Tutorials - adding 2D and 3D text - Stuck to the world: 'White Text' stays in place while 'Yellow Text' moves around due to viewpoint change. How do I add something like 'White Text' via scripts?

farshizzo
09-19-2005, 02:45 PM
The code in the previous post does just that. It adds a text object to the screen, then translates it to the center. The text will stay in the same place on screen, no matter where the viewpoint is.