Skip to content

Commit

Permalink
remove translation from property descriptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
sliptonic authored and yorikvanhavre committed May 23, 2016
1 parent 91978ba commit 2cc3649
Show file tree
Hide file tree
Showing 10 changed files with 291 additions and 305 deletions.
26 changes: 13 additions & 13 deletions src/Mod/Path/PathScripts/PathDrilling.py
Expand Up @@ -48,23 +48,23 @@ def translate(context, text, disambig=None):
class ObjectDrilling:

def __init__(self, obj):
obj.addProperty("App::PropertyLinkSubList", "Base","Path", translate("PathProject", "The base geometry of this toolpath"))
obj.addProperty("App::PropertyBool", "Active", "Path", translate("PathProject", "Make False, to prevent operation from generating code"))
obj.addProperty("App::PropertyString", "Comment", "Path", translate("PathProject", "An optional comment for this profile"))
obj.addProperty("App::PropertyString", "UserLabel", "Path", translate("Path", "User Assigned Label"))

obj.addProperty("App::PropertyLength", "PeckDepth", "Depth", translate("PathProject", "Incremental Drill depth before retracting to clear chips"))
obj.addProperty("App::PropertyLength", "StartDepth", "Depth", translate("PathProject", "Starting Depth of Tool- first cut depth in Z"))
obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", translate("PathProject", "The height needed to clear clamps and obstructions"))
obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", translate("PathProject", "Final Depth of Tool- lowest value in Z"))
obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", translate("PathProject", "Height to clear top of materil"))
obj.addProperty("App::PropertyDistance", "RetractHeight", "Depth", translate("PathProject", "The height where feed starts and height during retract tool when path is finished"))
obj.addProperty("App::PropertyLinkSubList", "Base","Path", "The base geometry of this toolpath")
obj.addProperty("App::PropertyBool", "Active", "Path", "Make False, to prevent operation from generating code")
obj.addProperty("App::PropertyString", "Comment", "Path", "An optional comment for this profile")
obj.addProperty("App::PropertyString", "UserLabel", "Path", "User Assigned Label")

obj.addProperty("App::PropertyLength", "PeckDepth", "Depth", "Incremental Drill depth before retracting to clear chips")
obj.addProperty("App::PropertyLength", "StartDepth", "Depth", "Starting Depth of Tool- first cut depth in Z")
obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", "The height needed to clear clamps and obstructions")
obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", "Final Depth of Tool- lowest value in Z")
obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", "Height to clear top of materil")
obj.addProperty("App::PropertyDistance", "RetractHeight", "Depth", "The height where feed starts and height during retract tool when path is finished")

# Tool Properties
obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", translate("PathProfile", "The tool number in use"))
obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", "The tool number in use")
obj.ToolNumber = (0, 0, 1000, 1)
obj.setEditorMode('ToolNumber', 1) # make this read only
obj.addProperty("App::PropertyString", "ToolDescription", "Tool", translate("Path", "The description of the tool "))
obj.addProperty("App::PropertyString", "ToolDescription", "Tool", "The description of the tool ")
obj.setEditorMode('ToolDescription', 1) # make this read onlyt


Expand Down
24 changes: 12 additions & 12 deletions src/Mod/Path/PathScripts/PathEngrave.py
Expand Up @@ -47,25 +47,25 @@ class ObjectPathEngrave:

def __init__(self, obj):
obj.addProperty("App::PropertyLinkSubList", "Base", "Path", "The base geometry of this object")
obj.addProperty("App::PropertyBool", "Active", "Path", translate("Path", "Make False, to prevent operation from generating code"))
obj.addProperty("App::PropertyString", "Comment", "Path", translate("Path", "An optional comment for this profile"))
obj.addProperty("App::PropertyString", "UserLabel", "Path", translate("Path", "User Assigned Label"))
obj.addProperty("App::PropertyBool", "Active", "Path", "Make False, to prevent operation from generating code")
obj.addProperty("App::PropertyString", "Comment", "Path", "An optional comment for this profile")
obj.addProperty("App::PropertyString", "UserLabel", "Path", "User Assigned Label")

obj.addProperty("App::PropertyEnumeration", "Algorithm", "Algorithm", translate("Path", "The library or Algorithm used to generate the path"))
obj.addProperty("App::PropertyEnumeration", "Algorithm", "Algorithm", "The library or Algorithm used to generate the path")
obj.Algorithm = ['OCC Native']

