WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-19-2005, 09:11 AM
ChrisB ChrisB is offline
Member
 
Join Date: May 2004
Location: Hamilton, Ontario
Posts: 4
Send a message via ICQ to ChrisB
Interactive Window

Hi,

I was hoping I could get something cleared up for me. I like to use the interactive window for keeping track of certain variables during testing for my various callback functions, like if a certain key is pressed for example.

However, I'm curious as to how the interactive window works while the simulation is being loaded.

For example, my program reads a bunch of data from an input file in order to setup walls, objects, etc. Data holds the input file data, and the for loop goes through it one line at a time

for x in data:
x = x[:-1] # remove trailing \n
if (property == 'length'): # set length of floor area
... etc etc...
if (property == width'): # set length of floor area
... etc etc...
if (x == '# ROOM DIMENSION LENGTH'):
property = 'length'
elif (x == '# ROOM DIMENSION WIDTH'):
property = 'width'


It works like something similar to that. It searches through the input file, detects flags that lets the code what property the upcoming numbers are related to, and then assigns those numbers to the proper variables.

Anyways, that's the backgroud. My question is while this list is being read, all my PRINT statements seem to get pumped out to the interactive menu right away with bad values, but if I use viz.message() instead, it gives me what i want as data gets loaded, just in various popup windows.

Why do all the print statements get thrown out to the user at once, without waiting like viz.message() does?
Reply With Quote
  #2  
Old 01-19-2005, 11:36 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

When you run a script within Vizard, it is actually executed twice. It is first executed to check for errors. If there are no errors then the script is passed on to the graphics engine. During this first execution you can prevent certain code from being executed by doing the following:
Code:
if viz.running():
    #This code won't be called during first execution
viz.message works because it suppresses itself if it is called during the first execution. Vizard 2.5 will also suppress print statements during the first execution.
Reply With Quote
Reply


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


All times are GMT -7. The time now is 07:37 AM.


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