コード例 #1
0
    def test080(self):
        # Split by Operation
        self.job.SplitOutput = True
        self.job.OrderOutputBy = "Operation"
        outlist = PathPost.buildPostList(self.job)

        teststring = "%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "MainJob-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "MainJob-1.nc")

        teststring = "%O-%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "OutsideProfile-MainJob-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "DrillAllHoles-MainJob-1.nc")
コード例 #2
0
    def saveSettings(self):
        filePath = self.form.leDefaultFilePath.text()
        jobTemplate = self.form.leDefaultJobTemplate.text()
        geometryTolerance = Units.Quantity(self.form.geometryTolerance.text())
        curveAccuracy = Units.Quantity(self.form.curveAccuracy.text())
        PathPreferences.setJobDefaults(filePath, jobTemplate,
                                       geometryTolerance, curveAccuracy)

        if curveAccuracy:
            Path.Area.setDefaultParams(Accuracy=curveAccuracy)

        processor = str(self.form.defaultPostProcessor.currentText())
        args = str(self.form.defaultPostProcessorArgs.text())
        blacklist = []
        for i in range(0, self.form.postProcessorList.count()):
            item = self.form.postProcessorList.item(i)
            if item.checkState() == QtCore.Qt.CheckState.Unchecked:
                blacklist.append(item.text())
        PathPreferences.setPostProcessorDefaults(processor, args, blacklist)

        path = str(self.form.leOutputFile.text())
        policy = str(self.form.cboOutputPolicy.currentText())
        PathPreferences.setOutputFileDefaults(path, policy)
        self.saveStockSettings()
        self.saveToolsSettings()
コード例 #3
0
    def test070(self):
        # Split by WCS
        self.job.SplitOutput = True
        self.job.OrderOutputBy = "Fixture"
        outlist = PathPost.buildPostList(self.job)

        teststring = "%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "MainJob-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "MainJob-1.nc")

        teststring = "%W-%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "G54-MainJob-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "G55-MainJob-1.nc")
コード例 #4
0
 def test030(self):
     teststring = "%M/outfile.nc"
     self.job.PostProcessorOutputFile = teststring
     PathPreferences.setOutputFileDefaults(
         teststring, "Append Unique ID on conflict"
     )
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(filename, f"{self.macro}outfile.nc")
コード例 #5
0
 def test050(self):
     # explicitly using the sequence number should include it where indicated.
     teststring = "%S-%d.nc"
     self.job.PostProcessorOutputFile = teststring
     PathPreferences.setOutputFileDefaults(
         teststring, "Append Unique ID on conflict"
     )
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(filename, "0-test_filenaming.nc")
コード例 #6
0
 def test040(self):
     # unused substitution strings should be ignored
     teststring = "%d%T%t%W%O/testdoc.nc"
     self.job.PostProcessorOutputFile = teststring
     PathPreferences.setOutputFileDefaults(
         teststring, "Append Unique ID on conflict"
     )
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(
         os.path.normpath(filename),
         os.path.normpath(f"{self.testfilename}/testdoc.nc"),
     )
コード例 #7
0
 def test010(self):
     # Substitute current file path
     teststring = "%D/testfile.nc"
     self.job.PostProcessorOutputFile = teststring
     PathPreferences.setOutputFileDefaults(
         teststring, "Append Unique ID on conflict"
     )
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(
         os.path.normpath(filename),
         os.path.normpath(f"{self.testfilepath}/testfile.nc"),
     )
コード例 #8
0
    def test000(self):
        # Test basic name generation with empty string
        FreeCAD.setActiveDocument(self.doc.Label)
        teststring = ""
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        self.job.SplitOutput = False
        outlist = PathPost.buildPostList(self.job)

        self.assertTrue(len(outlist) == 1)
        subpart, objs = outlist[0]

        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, f"{self.testfilename}.nc")
コード例 #9
0
    def test015(self):
        # Test basic string substitution without splitting
        teststring = "~/Desktop/%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        self.job.SplitOutput = False
        outlist = PathPost.buildPostList(self.job)

        self.assertTrue(len(outlist) == 1)
        subpart, objs = outlist[0]

        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(
            os.path.normpath(filename), os.path.normpath("~/Desktop/MainJob.nc")
        )
コード例 #10
0
    def saveSettings(self):
        filePath = self.form.leDefaultFilePath.text()
        jobTemplate = self.form.leDefaultJobTemplate.text()
        geometryTolerance = Units.Quantity(self.form.geometryTolerance.text())
        curveAccuracy = Units.Quantity(self.form.curveAccuracy.text())
        PathPreferences.setJobDefaults(filePath, jobTemplate, geometryTolerance, curveAccuracy)

        if curveAccuracy:
            Path.Area.setDefaultParams(Accuracy = curveAccuracy)

        processor = str(self.form.defaultPostProcessor.currentText())
        args = str(self.form.defaultPostProcessorArgs.text())
        blacklist = []
        for i in range(0, self.form.postProcessorList.count()):
            item = self.form.postProcessorList.item(i)
            if item.checkState() == QtCore.Qt.CheckState.Unchecked:
                blacklist.append(item.text())
        PathPreferences.setPostProcessorDefaults(processor, args, blacklist)

        path = str(self.form.leOutputFile.text())
        policy = str(self.form.cboOutputPolicy.currentText())
        PathPreferences.setOutputFileDefaults(path, policy)
        self.saveStockSettings()
コード例 #11
0
    def test060(self):
        # # Split by Tool
        self.job.SplitOutput = True
        self.job.OrderOutputBy = "Tool"
        outlist = PathPost.buildPostList(self.job)

        # substitute jobname and use default sequence numbers
        teststring = "%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "MainJob-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "MainJob-1.nc")

        # Use Toolnumbers and default sequence numbers
        teststring = "%T.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        outlist = PathPost.buildPostList(self.job)
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "5-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "2-1.nc")

        # Use Tooldescriptions and default sequence numbers
        teststring = "%t.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        outlist = PathPost.buildPostList(self.job)
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "TC__7_16__two_flute-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "TC__Drill-1.nc")