# Tool Properties
obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", translate("Path", "The tool number in use"))
obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", "The tool number in use")
obj.ToolNumber = (0, 0, 1000, 1)
obj.setEditorMode('ToolNumber', 1) # make this read only
obj.addProperty("App::PropertyString", "ToolDescription", "Tool", translate("Path", "The description of the tool "))
obj.setEditorMode('ToolDescription', 1) # make this read onlyt
obj.addProperty("App::PropertyString", "ToolDescription", "Tool", "The description of the tool ")
obj.setEditorMode('ToolDescription', 1) # make this read onlyt

# Depth Properties
obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", translate("Path", "The height needed to clear clamps and obstructions"))
obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", translate("Path", "Rapid Safety Height between locations."))
obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", translate("Path", "Starting Depth of Tool- first cut depth in Z"))
obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", translate("Path", "Final Depth of Tool- lowest value in Z"))
obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", "The height needed to clear clamps and obstructions")
obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", "Rapid Safety Height between locations.")
obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", "Starting Depth of Tool- first cut depth in Z")
obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", "Final Depth of Tool- lowest value in Z")
obj.addProperty("App::PropertyInteger", "StartVertex", "Path", "The vertex index to start the path from")

if FreeCAD.GuiUp:
Expand All @@ -81,7 +81,7 @@ def __setstate__(self, state):

def onChanged(self, obj, prop):
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"

def execute(self, obj):
output = ""
Expand Down
123 changes: 65 additions & 58 deletions src/Mod/Path/PathScripts/PathHop.py
@@ -1,35 +1,38 @@
# -*- coding: utf-8 -*-

#***************************************************************************
#* *
#* Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* 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,FreeCADGui,Path,PathGui
from PySide import QtCore,QtGui
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU Library General Public License for more details. *
# * *
# * 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 FreeCADGui
import Path
from PySide import QtCore, QtGui

