WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 04-03-2008, 07:58 AM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
Placing Text onto another object???

I want to know how to place some text (in this case a single letter) "on" a specific place in another object in the world. In other words, let's say I have a .wrl file with some model in my world. And let's say within that .wrl file there are six "boxes" and each "box" needs to have a unique letter in it.

I tried using A = viz.add(viz.TEXT3D, 'A') and I also tried using A = viz.add(viz.TEXT3D, 'A', viz.ABSOLUTE WORLD) because I can't have the text tied to the screen. (The viewpoint will be moving and I want the letters to stay put in each of their respective boxes).

Also, each box is in a different place in the environment so I'm assuming I'd have to just monkey with the translation of each of the letters until I got it inside it's appropriate box? Or is there an easier way? (I.e. is there a way to turn on "coordinates" within Vizard so I could see where each box lies and then translate each letter accordingly?

I'm going to try a couple more ideas but plainly speaking I'm running out and I'm stuck. Any help? Any ideas?

Thanks for the help in advance
Reply With Quote
  #2  
Old 04-03-2008, 08:33 AM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
I think I might have figure out to do the text thing but now when I try to add a second letter it won't even show up
so I have:

A = viz.add(viz.TEXT3D,'A', viz.RELATIVE_LOCAL)
A.translate(.17,.985,4.2)
A.color(0,0,0)
A.scale(.2, .2, 2)

H = viz.add(viz.TEXT3D,'H', viz.RELATIVE_LOCAL)
H.translate(0,.95,4.2)
H.color(0,0,0)
H.scale(.2, .2, 2)


But the H won't show up and I don't know why. I tried it with something much more random like 'quibeqf' as the text but that didn't show up either. Any ideas??? I need to be able to use 11 letters total
Reply With Quote
  #3  
Old 04-03-2008, 10:21 AM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
Another point of interest:

I tried just creating a blank script with the letters and here's what I have:

import viz
viz.go()

A = viz.add(viz.TEXT3D,'A', viz.RELATIVE_LOCAL)
A.translate(.17,.985,4.2)
A.color(1,0,0)
A.scale(.2, .2, 2)

H = viz.add(viz.TEXT3D,'H', viz.RELATIVE_LOCAL)
H.translate(0,.95,4.2)
H.color(0,0,1)
H.scale(.2, .2, 2)

I = viz.add(viz.TEXT3D, 'I', viz.RELATIVE_LOCAL)
I.translate(0,.80,4.2)
I.color(0,1,0)
I.scale(.2,.2,.2)

Now in this case, I can get H and A to appear but not I. And I've added others like Q and R and they won't appear either. Is there some limit to how many I can add? And if this is true then why in my actual script (where I need the letters to appear) won't A or H or I appear at all!!??? What's going on?
Reply With Quote
  #4  
Old 04-03-2008, 10:42 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You need to remove the viz.RELATIVE_LOCAL from the viz.add command. When adding text the 3rd parameter is the parent the text should be attached to. By default it is viz.WORLD. If you want to attach some text to an existing object try the following example:
Code:
import viz
viz.go()

box = viz.add('box.wrl')
box.add(vizact.spin(0,1,0,90,viz.FOREVER))
box.translate(0,1,5)

#Add text as child of box
A = viz.add(viz.TEXT3D,'A', box)
A.alignment(viz.TEXT_CENTER_CENTER)

#Text translation will be relative to boxes local coordinate system
A.translate(0,.985,0)
A.color(0,0,0)
A.scale(.2, .2, 2)

viz.clearcolor(viz.GRAY)
All text object transformations (translate,rotate,scale) will now be relative to the local coordinate system of the box.

In your case, are the boxes static or will they be moving around? If the boxes are static, then you don't need set the parent of the text. Just add the text to viz.WORLD and place it where the boxes are. If the boxes will be moving around then add the text as children of the boxes and position the text locally, relative to the box.
Reply With Quote
  #5  
Old 04-08-2008, 02:15 PM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
thank you for the help. I got it figured out now
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieve Object names Geoffrey Vizard 11 12-11-2009 04:26 AM
Child Object Rotation paulgoldberg Vizard 5 09-05-2006 11:33 AM
adding 2D text via script V.shazzle Vizard 3 09-19-2005 02:45 PM
rotate to object jargon Vizard 1 08-08-2005 12:20 PM
3d Text with Transparent Borders vjosh Vizard 3 12-01-2004 10:50 AM


All times are GMT -7. The time now is 11:44 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC