# Path: lasercut/material.py
# class MaterialProperties(ObjectProperties):
# 
#     _allowed = ('type', 'thickness', 'thickness_tolerance', 'hole_width_tolerance',
#                 'laser_beam_diameter', 'name', 'label', 'link_name',
#                 # For cross Part
#                 'dog_bone', 'node_type', 'node_thickness') #'freecad_object_index'
#     TYPE_LASER_CUT = 1
#     NODE_NO = "No node"
#     NODE_SINGLE_SHORT = 'Single short'
#     NODE_SINGLE_LONG = 'Single long'
#     NODE_DUAL_SHORT = 'Dual short'
# 
#     def __init__(self, **kwargs):
#         super(MaterialProperties, self).__init__(**kwargs)
#         self.freecad_object = None
#         #if not hasattr(self, 'freecad_object_index'):
#         #    raise ValueError("Must defined freecad object")
#         if not hasattr(self, 'type'):
#             self.type = self.TYPE_LASER_CUT
#         if not hasattr(self, 'thickness'):
#             self.thickness = 5.0
#             try:
#                 #self.thickness = retrieve_thickness_from_biggest_face(self.freecad_object)
#                 self.thickness = retrieve_thickness_from_biggest_face(kwargs['freecad_object'])
#                 # FreeCAD.Console.PrintError("found : %f\n" % self.thickness)
#             except ValueError as e:
#                 FreeCAD.Console.PrintError(e)
#         if not hasattr(self, 'thickness_tolerance'):
#             self.thickness_tolerance = 0.1 * self.thickness
#         if not hasattr(self, 'laser_beam_diameter'):
#             self.laser_beam_diameter = self.thickness / 15.0
#         if not hasattr(self, 'new_name'):
#             self.new_name = "%s_tab" % kwargs['freecad_object'].Label
#         if not hasattr(self, 'hole_width_tolerance'):
#             self.hole_width_tolerance = 0.0
#         # For cross part
#         if not hasattr(self, 'dog_bone'):
#             self.dog_bone = True
#         if not hasattr(self, 'node_type'):
#             self.node_type = self.NODE_NO
#         if not hasattr(self, 'node_thickness'):
#             self.node_thickness = 0.05 * self.thickness
#         if not hasattr(self, 'link_name'):
#             self.link_name = ""
# 
#     def recomputeInit(self, freecad_obj):
#         self.freecad_object = freecad_obj
#         thickness = retrieve_thickness_from_biggest_face(freecad_obj)
#         if compare_value(thickness, self.thickness) is False:
#             FreeCAD.Console.PrintError("Recomputed thickness for %s is different (%f != %f)\n" % (self.name, thickness, self.thickness))


import Part
import FreeCAD
import itertools
import lasercut.helper as helper
from lasercut.material import MaterialProperties
        nodes_list.append(node_right_down)
    else:
        raise ValueError("Not implemented")

    for node in nodes_list:
        shape = shape.cut(node)

    return shape


def make_nodes_yz(shape, thickness, y_length, z_length, node_type, node_thickness):

    if node_type == MaterialProperties.NODE_NO:
        return shape

    nodes_list = []
    if node_type == MaterialProperties.NODE_SINGLE_SHORT:
        node_left = make_node_yz(node_thickness, z_length / 4.0, thickness, True)
        node_right = make_node_yz(node_thickness, z_length / 4.0, thickness, False)
        node_left.translate(FreeCAD.Vector(0, -y_length/2.0, -z_length / 2.0))
        node_right.translate(FreeCAD.Vector(0, y_length/2.0, -z_length / 2.0))
        nodes_list.append(node_left)
        nodes_list.append(node_right)
    elif node_type == MaterialProperties.NODE_SINGLE_LONG:
        node_left = make_node_yz(node_thickness, z_length / 2.0, thickness, True)
        node_right = make_node_yz(node_thickness, z_length / 2.0, thickness, False)
        node_left.translate(FreeCAD.Vector(0, -y_length/2.0, -z_length / 2.0))
        node_right.translate(FreeCAD.Vector(0, y_length/2.0, -z_length / 2.0))
        nodes_list.append(node_left)
        nodes_list.append(node_right)

