Back to SDS/2 Parametric Scripts

##  ConsPoint.py Version 1.02

##  Copyright (c) 2006 Bruce Vaughan, BV Detailing & Design, Inc.

##  All rights reserved.

##  NOT FOR SALE. The software is provided "as is" without any warranty.

############################################################################

"""

    Add two perpendicular construction lines that represent a layout point at a fixed coordinate.

 

    Version 1.02 (8/8/07) - Add 'Point' before x,y,z, tuple in gridAdd to work in version 7.105

 

    Renamed from ConstPoint.py 11/7/07   

"""

def run_script():

    from param import Dialog, ResponseNotOK, yes_or_no, Units, dim_print, dim

    from point import Point

    Units("feet")

    from cons_line import ConsLine

 

    def gridAdd(x, y, z, r, cons_color="Cyan"):

        # construction line begin

        cl2 = ConsLine()

        cl2.pt1 = (dim(x), dim(y), dim(z))

        cl2.angle = r

        cl2.pen = cons_color

        cl2.add()

        # construction line end   

   

    x_coord = 0.0

    y_coord = 0.0

    z_coord = 0.0

 

    while True:

        ## Dialog Box ######################

        dlg1 = Dialog( "Create Construction Line Layout Point" )

        dlg1.line("COORDINATE INFORMATION")

        dlg1.entry("x_coord", dim_print(x_coord), "Enter X coordinate")

        dlg1.entry("y_coord", dim_print(y_coord), "Enter Y coordinate")

        dlg1.entry("z_coord", dim_print(z_coord), "Enter Z coordinate")

        try:

            dd1 = dlg1.done()

        except ResponseNotOK:

            break

       

        # Update local namespace

        for key, value in dd1.items():

            exec "%s = %s" % (key, repr(value)) in None

 

        gridAdd(x_coord, y_coord, z_coord, 0.0)

        gridAdd(x_coord, y_coord, z_coord, 90.0)

       

        if not yes_or_no("Add another?"):

            break

## END run_script() #########################

       

if __name__ == '__main__':

    try:

        run_script()

    finally:

        del run_script