-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
CAM: Post Process only selected Operations #22764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
tarman3
wants to merge
1
commit into
FreeCAD:main
Choose a base branch
from
tarman3:postprocess
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# *************************************************************************** | ||
# * Copyright (c) 2016 sliptonic <[email protected]> * | ||
# * Copyright (c) 2022 Larry Woestman <[email protected]> * | ||
|
@@ -132,7 +132,7 @@ | |
# def tearDown(self): | ||
# FreeCAD.closeDocument(self.doc.Name) | ||
|
||
def test000(self): | ||
# Test basic name generation with empty string | ||
FreeCAD.setActiveDocument(self.doc.Label) | ||
teststring = "" | ||
|
@@ -154,7 +154,7 @@ | |
self, filename, os.path.join(self.testfilepath, f"{self.testfilename}.nc") | ||
) | ||
|
||
def test010(self): | ||
# Substitute current file path | ||
teststring = "%D/testfile.nc" | ||
self.job.PostProcessorOutputFile = teststring | ||
|
@@ -167,7 +167,7 @@ | |
print(os.path.normpath(filename)) | ||
assertFilePathsEqual(self, filename, f"{self.testfilepath}/testfile.nc") | ||
|
||
def test015(self): | ||
# Test basic string substitution without splitting | ||
teststring = "~/Desktop/%j.nc" | ||
self.job.PostProcessorOutputFile = teststring | ||
|
@@ -184,7 +184,7 @@ | |
# filename = PathPost.resolveFileName(self.job, subpart, 0) | ||
assertFilePathsEqual(self, filename, "~/Desktop/MainJob.nc") | ||
|
||
def test020(self): | ||
teststring = "%d.nc" | ||
self.job.PostProcessorOutputFile = teststring | ||
Path.Preferences.setOutputFileDefaults(teststring, "Append Unique ID on conflict") | ||
|
@@ -197,7 +197,7 @@ | |
|
||
assertFilePathsEqual(self, filename, expected) | ||
|
||
def test030(self): | ||
teststring = "%M/outfile.nc" | ||
self.job.PostProcessorOutputFile = teststring | ||
Path.Preferences.setOutputFileDefaults(teststring, "Append Unique ID on conflict") | ||
|
@@ -208,7 +208,7 @@ | |
|
||
assertFilePathsEqual(self, filename, f"{self.macro}outfile.nc") | ||
|
||
def test040(self): | ||
# unused substitution strings should be ignored | ||
teststring = "%d%T%t%W%O/testdoc.nc" | ||
self.job.PostProcessorOutputFile = teststring | ||
|
@@ -244,7 +244,7 @@ | |
filename = next(filename_generator) | ||
assertFilePathsEqual(self, filename, expected_filename) | ||
|
||
def test050(self): | ||
# explicitly using the sequence number should include it where indicated. | ||
teststring = "%S-%d.nc" | ||
self.job.PostProcessorOutputFile = teststring | ||
|
@@ -272,7 +272,7 @@ | |
assertFilePathsEqual(self, filename, f"{self.macro}outfile-Tool.nc") | ||
|
||
|
||
class TestResolvingPostProcessorName(unittest.TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True") | ||
|
@@ -291,7 +291,7 @@ | |
def tearDown(self): | ||
pass | ||
|
||
def test010(self): | ||
# Test if post is defined in job | ||
with patch("Path.Post.Processor.PostProcessor.exists", return_value=True): | ||
postname = PathCommand._resolve_post_processor_name(self.job) | ||
|
@@ -349,20 +349,20 @@ | |
|
||
def test020(self): | ||
# test creation of postprocessor object | ||
post = PostProcessorFactory.get_post_processor(self.job, "generic") | ||
post = PostProcessorFactory.get_post_processor(self.job, "generic", None) | ||
self.assertTrue(post is not None) | ||
self.assertTrue(hasattr(post, "export")) | ||
self.assertTrue(hasattr(post, "_buildPostList")) | ||
|
||
def test030(self): | ||
# test wrapping of old school postprocessor scripts | ||
post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc") | ||
post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc", None) | ||
self.assertTrue(post is not None) | ||
self.assertTrue(hasattr(post, "_buildPostList")) | ||
|
||
def test040(self): | ||
"""Test that the __name__ of the postprocessor is correct.""" | ||
post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc") | ||
post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc", None) | ||
self.assertEqual(post.script_module.__name__, "linuxcnc_post") | ||
|
||
|
||
|
@@ -388,21 +388,21 @@ | |
|
||
def test010(self): | ||
"""Test the export function.""" | ||
post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc") | ||
post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc", None) | ||
sections = post.export() | ||
for sec in sections: | ||
print(sec[0]) | ||
|
||
def test020(self): | ||
"""Test the export function with splitting.""" | ||
post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc") | ||
post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc", None) | ||
sections = post.export() | ||
for sec in sections: | ||
print(sec[0]) | ||
|
||
def test030(self): | ||
"""Test the export function with splitting.""" | ||
post = PostProcessorFactory.get_post_processor(self.job, "generic") | ||
post = PostProcessorFactory.get_post_processor(self.job, "generic", None) | ||
sections = post.export() | ||
for sec in sections: | ||
print(sec[0]) | ||
|
@@ -576,18 +576,18 @@ | |
def test010(self): | ||
"""Test the utility functions in the PostUtils.py file.""" | ||
commands = [ | ||
Path.Command("G1 X-7.5 Y5.0 Z0.0"), | ||
Path.Command("G2 I2.5 J0.0 K0.0 X-5.0 Y7.5 Z0.0"), | ||
Path.Command("G1 X5.0 Y7.5 Z0.0"), | ||
Path.Command("G2 I0.0 J-2.5 K0.0 X7.5 Y5.0 Z0.0"), | ||
Path.Command("G1 X7.5 Y-5.0 Z0.0"), | ||
Path.Command("G2 I-2.5 J0.0 K0.0 X5.0 Y-7.5 Z0.0"), | ||
Path.Command("G1 X-5.0 Y-7.5 Z0.0"), | ||
Path.Command("G2 I0.0 J2.5 K0.0 X-7.5 Y-5.0 Z0.0"), | ||
Path.Command("G1 X-7.5 Y0.0 Z0.0"), | ||
] | ||
|
||
testpath = Path.Path(commands) | ||
self.assertTrue(len(testpath.Commands) == 9) | ||
self.assertTrue(len([c for c in testpath.Commands if c.Name in ["G2", "G3"]]) == 4) | ||
|
||
|
@@ -628,7 +628,7 @@ | |
FreeCAD.closeDocument(cls.doc.Name) | ||
|
||
def setUp(self): | ||
self.pp = PathPost.PostProcessor(self.job, "generic", "", "") | ||
self.pp = PathPost.PostProcessor(self.job, None, "generic", "", "") | ||
|
||
def tearDown(self): | ||
pass | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3 | ||
# *************************************************************************** | ||
# * Copyright (c) 2025 Clair-Loup Sergent <[email protected]> * | ||
# * * | ||
# * Licensed under the EUPL-1.2 with the specific provision * | ||
# * (EUPL articles 14 & 15) that the applicable law is the French law. * | ||
|
@@ -40,7 +40,7 @@ | |
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True") | ||
cls.doc = FreeCAD.open(FreeCAD.getHomePath() + "/Mod/CAM/CAMTests/boxtest.fcstd") | ||
cls.job = cls.doc.getObject("Job") | ||
cls.post = PostProcessorFactory.get_post_processor(cls.job, "snapmaker") | ||
cls.post = PostProcessorFactory.get_post_processor(cls.job, "snapmaker", None) | ||
# locate the operation named "Profile" | ||
for op in cls.job.Operations.Group: | ||
if op.Label == "Profile": | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.