## Mem_MtrlSectView.py Version 2.00

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

## URL: www.bvdetailing.com

## All rights reserved.

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

"""

/// Add a section view to a member by selecting a material object.

/// The section is cut normal to the member line (the section plane is

/// perpendicular to the member plane). Adjust the depth check in the

/// defaults section.

///

/// User can be in any model orientation.

///

/// Version History:

///     Version 2.00 -   Initial version (12/15/07)

///

/// #########################################################################

/// ###### THIS VERSION WILL NOT WORK IN SDS/2 VERSIONS PRIOR TO 7.105 ######

/// #########################################################################

///

/// Go to 'Variables section to edit default values file path and file name

///

"""

# startup code begin

from param import yes_or_no, dim_print

from member import Member

from mtrl_list import MtrlLocate

from point import Point

from view import View

# startup code end

## Variables Section

## Defaults Section

depth_out = 6.0

depth_in = 6.0

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

def run_script():

    while True:

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

        m = MtrlLocate("Select material for view", 'Single')

        if not m: return

        mem = Member(m.member)

        if not mem: return

        pt_local = mem.trans_to_local(m.pt1-mem.left.location)

 

        ## view begin

        vw1 = View()

        vw1.member = mem

        vw1.pt1 = mem.left.location+mem.translate(pt_local.x, -(mem.depth+10.0), 0.0)

        vw1.pt2 = mem.left.location+mem.translate(pt_local.x, 10.0, 0.0)

        # vw1.mtrl = m

        vw1.face = "Web NS"

        vw1.depth_check_in = dim_print(depth_in)

        vw1.depth_check_out = dim_print(depth_out)

        vw1.add()

        ## view end

        if not yes_or_no("View added. Select another?"): return

## End run_script()

if __name__ == '__main__':

    try:

        run_script()

    finally:

        del run_script