##ConsCircle2P.py Version 1.00

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

##All rights reserved.

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

"""

    Add a construction circle by picking the center point and a point on the arc.

"""

def run_script():

    # default construction line color

    cons_color = "Cyan"

    # startup code begin

    from param import yes_or_no, dim_print, Dialog

    from point import Point, PointLocate

    from cons_circle import ConsCircle

    # startup code end

    while 1:

        pt1 = PointLocate("Pick center point of construction circle")

        pt2 = PointLocate("Pick any point on the radius")

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

        ## DIALOG BOX 1 #################################

        dlg1 = Dialog("Two Point Construction Circle")

        dlg1.menu("cons_color", ["White", "Red", "Yellow", "Green", "Cyan", "Blue", "Magenta"], cons_color, "Construction line color")

        try:

            dd1 = dlg1.done()

        except ResponseNotOK:

            break

        for key, value in dd1.items():

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

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

        ## END DIALOG BOX 1 ------------------------------#

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

        # Add construction circle

        cc2 = ConsCircle()

        cc2.pt1 = pt1

        cc2.radius = pt1.dist(pt2)

        cc2.pen = cons_color

        cc2.add()

        if yes_or_no("Add additional construction circles?") == 0:

            break

## end run_script() #########################################################

if __name__ == '__main__':

    try:

        run_script()

    finally:

        del run_script