import FreeCAD
import FreeCADGui
import PathScripts.PathLog as PathLog
import PathScripts.PathOpGui as PathOpGui

from PySide import QtCore, QtGui

__title__ = "Base for Circular Hole based operations' UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__doc__ = "Implementation of circular hole specific base geometry page controller."

if False:
    PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
    PathLog.trackModule(PathLog.thisModule())
else:
    PathLog.setLevel(PathLog.Level.NOTICE, PathLog.thisModule())


class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
    '''Controller class to be used for the BaseGeomtery page.
    Circular holes don't just display the feature, they also add a column
    displaying the radius the feature describes. This page provides that
    UI and functionality for all circular hole based operations.'''

    DataFeatureName = QtCore.Qt.ItemDataRole.UserRole
    DataObject = QtCore.Qt.ItemDataRole.UserRole + 1
    DataObjectSub = QtCore.Qt.ItemDataRole.UserRole + 2

    def getForm(self):
Beispiel #2
0
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with this program; if not, write to the Free Software   *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# ***************************************************************************

import FreeCAD
import PathScripts.PathLog as PathLog
from PySide import QtCore
from PathScripts.PathUtils import waiting_effects

LOG_MODULE = 'PathCollision'
PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
PathLog.trackModule('PathCollision')
FreeCAD.setLogLevel('Path.Area', 0)

if FreeCAD.GuiUp:
    import FreeCADGui
    # from PySide import QtGui


# Qt tanslation handling
def translate(context, text, disambig=None):
    return QtCore.QCoreApplication.translate(context, text, disambig)


__title__ = "Path Collision Utility"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
Beispiel #3
0
import Path
import PathScripts.PathLog as PathLog
import PathScripts.PathOp as PathOp
import PathScripts.PathUtils as PathUtils

from PathScripts.PathUtils import waiting_effects
from PySide import QtCore

__title__ = "Base class for PathArea based operations."
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__doc__ = "Base class and properties for Path.Area based operations."

if False:
    PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
    PathLog.trackModule()
else:
    PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())

# Qt tanslation handling
def translate(context, text, disambig=None):
    return QtCore.QCoreApplication.translate(context, text, disambig)

class ObjectOp(PathOp.ObjectOp):
    '''Base class for all Path.Area based operations.
    Provides standard features including debugging properties AreaParams,
    PathParams and removalshape, all hidding.
    The main reason for existance is to implement the standard interface
    to Path.Area so subclasses only have to provide the shapes for the
    operations.'''
Beispiel #4
0
 def test61(self):
     """Verify track handles arbitrary argument types correctly."""
     PathLog.trackModule()
     msg = PathLog.track('this', None, 1, 18.25)
     self.assertTrue(msg.startswith(self.MODULE))
     self.assertTrue(msg.endswith('test61(this, None, 1, 18.25)'))
Beispiel #5
0
from __future__ import print_function
import FreeCAD
#from FreeCAD import Vector
import Path
import PathScripts.PathLog as PathLog
#import Part
from PySide import QtCore, QtGui
from PathScripts import PathUtils
from PathScripts.PathUtils import fmt
#from math import pi


LOG_MODULE = 'PathDrilling'
PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
PathLog.trackModule('PathDrilling')

FreeCADGui = None
if FreeCAD.GuiUp:
    import FreeCADGui

"""Path Drilling object and FreeCAD command"""

# Qt tanslation handling
try:
    _encoding = QtGui.QApplication.UnicodeUTF8

    def translate(context, text, disambig=None):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def translate(context, text, disambig=None):
Beispiel #6
0
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with this program; if not, write to the Free Software   *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# ***************************************************************************

import FreeCAD
import PathScripts.PathLog as PathLog
from PySide import QtCore
from PathScripts.PathUtils import waiting_effects

LOG_MODULE = 'PathCollision'
PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
PathLog.trackModule('PathCollision')
FreeCAD.setLogLevel('Path.Area', 0)

if FreeCAD.GuiUp:
    import FreeCADGui
    # from PySide import QtGui


# Qt tanslation handling
def translate(context, text, disambig=None):
    return QtCore.QCoreApplication.translate(context, text, disambig)

