Exemple #1
0
    def addon_exportbrep(self):
        ok, path, shape = self.export_file_for_one_shape(
            filters="*.brep;;*.*", defaultFilter="*.brep")

        if ok == False or path == "":
            return

        pyservoce.brep_write(shape, path)
        print("Save BREP procedure finished.")
Exemple #2
0
    def exportBrepAction(self):
        filters = "*.brep;;*.*"
        defaultFilter = "*.brep"

        path = QFileDialog.getSaveFileName(self, "BREP Export",
                                           QDir.currentPath(), filters,
                                           defaultFilter)

        path = path[0]

        pyservoce.brep_write(self.dispw.scene[0].shape(), path)
Exemple #3
0
 def to_freecad_action(self):
     tmpfl = tempfile.mktemp(".brep")
     print(tmpfl)
     cb = QApplication.clipboard()
     cb.clear(mode=cb.Clipboard)
     cb.setText(
         'import Part; export = Part.Shape(); export.read("{}"); Part.show(export); Gui.activeDocument().activeView().viewAxonometric(); Gui.SendMsgToActiveView("ViewFit")'
         .format(tmpfl),
         mode=cb.Clipboard,
     )
     pyservoce.brep_write(self.dispw.scene[0].shape(), tmpfl)
     QMessageBox.information(self, self.tr("ToFreeCad"),
                             self.tr("Script copied to clipboard"))
Exemple #4
0
    def addon_to_freecad_action(self):
        import tempfile

        if self.scene.total() != 1 + self.count_of_helped_shapes:
            print("more/less than one shape in scene:",
                  self.scene.total() - self.count_of_helped_shapes)
            return False, "", None

        tmpfl = tempfile.mktemp(".brep")
        #print(tmpfl)
        cb = QApplication.clipboard()
        cb.clear(mode=cb.Clipboard)
        cb.setText(
            'import Part; export = Part.Shape(); export.read("{}"); Part.show(export); Gui.activeDocument().activeView().viewAxonometric(); Gui.SendMsgToActiveView("ViewFit")'
            .format(tmpfl),
            mode=cb.Clipboard,
        )
        pyservoce.brep_write(self.scene[0].shape(), tmpfl)
        QMessageBox.information(
            self, self.tr("ToFreeCad"),
            self.
            tr("Script copied to clipboard. Don't close gui before script placing."
               ))
Exemple #5
0
def to_brep(model, path):
	path = os.path.expanduser(path)
	pyservoce.brep_write(model, path)
Exemple #6
0
def to_brep(model, path):
    pyservoce.brep_write(model, path)