Exemplo n.º 1
0
    def on_validate(self):
        p1_cidi = self.p1_cid_pulldown.currentText()
        p2_cidi = self.p2_cid_pulldown.currentText()
        p3_cidi = self.p3_cid_pulldown.currentText()
        zaxis_cidi = self.zaxis_cid_pulldown.currentText()
        p1_cid = int(p1_cidi) if 'Global' not in p1_cidi else 0
        p2_cid = int(p2_cidi) if 'Global' not in p2_cidi else 0
        p3_cid = int(p3_cidi) if 'Global' not in p3_cidi else 0
        zaxis_cid = int(zaxis_cidi) if 'Global' not in zaxis_cidi else 0
        #print('p1_cidi=%r p2_cidi=%r p3_cidi=%r' % (p1_cidi, p2_cidi, zaxis_cidi))
        #print('p2_cid=%r p2_cid=%r p3_cidi=%r' % (p2_cid, p2_cid, zaxis_cid))

        p1_x, flag1 = check_float(self.p1_x_edit)
        p1_y, flag2 = check_float(self.p1_y_edit)
        p1_z, flag3 = check_float(self.p1_z_edit)

        p2_x, flag4 = check_float(self.p2_x_edit)
        p2_y, flag5 = check_float(self.p2_y_edit)
        p2_z, flag6 = check_float(self.p2_z_edit)

        p3_x, flag7 = check_float(self.p3_x_edit)
        p3_y, flag8 = check_float(self.p3_y_edit)
        p3_z, flag9 = check_float(self.p3_z_edit)
        p1 = [p1_x, p1_y, p1_z]
        p2 = [p2_x, p2_y, p2_z]
        p3 = [p3_x, p3_y, p3_z]

        flag10, flag11, flag12, zaxis_cid, zaxis = get_zaxis(
            self.win_parent, # for camera
            self.zaxis_method_pulldown,
            self.zaxis_x_edit, self.zaxis_y_edit, self.zaxis_z_edit)

        method = self.method_pulldown.currentText()
        assert method in self.methods, 'method=%r' % method
        flag13 = True

        plane_opacity = self.plane_opacity_edit.value()
        nplanes = self.nplanes_spinner.value()

        csv_filename = None
        flag14 = True
        if self.export_checkbox.isChecked():
            csv_filename, flag14 = check_save_path(self.csv_edit)

        flags = [flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8, flag9,
                 flag10, flag11, flag12,
                 flag13, flag14]
        if all(flags):
            self.out_data['method'] = method
            self.out_data['p1'] = [p1_cid, p1]
            self.out_data['p2'] = [p2_cid, p2]
            self.out_data['p3'] = [p3_cid, p3]
            self.out_data['zaxis'] = [zaxis_cid, zaxis]
            self.out_data['plane_color'] = self.plane_color_float
            self.out_data['plane_opacity'] = plane_opacity
            self.out_data['nplanes'] = nplanes
            self.out_data['csv_filename'] = csv_filename
            self.out_data['clicked_ok'] = True
            return True
        return False
Exemplo n.º 2
0
    def on_validate(self):
        p1_cidi = self.p1_cid_pulldown.currentText()
        p2_cidi = self.p2_cid_pulldown.currentText()
        zaxis_cidi = self.zaxis_cid_pulldown.currentText()
        p1_cid = int(p1_cidi) if 'Global' not in p1_cidi else 0
        p2_cid = int(p2_cidi) if 'Global' not in p2_cidi else 0
        zaxis_cid = int(zaxis_cidi) if 'Global' not in zaxis_cidi else 0
        #print('p1_cidi=%r p2_cidi=%r p3_cidi=%r' % (p1_cidi, p2_cidi, zaxis_cidi))
        #print('p2_cid=%r p2_cid=%r p3_cidi=%r' % (p2_cid, p2_cid, zaxis_cid))

        p1_x, flag0 = check_float(self.p1_x_edit)
        p1_y, flag1 = check_float(self.p1_y_edit)
        p1_z, flag2 = check_float(self.p1_z_edit)

        p2_x, flag3 = check_float(self.p2_x_edit)
        p2_y, flag4 = check_float(self.p2_y_edit)
        p2_z, flag5 = check_float(self.p2_z_edit)
        p1 = [p1_x, p1_y, p1_z]
        p2 = [p2_x, p2_y, p2_z]

        flag6, flag7, flag8, zaxis_cid, zaxis = get_zaxis(
            self.win_parent,  # for camera
            self.zaxis_method_pulldown,
            self.zaxis_x_edit,
            self.zaxis_y_edit,
            self.zaxis_z_edit)
        #print('zaxis =', zaxis)

        method = self.method_pulldown.currentText()
        assert method in self.methods, 'method=%r' % method
        flag9 = True

        ytol, flag10 = check_float(self.ytol_edit)
        zero_tol, flag11 = check_float(self.zero_tol_edit)

        csv_filename = None
        flag12 = True
        if self.export_checkbox.isChecked():
            csv_filename, flag12 = check_save_path(self.csv_edit)

        flags = [
            flag0, flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8,
            flag9, flag10, flag11, flag12
        ]
        if all(flags):
            self.out_data['method'] = method
            self.out_data['p1'] = [p1_cid, p1]
            self.out_data['p2'] = [p2_cid, p2]
            self.out_data['zaxis'] = [zaxis_cid, zaxis]
            self.out_data['ytol'] = ytol
            self.out_data['zero_tol'] = zero_tol
            self.out_data['plane_color'] = self.plane_color_float
            self.out_data['plane_opacity'] = 0.6
            self.out_data['csv_filename'] = csv_filename
            self.out_data['clicked_ok'] = True
            return True
        return False
