I'm a novice programmer. I have a decent understanding of algorithms but I 
don't have a lot of computer science/software engineering experience. As a way 
to help me learn, I've begun a coordinate geometry program similar to the COGO 
program developed years ago at MIT. Currently, I store the points in a 
dictionary in the format point_number : [North, East]. I eventually will add a 
Z component to the points and possibly a description after I get enough of the 
horizontal geometry worked through. I would like to be able to save the point 
table so that I can have multiple projects. My main python script is below. It 
reads in a text file that contains commands to create/calculate the location of 
the various points. My question is what is a good method to store the point 
data outside of python? I eventually will also add the capability to define a 
baseline that consists of multiple points with some attributes to define 
relative locations along the baseline (stationing). 

I use enthought canopy express with python 2.7.11 on windows 10 64 bit. 

""" Coordinate geometry program """
import sys
from store_point import store_point
from clear_points import clear_points
from dump_points import dump_points
from redefine import redefine
from dist import dist
from locate_azimuth import locate_azimuth
from locate_bearing import locate_bearing
from locate_line import locate_line
from line_line_int import line_line_int
from parallel_line import parallel_line
from arc_line_pts import arc_line_pts
from divide_line import divide_line

try:
    infile = open(raw_input("Enter input file name; name.txt:"),'r')
except:
    print "Invalid filename"
    exit()

pt_table = {}
cmd_table = {"5":store_point, "7":clear_points, "8":dump_points,
                      "9":redefine, "10":dist, "11":locate_azimuth, 
"12":locate_bearing,
                      "15":locate_line, "18":parallel_line,
                      "19":line_line_int, "22":arc_line_pts, "40":divide_line}
count = 0

for line in infile:
    #print line
    args = line.split()
    cmd = args.pop(0)
    if cmd in cmd_table:
         func = cmd_table[cmd]
         func(pt_table, *args)

infile.close()

Thanks,
Colby                                     
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to