# Path: lasercut/material.py
# class MaterialProperties(ObjectProperties):
# 
#     _allowed = ('type', 'thickness', 'thickness_tolerance', 'hole_width_tolerance',
#                 'laser_beam_diameter', 'name', 'label', 'link_name',
#                 # For cross Part
#                 'dog_bone', 'node_type', 'node_thickness') #'freecad_object_index'
#     TYPE_LASER_CUT = 1
#     NODE_NO = "No node"
#     NODE_SINGLE_SHORT = 'Single short'
#     NODE_SINGLE_LONG = 'Single long'
#     NODE_DUAL_SHORT = 'Dual short'
# 
#     def __init__(self, **kwargs):
#         super(MaterialProperties, self).__init__(**kwargs)
#         self.freecad_object = None
#         #if not hasattr(self, 'freecad_object_index'):
#         #    raise ValueError("Must defined freecad object")
#         if not hasattr(self, 'type'):
#             self.type = self.TYPE_LASER_CUT
#         if not hasattr(self, 'thickness'):
#             self.thickness = 5.0
#             try:
#                 #self.thickness = retrieve_thickness_from_biggest_face(self.freecad_object)
#                 self.thickness = retrieve_thickness_from_biggest_face(kwargs['freecad_object'])
#                 # FreeCAD.Console.PrintError("found : %f\n" % self.thickness)
#             except ValueError as e:
#                 FreeCAD.Console.PrintError(e)
#         if not hasattr(self, 'thickness_tolerance'):
#             self.thickness_tolerance = 0.1 * self.thickness
#         if not hasattr(self, 'laser_beam_diameter'):
#             self.laser_beam_diameter = self.thickness / 15.0
#         if not hasattr(self, 'new_name'):
#             self.new_name = "%s_tab" % kwargs['freecad_object'].Label
#         if not hasattr(self, 'hole_width_tolerance'):
#             self.hole_width_tolerance = 0.0
#         # For cross part
#         if not hasattr(self, 'dog_bone'):
#             self.dog_bone = True
#         if not hasattr(self, 'node_type'):
#             self.node_type = self.NODE_NO
#         if not hasattr(self, 'node_thickness'):
#             self.node_thickness = 0.05 * self.thickness
#         if not hasattr(self, 'link_name'):
#             self.link_name = ""
# 
#     def recomputeInit(self, freecad_obj):
#         self.freecad_object = freecad_obj
#         thickness = retrieve_thickness_from_biggest_face(freecad_obj)
#         if compare_value(thickness, self.thickness) is False:
#             FreeCAD.Console.PrintError("Recomputed thickness for %s is different (%f != %f)\n" % (self.name, thickness, self.thickness))


# Path: lasercut/crosspart.py
import Part
import FreeCAD
import itertools
import lasercut.helper as helper
from lasercut.material import MaterialProperties

        nodes_list.append(node_right_down)
    else:
        raise ValueError("Not implemented")

    for node in nodes_list:
        shape = shape.cut(node)

    return shape


def make_nodes_yz(shape, thickness, y_length, z_length, node_type, node_thickness):

    if node_type == MaterialProperties.NODE_NO:
        return shape

    nodes_list = []
    if node_type == MaterialProperties.NODE_SINGLE_SHORT:
        node_left = make_node_yz(node_thickness, z_length / 4.0, thickness, True)
        node_right = make_node_yz(node_thickness, z_length / 4.0, thickness, False)
        node_left.translate(FreeCAD.Vector(0, -y_length/2.0, -z_length / 2.0))
        node_right.translate(FreeCAD.Vector(0, y_length/2.0, -z_length / 2.0))
        nodes_list.append(node_left)
        nodes_list.append(node_right)
    elif node_type == MaterialProperties.NODE_SINGLE_LONG:
        node_left = make_node_yz(node_thickness, z_length / 2.0, thickness, True)
        node_right = make_node_yz(node_thickness, z_length / 2.0, thickness, False)
        node_left.translate(FreeCAD.Vector(0, -y_length/2.0, -z_length / 2.0))
        node_right.translate(FreeCAD.Vector(0, y_length/2.0, -z_length / 2.0))
        nodes_list.append(node_left)
        nodes_list.append(node_right)

    elif node_type == MaterialProperties.NODE_DUAL_SHORT: