Esempio n. 1
0
 def generate(self):
     i = 0
     for ij in range(len(self.OK)):
         if self.OK[ij] == True:
             i = i + 1
     if i == 5:
         self.STL = self.message1["text"]
         self.angle = self.angle_verif.get()
         self.bridge = self.length_verif.get()
         self.shape = int(self.var_choix.get())
         my_mesh = mesh.Mesh.from_file(self.STL)
         normal = my_mesh.normals
         vertices = my_mesh.points
         from Support_finder import support_45deg_rule
         from Support_finder import needed_support_Bridge_rule
         support_angle = support_45deg_rule(normal, vertices, self.angle)
         support_bridge = needed_support_Bridge_rule(
             normal, vertices, self.bridge)
         i = 0
         p = len(support_bridge)
         k = 0
         while i < p:
             if all(support_bridge[k][0, 0:9] == 0):
                 del support_bridge[k]
             else:
                 k = k + 1
             p = p - 1
         liste_support = []
         liste_support = support_bridge + support_angle
         ListeContour = []
         from Support_Generator import AreasWithSameAngle, FindContour, Projection
         from Support_Shape import thetraedral_simple_support, Rectangular_simple_support, gridxy, ZigZag, plot
         for i in range(len(liste_support)):
             A = AreasWithSameAngle(liste_support[i])
             ListeContour.append(FindContour(A))
         ListeProjete = Projection(ListeContour)
         ListeProjete_shape = np.shape(ListeProjete)
         if len(ListeProjete) == 0:
             print("you do not need any support")
         else:
             n = 0
             Faces = np.zeros((0, 12))
             if ListeProjete_shape[2] == 3:
                 while n < ListeProjete_shape[0]:
                     The = thetraedral_simple_support(
                         ListeProjete[:][n][:][:])
                     Faces = np.append(Faces, The, axis=0)
                     n += 1
                 plot(Faces, my_mesh, -50, 50, 0, 80)
             else:
                 if self.shape == 1:
                     while n < ListeProjete_shape[0]:
                         Rec = Rectangular_simple_support(
                             ListeProjete[:][n][:][:])
                         Faces = np.append(Faces, Rec, axis=0)
                         n += 1
                 elif self.shape == 3:
                     while n < ListeProjete_shape[0]:
                         Grid = gridxy(ListeProjete[:][n][:][:],
                                       float(self.pathN))
                         Faces = np.append(Faces, Grid, axis=0)
                         n += 1
                 elif self.shape == 2:
                     while n < ListeProjete_shape[0]:
                         ZZ = ZigZag(ListeProjete[:][n][:][:],
                                     float(self.pathN))
                         Faces = np.append(Faces, ZZ, axis=0)
                         n += 1
                 plot(Faces, my_mesh, -30, 30, 0, 50)
Esempio n. 2
0
    A = AreasWithSameAngle(liste_support[i])
    ListeContour.append(FindContour(A))
ListeProjete = Projection(ListeContour)
ListeProjete_shape = np.shape(ListeProjete)

if len(ListeProjete) == 0:
    print("you do not need any support")
else:
    n = 0
    Faces = np.zeros((0, 12))
    if ListeProjete_shape[2] == 3:
        while n < ListeProjete_shape[0]:
            The = thetraedral_simple_support(ListeProjete[:][n][:][:])
            Faces = np.append(Faces, The, axis=0)
            n += 1
        plot(Faces, my_mesh, -50, 50, 0, 80)
    else:
        Choice = ShapeChoice()
        if Choice == 1:
            while n < ListeProjete_shape[0]:
                Rec = Rectangular_simple_support(ListeProjete[:][n][:][:])
                Faces = np.append(Faces, Rec, axis=0)
                n += 1
        elif Choice == 2:
            while n < ListeProjete_shape[0]:
                Grid = gridxy(ListeProjete[:][n][:][:], 1)
                Faces = np.append(Faces, Grid, axis=0)
                n += 1
        elif Choice == 3:
            while n < ListeProjete_shape[0]:
                ZZ = ZigZag(ListeProjete[:][n][:][:], 1)