def section(script, axis='<STR_LIT:z>', offset=<NUM_LIT:0.0>, surface=False, custom_axis=None,<EOL>planeref=<NUM_LIT:2>):
<EOL>if axis.lower() == '<STR_LIT:x>':<EOL><INDENT>axis_num = <NUM_LIT:0><EOL>axis_name = '<STR_LIT:X>'<EOL><DEDENT>elif axis.lower() == '<STR_LIT:y>':<EOL><INDENT>axis_num = <NUM_LIT:1><EOL>axis_name = '<STR_LIT:Y>'<EOL><DEDENT>elif axis.lower() == '<STR_LIT:z>':<EOL><INDENT>axis_num = <NUM_LIT:2><EOL>axis_name = '<STR_LIT>'<EOL><DEDENT>else:  <EOL><INDENT>axis_num = <NUM_LIT:3><EOL>axis_name = '<STR_LIT>'<EOL>if custom_axis is None:<EOL><INDENT>print('<STR_LIT>',<EOL>'<STR_LIT>')<EOL><DEDENT><DEDENT>if custom_axis is None:<EOL><INDENT>custom_axis = (<NUM_LIT:0.0>, <NUM_LIT:0.0>, <NUM_LIT:1.0>)<EOL><DEDENT>filter_xml = '<STR_LIT>'.join([<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(axis_num),<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(custom_axis[<NUM_LIT:0>], custom_axis[<NUM_LIT:1>],<EOL>custom_axis[<NUM_LIT:2>]),<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(offset),<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(planeref),<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(str(surface).lower()),<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'])<EOL>util.write_filter(script, filter_xml)<EOL>if isinstance(script, mlx.FilterScript):<EOL><INDENT>current_layer_label = script.layer_stack[script.current_layer()]<EOL>script.add_layer('<STR_LIT>'.format(current_layer_label, axis_name,<EOL>int(offset)))<EOL>if surface:<EOL><INDENT>script.add_layer('<STR_LIT>'.format(current_layer_label,<EOL>axis_name, int(offset)))<EOL><DEDENT><DEDENT>return None<EOL>
Compute the polyline representing a planar section (a slice) of a mesh.

    If the resulting polyline is closed the result can be filled with a
    triangular mesh representing the section.

    Args:
        script: the mlx.FilterScript object or script filename to write
            the filter to.
        axis (str): The slicing plane is perpendicular to this axis. Accepted
            values are 'x', 'y', or 'z'; any other input will be interpreted
            as a custom axis (although using 'custom' is recommended
            for clarity). Upper or lowercase values are accepted.
        offset (float): Specify an offset of the cross-plane. The offset
            corresponds to the distance along 'axis' from the point specified
            in 'planeref'.
        surface (bool): If True, in addition to a layer with the section
            polyline, also a layer with a triangulated version of the section
            polyline will be created. This only works if the section polyline
            is closed.
        custom_axis (3 component list or tuple): Specify a custom axis as
            a 3 component vector (x, y, z); this is ignored unless 'axis' is
            set  to 'custom'.
        planeref (int): Specify the reference from which the planes are
            shifted. Valid values are:
            0 - Bounding box center
            1 - Bounding box min
            2 - Origin (default)

    Layer stack:
        Creates a new layer '{label}_sect_{axis_name}_{offset}', where
            'axis_name' is one of [X, Y, Z, custom] and 'offest' is
            truncated 'offset'
        If surface is True, create a new layer '{label}_sect_{axis}_{offset}_mesh'
        Current layer is changed to the last (newly created) layer

    MeshLab versions:
        2016.12
        1.3.4BETA