"""Path Hop 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:
Expand All @@ -38,50 +41,50 @@ def translate(context, text, disambig=None):


class ObjectHop:


def __init__(self,obj):
obj.addProperty("App::PropertyLink","NextObject","Path","The object to be reached by this hop")
obj.addProperty("App::PropertyDistance","HopHeight","Path","The Z height of the hop")
def __init__(self, obj):
obj.addProperty("App::PropertyLink", "NextObject",
"Path", "The object to be reached by this hop")
obj.addProperty("App::PropertyDistance", "HopHeight",
"Path", "The Z height of the hop")
obj.Proxy = self

def __getstate__(self):
return None

def __setstate__(self,state):
def __setstate__(self, state):
return None
def execute(self,obj):

def execute(self, obj):
nextpoint = FreeCAD.Vector()
if obj.NextObject:
if obj.NextObject.isDerivedFrom("Path::Feature"):
# look for the first position of the next path
for c in obj.NextObject.Path.Commands:
if c.Name in ["G0","G00","G1","G01","G2","G02","G3","G03"]:
if c.Name in ["G0", "G00", "G1", "G01", "G2", "G02", "G3", "G03"]:
nextpoint = c.Placement.Base
break

# absolute coords, millimeters, cancel offsets
output = "G90\nG21\nG40\n"

# go up to the given height
output += "G0 Z" + str(obj.HopHeight.Value) + "\n"

# go horizontally to the position of nextpoint
output += "G0 X" + str(nextpoint.x) + " Y" + str(nextpoint.y) + "\n"
#print output

# print output
path = Path.Path(output)
obj.Path = path



class ViewProviderPathHop:

def __init__(self,vobj):
def __init__(self, vobj):
vobj.Proxy = self

def attach(self,vobj):
def attach(self, vobj):
self.Object = vobj.Object
return

Expand All @@ -91,48 +94,52 @@ def getIcon(self):
def __getstate__(self):
return None

def __setstate__(self,state):
def __setstate__(self, state):
return None



class CommandPathHop:


def GetResources(self):
return {'Pixmap' : 'Path-Hop',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Hop","Hop"),
return {'Pixmap': 'Path-Hop',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Hop", "Hop"),
'Accel': "P, H",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Hop","Creates a Path Hop object")}
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Hop", "Creates a Path Hop object")}

def IsActive(self):
return not FreeCAD.ActiveDocument is None
return FreeCAD.ActiveDocument is not None

def Activated(self):

# check that the selection contains exactly what we want
selection = FreeCADGui.Selection.getSelection()
if len(selection) != 1:
FreeCAD.Console.PrintError(translate("Path_Hop","Please select one path object\n"))
FreeCAD.Console.PrintError(
translate("Path_Hop", "Please select one path object\n"))
return
if not selection[0].isDerivedFrom("Path::Feature"):
FreeCAD.Console.PrintError(translate("Path_Hop","The selected object is not a path\n"))
FreeCAD.Console.PrintError(
translate("Path_Hop", "The selected object is not a path\n"))
return

FreeCAD.ActiveDocument.openTransaction(translate("Pat_hHop","Create Hop"))

FreeCAD.ActiveDocument.openTransaction(
translate("Pat_hHop", "Create Hop"))
FreeCADGui.addModule("PathScripts.PathHop")
FreeCADGui.addModule("PathScripts.PathUtils")
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Hop")')
FreeCADGui.doCommand(
'obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Hop")')
FreeCADGui.doCommand('PathScripts.PathHop.ObjectHop(obj)')
FreeCADGui.doCommand('PathScripts.PathHop.ViewProviderPathHop(obj.ViewObject)')
FreeCADGui.doCommand('obj.NextObject = FreeCAD.ActiveDocument.' + selection[0].Name)
FreeCADGui.doCommand(
'PathScripts.PathHop.ViewProviderPathHop(obj.ViewObject)')
FreeCADGui.doCommand(
'obj.NextObject = FreeCAD.ActiveDocument.' + selection[0].Name)
FreeCADGui.doCommand('PathScripts.PathUtils.addToProject(obj)')
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()


if FreeCAD.GuiUp:
if FreeCAD.GuiUp:
# register the FreeCAD command
FreeCADGui.addCommand('Path_Hop',CommandPathHop())
FreeCADGui.addCommand('Path_Hop', CommandPathHop())

FreeCAD.Console.PrintLog("Loading PathHop... done\n")
26 changes: 16 additions & 10 deletions src/Mod/Path/PathScripts/PathLoadTool.py
Expand Up @@ -45,13 +45,13 @@ def translate(context, text, disambig=None):

class LoadTool:
def __init__(self, obj):
obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", translate("Tool Number", "The active tool"))
obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", "The active tool")
obj.ToolNumber = (0, 0, 10000, 1)
obj.addProperty("App::PropertyFloat", "SpindleSpeed", "Tool", translate("Spindle Speed", "The speed of the cutting spindle in RPM"))
obj.addProperty("App::PropertyEnumeration", "SpindleDir", "Tool", translate("Spindle Dir", "Direction of spindle rotation"))
obj.addProperty("App::PropertyFloat", "SpindleSpeed", "Tool", "The speed of the cutting spindle in RPM")
obj.addProperty("App::PropertyEnumeration", "SpindleDir", "Tool", "Direction of spindle rotation")
obj.SpindleDir = ['Forward', 'Reverse']
obj.addProperty("App::PropertySpeed", "VertFeed", "Feed", translate("Path", "Feed rate for vertical moves in Z"))
obj.addProperty("App::PropertySpeed", "HorizFeed", "Feed", translate("Path", "Feed rate for horizontal moves"))
obj.addProperty("App::PropertySpeed", "VertFeed", "Feed", "Feed rate for vertical moves in Z")
obj.addProperty("App::PropertySpeed", "HorizFeed", "Feed", "Feed rate for horizontal moves")

obj.Proxy = self
mode = 2
Expand Down Expand Up @@ -228,12 +228,18 @@ def setFields(self):
self.form.cboSpindleDirection.setCurrentIndex(index)
# Populate the tool list
mach = PathUtils.findMachine()
tool = mach.Tooltable.Tools[self.obj.ToolNumber]
try:
tool = mach.Tooltable.Tools[self.obj.ToolNumber]
self.form.txtToolName.setText(tool.Name)
self.form.txtToolType.setText(tool.ToolType)
self.form.txtToolMaterial.setText(tool.Material)
self.form.txtToolDiameter.setText(str(tool.Diameter))
except:
self.form.txtToolName.setText("UNDEFINED")
self.form.txtToolType.setText("UNDEFINED")
self.form.txtToolMaterial.setText("UNDEFINED")
self.form.txtToolDiameter.setText("UNDEFINED")

self.form.txtToolName.setText(tool.Name)
self.form.txtToolType.setText(tool.ToolType)
self.form.txtToolMaterial.setText(tool.Material)
self.form.txtToolDiameter.setText(str(tool.Diameter))

# self.form.cboToolSelect.addItem(tool.Name)

Expand Down

0 comments on commit 2cc3649

Please sign in to comment.