Squeeze the most out of Vr with Python.


Occasional ramblings on the topic of Python. Maybe some general info, but more than likely fairly limited to programming within the VrOne mapping environment

Eventually this will hold information that is better suited to a web page than a blog. For now I'll just start with code snippets or scripts. Just open them with a text editor or download and view them.

showll.py Is an example of using the VrApp class to create an app that displays Lat Long in real time as you move the mouse around the screen. It is built with pyproj and only has two datums by default Ohio North and Ohio South, you can toggle between them using button 2.

SetBoundary.py is a working program whose main purpose is to hold the code necessary to set spatial boundaries for processing other data. It is meant to be cleaned up and included in other programs where such a spatial filter would be helpful.

Copyright.txt is what I have decided to place as the header to all files I write. I humbly offer it for review as a standard for VrPython scripts

fix_sym_z.py  Everything before the line Gui = PyVrGui() should be deleted since it just has to do with making the script self-documenting. 

add_areas.py This one is the example of summing the areas of all the lines identified then displaying the sum. Lots of interesting concepts introduced.

inslin_inh.py Simple add on tool to begin a line with most of the properties of a line that is identifed from the file.

dig2txt.py A one click, digitize a location to a text file.

round_xy.py Will round every point of every line in a user defined layer to the nearest even foot.

scrcen.py Just displays a north arrow at screen center, tics at edge centers, and a line to current cursor position. But starts to look at PyVrGr()

try-except.py Gives an example of how to use the try and except blocks to trap errors.

clear_arc.py offers a way to clear arc codes for individual lines with one click.

save_lay_stat.py is just a simple way to save the current on/off status of layers to an external file. Homework is to write the partner get_lay_stat.py 

testargv.py is will simply show you what arguments look like when passed to python. Download then run "python testargv.py", for the fun of it add a couple of arguments like "python testargv.py arg1 arg2"

testglob.py is an example of building a file list using glob and extracting file name parts using os.path. This is meant to run on a common Vr directory which would need to be changed if it isn't run on a computer with Vr installed.

opp2txt.py a command line utility which will open each opp file in the launch directory and print the xyz coordinates contained to the screen.

wsman.py sets the current active workspace based on a combo box containing names of open files.

sample_multiselect.py is just a snippet of example code for using a standard file open dialog to select multiple files.

SaveParams.py is an example of using an external file to save values entered in a prompt box.

ToggleSuite.py a collection of scripts to toggle certain display settings.

testbinary.py is a lesson in reading and writing binary files, using the example of persistent parameters.

parprt.py will parallel part of an idetified line using either an argument, a digitized distance, or a dialog box to gather the offset. This one will require VrOne greater than 3.03.29.

inhent.py If you are inserting an entity and want to grab the attributes from another entity to use for a while then inhent is just the ticket.