Moved all post/pre processor into their own directory.

This commit is contained in:
Markus Lampert
2017-06-18 17:45:59 -07:00
parent a0d3d020eb
commit 074d012ec3
18 changed files with 33 additions and 19 deletions

View File

@@ -67,19 +67,19 @@ SET(PathScripts_SRCS
PathScripts/PathUtils.py
PathScripts/PostUtils.py
PathScripts/__init__.py
PathScripts/centroid_post.py
PathScripts/comparams_post.py
PathScripts/dumper_post.py
PathScripts/dynapath_post.py
PathScripts/example_post.py
PathScripts/example_pre.py
PathScripts/linuxcnc_post.py
PathScripts/opensbp_post.py
PathScripts/opensbp_pre.py
PathScripts/phillips_post.py
PathScripts/rml_post.py
PathScripts/slic3r_pre.py
PathScripts/smoothie_post.py
PathScripts/post/centroid_post.py
PathScripts/post/comparams_post.py
PathScripts/post/dumper_post.py
PathScripts/post/dynapath_post.py
PathScripts/post/example_post.py
PathScripts/post/example_pre.py
PathScripts/post/linuxcnc_post.py
PathScripts/post/opensbp_post.py
PathScripts/post/opensbp_pre.py
PathScripts/post/phillips_post.py
PathScripts/post/rml_post.py
PathScripts/post/slic3r_pre.py
PathScripts/post/smoothie_post.py
)

View File

@@ -83,7 +83,7 @@ private:
try {
std::string path = App::GetApplication().getHomePath();
path += "Mod/Path/PathScripts/";
path += "Mod/Path/PathScripts/post/";
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py"));
std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")
->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str());
@@ -150,7 +150,7 @@ private:
try {
std::string path = App::GetApplication().getHomePath();
path += "Mod/Path/PathScripts/";
path += "Mod/Path/PathScripts/post/";
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py"));
std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")
->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str());
@@ -226,7 +226,7 @@ private:
throw Py::RuntimeError("No object to export");
std::string path = App::GetApplication().getHomePath();
path += "Mod/Path/PathScripts/";
path += "Mod/Path/PathScripts/post/";
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_post.py"));
std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")
->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str());

View File

@@ -27,8 +27,9 @@ from __future__ import print_function
import FreeCAD
import FreeCADGui
import os
import PathScripts.PathLog as PathLog
import PathScripts.PathUtil as PathUtil
import os
from PathScripts import PathJob
from PathScripts import PathToolController
@@ -248,8 +249,9 @@ class CommandPathPost:
for obj in job.Group:
PathLog.debug("obj: {}".format(obj.Name))
if not isinstance(obj.Proxy, PathToolController.ToolController):
if obj.ToolController.ToolNumber != currTool:
postlist.append(obj.ToolController)
tc = PathUtil.toolControllerForOp(obj)
if tc.ToolNumber != currTool:
postlist.append(tc)
postlist.append(obj)
fail = True

View File

@@ -51,6 +51,10 @@ class PathPreferences:
def pathScriptsSourcePath(cls):
return FreeCAD.getHomePath() + ("Mod/Path/PathScripts/")
@classmethod
def pathScriptsPostSourcePath(cls):
return cls.pathScriptsSourcePath() + ("/post/")
@classmethod
def allAvailablePostProcessors(cls):
allposts = []
@@ -108,6 +112,7 @@ class PathPreferences:
if p:
paths.append(p)
paths.append(cls.macroFilePath())
paths.append(cls.pathScriptsPostSourcePath())
paths.append(cls.pathScriptsSourcePath())
return paths

View File

@@ -47,3 +47,10 @@ def isValidBaseObject(obj):
if hasattr(obj, 'Sheets') or hasattr(obj, 'TagText'): # Arch.Panels and Arch.PanelCut
return False
return True
def toolControllerForOp(op):
if hasattr(op, 'ToolController'):
return op.ToolController
if hasattr(op, 'Base'):
return toolControllerForOp(op.Base)
return None