Exemplo n.º 3
0
    def on_validate(self):
        p1_cidi = self.p1_cid_pulldown.currentText()
        p2_cidi = self.p2_cid_pulldown.currentText()
        zaxis_cidi = self.zaxis_cid_pulldown.currentText()
        p1_cid = int(p1_cidi) if 'Global' not in p1_cidi else 0
        p2_cid = int(p2_cidi) if 'Global' not in p2_cidi else 0
        zaxis_cid = int(zaxis_cidi) if 'Global' not in zaxis_cidi else 0
        #print('p1_cidi=%r p2_cidi=%r p3_cidi=%r' % (p1_cidi, p2_cidi, zaxis_cidi))
        #print('p2_cid=%r p2_cid=%r p3_cidi=%r' % (p2_cid, p2_cid, zaxis_cid))

        p1_x, flag0 = check_float(self.p1_x_edit)
        p1_y, flag1 = check_float(self.p1_y_edit)
        p1_z, flag2 = check_float(self.p1_z_edit)

        p2_x, flag3 = check_float(self.p2_x_edit)
        p2_y, flag4 = check_float(self.p2_y_edit)
        p2_z, flag5 = check_float(self.p2_z_edit)
        p1 = [p1_x, p1_y, p1_z]
        p2 = [p2_x, p2_y, p2_z]

        zaxis_method = str(self.zaxis_method_pulldown.currentText())
        flag6, flag7, flag8 = True, True, True
        if zaxis_method == 'Global Z':
            zaxis = [0., 0., 1.]
            zaxis_cid = 0
        elif zaxis_method == 'Manual':
            zaxis_x, flag6 = check_float(self.zaxis_x_edit)
            zaxis_y, flag7 = check_float(self.zaxis_y_edit)
            zaxis_z, flag8 = check_float(self.zaxis_z_edit)
            zaxis = [zaxis_x, zaxis_y, zaxis_z]
        elif zaxis_method == 'Camera Normal':
            if self.win_parent is not None:
                camera = self.win_parent.GetCamera()
                zaxis = camera.GetViewPlaneNormal()
            else:
                zaxis = [1., 1., 1.]
            zaxis_cid = 0
        else:
            raise NotImplementedError(zaxis_method)
        #print('zaxis =', zaxis)

        method = self.method_pulldown.currentText()
        assert method in self.methods, 'method=%r' % method
        flag9 = True

        ytol, flag10 = check_float(self.ytol_edit)
        zero_tol, flag11 = check_float(self.zero_tol_edit)

        csv_filename = None
        flag12 = True
        if self.export_checkbox.isChecked():
            csv_filename, flag12 = check_save_path(self.csv_edit)

        flags = [
            flag0, flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8,
            flag9, flag10, flag11, flag12
        ]
        if all(flags):
            self.out_data['method'] = method
            self.out_data['p1'] = [p1_cid, p1]
            self.out_data['p2'] = [p2_cid, p2]
            self.out_data['zaxis'] = [zaxis_method, zaxis_cid, zaxis]
            self.out_data['ytol'] = ytol
            self.out_data['zero_tol'] = zero_tol
            self.out_data['plane_color'] = self.plane_color_float
            self.out_data['plane_opacity'] = 0.6
            self.out_data['csv_filename'] = csv_filename
            self.out_data['clicked_ok'] = True
            return True
        return False