Using the NewProjects Folder
The NewProjects folder is a convenient place to store projects you are working on along with your custom resources in a separate folder. In order for this to work you can use the following steps. It is also recommended to make a copy of the "utils_minimum" folder and settings.py to C:\Program Files\WorldViz\Vizard7\bin\lib\site-packages. This will give you the auto-complete functionality when writing code. You can access a download of"utils_minimum" here.Â
Create a new folder inside "NewProjects" and give it a title
Inside this folder you can place your custom SightLab and Vizard scripts as well as your resources
At the top of your custom SightLab script add this code so that it can find the sightlab directory (note that the '..','..' means that the SightLab root folder is two levels up):
import os
original_cwd = os.getcwd()
os.chdir(os.path.abspath(os.path.join(os.path.dirname(__file__), '..','..')))
Place this code under your imports and change the name where it says "TestProject" to the name of the folder you created inside NewProjects
ProjectPath = 'NewProjects/TestProject/'When you reference any resources that are inside this folder use the following code, placing "(ProjectPath +" before the path. This example has a separate folder called "ProjectResources" inside your custom folder where the environment model is loading from
env = vizfx.addChild(ProjectPath + "ProjectResources/lab.osgb")
If wanting to use the GUI, add this code to set this location as your environments folder:
sightlab.set_env_path("../Demos/Shopping/resources/")
Now if you updated SightLab or move it, just copy over the NewProjects folder and you will have access to any custom projects