__title__ = "Path Collision Utility"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
Beispiel #7
0
 def test60(self):
     """Verify track handles no argument."""
     PathLog.trackModule()
     msg = PathLog.track()
     self.assertTrue(msg.startswith(self.MODULE))
     self.assertTrue(msg.endswith('test60()'))
Beispiel #8
0
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with this program; if not, write to the Free Software   *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# ***************************************************************************

import FreeCAD
import PathScripts.PathLog as PathLog
from PySide import QtCore
from PathScripts.PathUtils import waiting_effects
from PySide.QtCore import QT_TRANSLATE_NOOP

LOG_MODULE = "PathCollision"
PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
PathLog.trackModule("PathCollision")
FreeCAD.setLogLevel("Path.Area", 0)

__title__ = "Path Collision Utility"
__author__ = "sliptonic (Brad Collette)"
__url__ = "https://www.freecadweb.org"
"""Path Collision object and FreeCAD command"""


class _CollisionSim:
    def __init__(self, obj):
        obj.Proxy = self

    def execute(self, fp):
        """Do something when doing a recomputation, this method is mandatory"""
        print("_CollisionSim", fp)
Beispiel #9
0
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with this program; if not, write to the Free Software   *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# ***************************************************************************
'''Selection gates and observers to control selectability while building Path operations '''

import FreeCAD
import FreeCADGui
import PathUtils
import PathScripts.PathLog as PathLog

LOG_MODULE = 'PathSelection'
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
PathLog.trackModule('PathSelection')


class EGate:
    def allow(self, doc, obj, sub):
        return (sub[0:4] == 'Edge')


class MESHGate:
    def allow(self, doc, obj, sub):
        return (obj.TypeId[0:4] == 'Mesh')


class ENGRAVEGate:
    def allow(self, doc, obj, sub):
        engraveable = False
Beispiel #10
0
# *                                                                         *
# ***************************************************************************

import FreeCAD
import Path
import numpy
import ArchPanel
import Part

from PathScripts import PathUtils
from PathScripts.PathUtils import depth_params
import PathScripts.PathLog as PathLog

LOG_MODULE = 'PathProfile'
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
PathLog.trackModule('PathProfile')
FreeCAD.setLogLevel('Path.Area', 0)

if FreeCAD.GuiUp:
    import FreeCADGui
    from PySide import QtCore, QtGui


# Qt tanslation handling
def translate(context, text, disambig=None):
    return QtCore.QCoreApplication.translate(context, text, disambig)

__title__ = "Path Profile Operation"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
Beispiel #11
0
# ***************************************************************************
''' Post Process command that will make use of the Output File and Post Processor entries in PathJob '''
from __future__ import print_function
import FreeCAD
import FreeCADGui
from PySide import QtCore, QtGui
from PathScripts import PathUtils
from PathScripts import PathJob
from PathScripts import PathLoadTool
from PathScripts.PathPreferences import PathPreferences
from PathScripts.PathPostProcessor import PostProcessor
import os
import PathScripts.PathLog as PathLog
LOG_MODULE = 'PathPost'
PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
PathLog.trackModule('PathPost')

# Qt tanslation handling
try:
    _encoding = QtGui.QApplication.UnicodeUTF8

    def translate(context, text, disambig=None):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def translate(context, text, disambig=None):
        return QtGui.QApplication.translate(context, text, disambig)

class DlgSelectPostProcessor:

    def __init__(self, parent=None):
        self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgSelectPostProcessor.ui")
Beispiel #12
0
import PathScripts.PathLog as PathLog
# import Part
from PySide import QtCore, QtGui
from PathScripts import PathUtils
from PathScripts.PathUtils import fmt
# from math import pi
import ArchPanel


# xrange is not available in python3
if sys.version_info.major >= 3:
    xrange = range

LOG_MODULE = 'PathDrilling'
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
PathLog.trackModule('PathDrilling')

FreeCADGui = None
if FreeCAD.GuiUp:
    import FreeCADGui

"""Path Drilling object and FreeCAD command"""

# Qt tanslation handling
try:
    _encoding = QtGui.QApplication.UnicodeUTF8

    def translate(context, text, disambig=None):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def translate(context, text, disambig=None):
Beispiel #13
0
import FreeCAD
import FreeCADGui
import os
import PathScripts.PathLog as PathLog

from PathScripts import PathJob
from PathScripts import PathLoadTool
from PathScripts import PathUtils
from PathScripts.PathPostProcessor import PostProcessor
from PathScripts.PathPreferences import PathPreferences
from PySide import QtCore, QtGui

LOG_MODULE = PathLog.thisModule()

PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
PathLog.trackModule(LOG_MODULE)


# Qt tanslation handling
def translate(context, text, disambig=None):
    return QtCore.QCoreApplication.translate(context, text, disambig)


class DlgSelectPostProcessor:
    def __init__(self, parent=None):
        self.dialog = FreeCADGui.PySideUic.loadUi(
            ":/panels/DlgSelectPostProcessor.ui")
        firstItem = None
        for post in PathPreferences.allEnabledPostProcessors():
            item = QtGui.QListWidgetItem(post)
            item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable
Beispiel #14
0
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with this program; if not, write to the Free Software   *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# ***************************************************************************
'''Selection gates and observers to control selectability while building Path operations '''

import FreeCAD
import FreeCADGui
import PathUtils
import PathScripts.PathLog as PathLog

LOG_MODULE = 'PathSelection'
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
PathLog.trackModule('PathSelection')


class EGate:
    def allow(self, doc, obj, sub):
        return (sub[0:4] == 'Edge')


class MESHGate:
    def allow(self, doc, obj, sub):
        return (obj.TypeId[0:4] == 'Mesh')


class ENGRAVEGate:
    def allow(self, doc, obj, sub):
        engraveable = False
Beispiel #15
0
import Path
import PathScripts.PathLog as PathLog
import PathScripts.PathOp as PathOp
import PathScripts.PathUtils as PathUtils

from PathScripts.PathUtils import waiting_effects
from PySide import QtCore

__title__ = "Base class for PathArea based operations."
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__doc__ = "Base class and properties for Path.Area based operations."

if False:
    PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
    PathLog.trackModule()
else:
    PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())

# Qt tanslation handling
def translate(context, text, disambig=None):
    return QtCore.QCoreApplication.translate(context, text, disambig)

class ObjectOp(PathOp.ObjectOp):
    '''Base class for all Path.Area based operations.
    Provides standard features including debugging properties AreaParams,
    PathParams and removalshape, all hidden.
    The main reason for existence is to implement the standard interface
    to Path.Area so subclasses only have to provide the shapes for the
    operations.'''
Beispiel #16
0
 def test52(self):
     """Verify untracking stops tracking."""
     PathLog.trackModule()
     self.assertIsNotNone(PathLog.track('this', 'and', 'that'))
     PathLog.untrackModule()
     self.assertIsNone(PathLog.track('this', 'and', 'that'))
Beispiel #17
0
# ***************************************************************************

import FreeCAD
import FreeCADGui
import PathScripts.PathCircularHoleBaseGui as PathCircularHoleBaseGui
import PathScripts.PathHelix as PathHelix
import PathScripts.PathLog as PathLog
import PathScripts.PathOpGui as PathOpGui

from PySide import QtCore, QtGui

__doc__ = "Helix operation page controller and command implementation."

if True:
    PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
    PathLog.trackModule(PathLog.thisModule())
else:
    PathLog.setLevel(PathLog.Level.NOTICE, PathLog.thisModule())


class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
    '''Page controller class for Helix operations.'''

    def getForm(self):
        '''getForm() ... return UI'''
        return FreeCADGui.PySideUic.loadUi(":/panels/PageOpHelixEdit.ui")

    def getFields(self, obj):
        '''getFields(obj) ... transfers values from UI to obj's proprties'''
        PathLog.track()
        if obj.Direction != str(self.form.direction.currentText()):
Beispiel #18
0
 def test52(self):
     """Verify untracking stops tracking."""
     PathLog.trackModule()
     self.assertIsNotNone(PathLog.track("this", "and", "that"))
     PathLog.untrackModule()
     self.assertIsNone(PathLog.track("this", "and", "that"))