diff --git a/.gitignore b/.gitignore
index 1a9c830..b9df375 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
*.pyc
*.md
*.fcstd1
+*.FCBak
/docFiles/
diff --git a/freecad/Curves/BSplineAlgorithms.py b/freecad/Curves/BSplineAlgorithms.py
index 6e5d69c..64fb8dc 100644
--- a/freecad/Curves/BSplineAlgorithms.py
+++ b/freecad/Curves/BSplineAlgorithms.py
@@ -10,6 +10,7 @@
from math import pi
from freecad.Curves.BSplineApproxInterp import BSplineApproxInterp
+translate = FreeCAD.Qt.translate
vec2d = Base.Vector2d
DEBUG = False
@@ -18,27 +19,29 @@ def debug(o):
if not DEBUG:
return
if isinstance(o, Part.BSplineCurve):
- FreeCAD.Console.PrintWarning("\nBSplineCurve\n")
- FreeCAD.Console.PrintWarning("Degree: {}\n".format(o.Degree))
- FreeCAD.Console.PrintWarning("NbPoles: {}\n".format(o.NbPoles))
- FreeCAD.Console.PrintWarning("Knots: {} ({:0.2f} - {:0.2f})\n".format(o.NbKnots, o.FirstParameter, o.LastParameter))
- FreeCAD.Console.PrintWarning("Mults: {}\n".format(o.getMultiplicities()))
- FreeCAD.Console.PrintWarning("Periodic: {}\n".format(o.isPeriodic()))
+ FreeCAD.Console.PrintWarning(translate("Log", "\nBSplineCurve\n"))
+ FreeCAD.Console.PrintWarning(translate("Log", "Degree: {}\n")).format(o.Degree)
+ FreeCAD.Console.PrintWarning(translate("Log", "NbPoles: {}\n")).format(o.NbPoles)
+ FreeCAD.Console.PrintWarning(translate("Log", "Knots: {} ({:0.2f} - {:0.2f})\n")).format(
+ o.NbKnots, o.FirstParameter, o.LastParameter
+ )
+ FreeCAD.Console.PrintWarning(translate("Log", "Mults: {}\n")).format(o.getMultiplicities())
+ FreeCAD.Console.PrintWarning(translate("Log", "Periodic: {}\n")).format(o.isPeriodic())
elif isinstance(o, Part.BSplineSurface):
- FreeCAD.Console.PrintWarning("\nBSplineSurface\n************\n")
+ FreeCAD.Console.PrintWarning(translate("Log", "\nBSplineSurface\n************\n"))
try:
u = o.uIso(o.getUKnot(1))
debug(u)
except Part.OCCError:
- FreeCAD.Console.PrintError("Failed to compute uIso curve\n")
+ FreeCAD.Console.PrintError(translate("Log", "Failed to compute uIso curve\n"))
try:
v = o.vIso(o.getVKnot(1))
debug(v)
except Part.OCCError:
- FreeCAD.Console.PrintError("Failed to compute vIso curve\n")
- FreeCAD.Console.PrintWarning("************\n")
+ FreeCAD.Console.PrintError(translate("Log", "Failed to compute vIso curve\n"))
+ FreeCAD.Console.PrintWarning(translate("Log", "************\n"))
else:
- FreeCAD.Console.PrintMessage("{}\n".format(str(o)))
+ FreeCAD.Console.PrintMessage(translate("Log", "{}\n")).format(str(o))
def IsInsideTolerance(array, value, tolerance=1e-15):
diff --git a/freecad/Curves/BSplineApproxInterp.py b/freecad/Curves/BSplineApproxInterp.py
index 57cc418..3caba4f 100644
--- a/freecad/Curves/BSplineApproxInterp.py
+++ b/freecad/Curves/BSplineApproxInterp.py
@@ -10,6 +10,7 @@
from freecad.Curves import nurbs_tools
# from math import pi
+translate = FreeCAD.Qt.translate
DEBUG = False
@@ -17,27 +18,29 @@ def debug(o):
if not DEBUG:
return
if isinstance(o, Part.BSplineCurve):
- FreeCAD.Console.PrintWarning("\nBSplineCurve\n")
- FreeCAD.Console.PrintWarning("Degree: {}\n".format(o.Degree))
- FreeCAD.Console.PrintWarning("NbPoles: {}\n".format(o.NbPoles))
- FreeCAD.Console.PrintWarning("Knots: {} ({:0.2f} - {:0.2f})\n".format(o.NbKnots, o.FirstParameter, o.LastParameter))
- FreeCAD.Console.PrintWarning("Mults: {}\n".format(o.getMultiplicities()))
- FreeCAD.Console.PrintWarning("Periodic: {}\n".format(o.isPeriodic()))
+ FreeCAD.Console.PrintWarning(translate("Log", "\nBSplineCurve\n"))
+ FreeCAD.Console.PrintWarning(translate("Log", "Degree: {}\n")).format(o.Degree)
+ FreeCAD.Console.PrintWarning(translate("Log", "NbPoles: {}\n")).format(o.NbPoles)
+ FreeCAD.Console.PrintWarning(translate("Log", "Knots: {} ({:0.2f} - {:0.2f})\n")).format(
+ o.NbKnots, o.FirstParameter, o.LastParameter
+ )
+ FreeCAD.Console.PrintWarning(translate("Log", "Mults: {}\n")).format(o.getMultiplicities())
+ FreeCAD.Console.PrintWarning(translate("Log", "Periodic: {}\n")).format(o.isPeriodic())
elif isinstance(o, Part.BSplineSurface):
- FreeCAD.Console.PrintWarning("\nBSplineSurface\n************\n")
+ FreeCAD.Console.PrintWarning(translate("Log", "\nBSplineSurface\n************\n"))
try:
u = o.uIso(o.UKnotSequence[0])
debug(u)
except Part.OCCError:
- FreeCAD.Console.PrintError("Failed to compute uIso curve\n")
+ FreeCAD.Console.PrintError(translate("Log", "Failed to compute uIso curve\n"))
try:
v = o.vIso(o.VKnotSequence[0])
debug(v)
except Part.OCCError:
- FreeCAD.Console.PrintError("Failed to compute vIso curve\n")
- FreeCAD.Console.PrintWarning("************\n")
+ FreeCAD.Console.PrintError(translate("Log", "Failed to compute vIso curve\n"))
+ FreeCAD.Console.PrintWarning(translate("Log", "************\n"))
else:
- FreeCAD.Console.PrintMessage("{}\n".format(str(o)))
+ FreeCAD.Console.PrintMessage(translate("Log", "{}\n")).format(str(o))
def square_distance(v1, v2):
diff --git a/freecad/Curves/Blending/smooth_objects.py b/freecad/Curves/Blending/smooth_objects.py
index e1ff963..013887f 100644
--- a/freecad/Curves/Blending/smooth_objects.py
+++ b/freecad/Curves/Blending/smooth_objects.py
@@ -20,6 +20,8 @@
from .. import curves_to_surface
from ..nurbs_tools import nurbs_quad
+translate = FreeCAD.Qt.translate
+
def printError(string):
FreeCAD.Console.PrintError(str(string) + "\n")
@@ -1215,7 +1217,7 @@ def get_offset_curve2d(self, dist=0.1):
if len(c) == 3:
cos.append(c[0].toBSpline(c[1], c[2]))
else:
- FreeCAD.Console.PrintError("failed to extract 2D geometry")
+ FreeCAD.Console.PrintError(translate("Log", "failed to extract 2D geometry"))
if e.isPartner(self._edge):
idx = n
diff --git a/freecad/Curves/Discretize.py b/freecad/Curves/Discretize.py
index 81ce8c5..d7a6a79 100644
--- a/freecad/Curves/Discretize.py
+++ b/freecad/Curves/Discretize.py
@@ -1,15 +1,22 @@
# -*- coding: utf-8 -*-
-__title__ = "Discretize"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_Discretize", "Discretize")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Discretize an edge or a wire."
-__usage__ = """Select an edge in the 3D View
+__doc__ = translate("Curves_Discretize", "Discretize an edge or a wire.")
+__usage__ = translate(
+ "Curves_Discretize",
+ """Select an edge in the 3D View
Activate tool
-It will generate some points along the edge, following various methods"""
+It will generate some points along the edge, following various methods""",
+)
import os
-import FreeCAD
import FreeCADGui
import Part
from . import _utils
@@ -24,22 +31,91 @@
class Discretization:
def __init__(self, obj, edge):
debug("Discretization class Init")
- obj.addProperty("App::PropertyLinkSub", "Edge", "Discretization", "Edge").Edge = edge
- obj.addProperty("App::PropertyEnumeration", "Target", "Discretization", "Tool target").Target=["Edge","Wire"]
- obj.addProperty("App::PropertyEnumeration", "Algorithm", "Method", "Discretization Method").Algorithm=["Number","QuasiNumber","Distance","Deflection","QuasiDeflection","Angular-Curvature"]
- obj.addProperty("App::PropertyInteger", "Number", "Method", "Number of edge points").Number = 100
- obj.addProperty("App::PropertyFloat", "Distance", "Method", "Distance between edge points").Distance=1.0
- obj.addProperty("App::PropertyFloat", "Deflection","Method", "Distance for deflection Algorithm").Deflection=1.0
- obj.addProperty("App::PropertyFloat", "Angular", "Method", "Angular value for Angular-Curvature Algorithm").Angular=0.1
- obj.addProperty("App::PropertyFloat", "Curvature", "Method", "Curvature value for Angular-Curvature Algorithm").Curvature=0.1
- obj.addProperty("App::PropertyInteger", "Minimum", "Method", "Minimum Number of points").Minimum = 2
- obj.addProperty("App::PropertyFloat", "ParameterFirst", "Parameters", "Start parameter")
- obj.addProperty("App::PropertyFloat", "ParameterLast", "Parameters", "End parameter")
- obj.addProperty("App::PropertyVectorList", "Points", "Discretization", "Points")
- obj.addProperty("App::PropertyFloatList",
- "NormalizedParameters",
- "Output",
- "Normalized parameters list")
+ obj.addProperty(
+ "App::PropertyLinkSub",
+ "Edge",
+ "Discretization",
+ QT_TRANSLATE_NOOP("App::Property", "Edge"),
+ ).Edge = edge
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Target",
+ "Discretization",
+ QT_TRANSLATE_NOOP("App::Property", "Tool target"),
+ ).Target = ["Edge", "Wire"]
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Algorithm",
+ "Method",
+ QT_TRANSLATE_NOOP("App::Property", "Discretization Method"),
+ ).Algorithm = [
+ "Number",
+ "QuasiNumber",
+ "Distance",
+ "Deflection",
+ "QuasiDeflection",
+ "Angular-Curvature",
+ ]
+ obj.addProperty(
+ "App::PropertyInteger",
+ "Number",
+ "Method",
+ QT_TRANSLATE_NOOP("App::Property", "Number of edge points"),
+ ).Number = 100
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Distance",
+ "Method",
+ QT_TRANSLATE_NOOP("App::Property", "Distance between edge points"),
+ ).Distance = 1.0
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Deflection",
+ "Method",
+ QT_TRANSLATE_NOOP("App::Property", "Distance for deflection Algorithm"),
+ ).Deflection = 1.0
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Angular",
+ "Method",
+ QT_TRANSLATE_NOOP("App::Property", "Angular value for Angular-Curvature Algorithm"),
+ ).Angular = 0.1
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Curvature",
+ "Method",
+ QT_TRANSLATE_NOOP("App::Property", "Curvature value for Angular-Curvature Algorithm"),
+ ).Curvature = 0.1
+ obj.addProperty(
+ "App::PropertyInteger",
+ "Minimum",
+ "Method",
+ QT_TRANSLATE_NOOP("App::Property", "Minimum Number of points"),
+ ).Minimum = 2
+ obj.addProperty(
+ "App::PropertyFloat",
+ "ParameterFirst",
+ "Parameters",
+ QT_TRANSLATE_NOOP("App::Property", "Start parameter"),
+ )
+ obj.addProperty(
+ "App::PropertyFloat",
+ "ParameterLast",
+ "Parameters",
+ QT_TRANSLATE_NOOP("App::Property", "End parameter"),
+ )
+ obj.addProperty(
+ "App::PropertyVectorList",
+ "Points",
+ "Discretization",
+ QT_TRANSLATE_NOOP("App::Property", "Points"),
+ )
+ obj.addProperty(
+ "App::PropertyFloatList",
+ "NormalizedParameters",
+ "Output",
+ QT_TRANSLATE_NOOP("App::Property", "Normalized parameters list"),
+ )
obj.setEditorMode("NormalizedParameters", 1)
obj.Proxy = self
obj.Algorithm = "Number"
@@ -256,7 +332,7 @@ def onDelete(self, feature, subelements):
try:
self.Object.Edge[0].ViewObject.Visibility = True
except Exception as err:
- FreeCAD.Console.PrintError("Error in onDelete: {0} \n".format(err))
+ FreeCAD.Console.PrintError(translate("Log", "Error in onDelete: {0} \n")).format(err)
return True
@@ -276,7 +352,7 @@ def Activated(self):
s = FreeCADGui.Selection.getSelectionEx()
edges = self.parseSel(s)
if not edges:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
FreeCADGui.doCommand("from freecad.Curves import Discretize")
for e in edges:
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Discretized_Edge")')
@@ -296,9 +372,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('Discretize', discretize())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_Discretize", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_Discretize", discretize())
diff --git a/freecad/Curves/DraftAnalysisFP.py b/freecad/Curves/DraftAnalysisFP.py
index 6bc0a47..7aa75f6 100644
--- a/freecad/Curves/DraftAnalysisFP.py
+++ b/freecad/Curves/DraftAnalysisFP.py
@@ -20,8 +20,12 @@
class DraftAnalysisProxyFP:
def __init__(self, obj):
- obj.addProperty("App::PropertyLink", "Source",
- "AnalysisOptions", "Object on which the analysis is performed")
+ obj.addProperty(
+ "App::PropertyLink",
+ "Source",
+ "AnalysisOptions",
+ QT_TRANSLATE_NOOP("App::Property", "Object on which the analysis is performed"),
+ )
obj.Proxy = self
def execute(self, obj):
@@ -43,30 +47,78 @@ def onChanged(self, obj, prop):
class DraftAnalysisProxyVP:
def __init__(self, viewobj):
- viewobj.addProperty("App::PropertyVector", "Direction",
- "AnalysisOptions", "Anaysis direction")
- viewobj.addProperty("App::PropertyFloatConstraint", "DraftAngle1",
- "AnalysisOptions", "Positive draft angle")
- viewobj.addProperty("App::PropertyFloatConstraint", "DraftAngle2",
- "AnalysisOptions", "Negative draft angle")
- viewobj.addProperty("App::PropertyFloatConstraint", "DraftTol1",
- "AnalysisOptions", "Positive draft tolerance")
- viewobj.addProperty("App::PropertyFloatConstraint", "DraftTol2",
- "AnalysisOptions", "Negative draft tolerance")
- viewobj.addProperty("App::PropertyColor", "ColorInDraft1",
- "Colors1PositiveDraft", "Color of the positive in-draft area")
- viewobj.addProperty("App::PropertyColor", "ColorInTolerance1",
- "Colors1PositiveDraft", "Color of the positive tolerance area")
- viewobj.addProperty("App::PropertyColor", "ColorOutOfDraft1",
- "Colors1PositiveDraft", "Color of the positive out-of-draft area")
- viewobj.addProperty("App::PropertyColor", "ColorInDraft2",
- "Colors2NegativeDraft", "Color of the negative in-draft area")
- viewobj.addProperty("App::PropertyColor", "ColorInTolerance2",
- "Colors2NegativeDraft", "Color of the negative tolerance area")
- viewobj.addProperty("App::PropertyColor", "ColorOutOfDraft2",
- "Colors2NegativeDraft", "Color of the negative out-of-draft area")
- viewobj.addProperty("App::PropertyFloatConstraint", "Shading",
- "AnalysisOptions", "Amount of shading on the analysis overlay")
+ viewobj.addProperty(
+ "App::PropertyVector",
+ "Direction",
+ "AnalysisOptions",
+ QT_TRANSLATE_NOOP("App::Property", "Anaysis direction"),
+ )
+ viewobj.addProperty(
+ "App::PropertyFloatConstraint",
+ "DraftAngle1",
+ "AnalysisOptions",
+ QT_TRANSLATE_NOOP("App::Property", "Positive draft angle"),
+ )
+ viewobj.addProperty(
+ "App::PropertyFloatConstraint",
+ "DraftAngle2",
+ "AnalysisOptions",
+ QT_TRANSLATE_NOOP("App::Property", "Negative draft angle"),
+ )
+ viewobj.addProperty(
+ "App::PropertyFloatConstraint",
+ "DraftTol1",
+ "AnalysisOptions",
+ QT_TRANSLATE_NOOP("App::Property", "Positive draft tolerance"),
+ )
+ viewobj.addProperty(
+ "App::PropertyFloatConstraint",
+ "DraftTol2",
+ "AnalysisOptions",
+ QT_TRANSLATE_NOOP("App::Property", "Negative draft tolerance"),
+ )
+ viewobj.addProperty(
+ "App::PropertyColor",
+ "ColorInDraft1",
+ "Colors1PositiveDraft",
+ QT_TRANSLATE_NOOP("App::Property", "Color of the positive in-draft area"),
+ )
+ viewobj.addProperty(
+ "App::PropertyColor",
+ "ColorInTolerance1",
+ "Colors1PositiveDraft",
+ QT_TRANSLATE_NOOP("App::Property", "Color of the positive tolerance area"),
+ )
+ viewobj.addProperty(
+ "App::PropertyColor",
+ "ColorOutOfDraft1",
+ "Colors1PositiveDraft",
+ QT_TRANSLATE_NOOP("App::Property", "Color of the positive out-of-draft area"),
+ )
+ viewobj.addProperty(
+ "App::PropertyColor",
+ "ColorInDraft2",
+ "Colors2NegativeDraft",
+ QT_TRANSLATE_NOOP("App::Property", "Color of the negative in-draft area"),
+ )
+ viewobj.addProperty(
+ "App::PropertyColor",
+ "ColorInTolerance2",
+ "Colors2NegativeDraft",
+ QT_TRANSLATE_NOOP("App::Property", "Color of the negative tolerance area"),
+ )
+ viewobj.addProperty(
+ "App::PropertyColor",
+ "ColorOutOfDraft2",
+ "Colors2NegativeDraft",
+ QT_TRANSLATE_NOOP("App::Property", "Color of the negative out-of-draft area"),
+ )
+ viewobj.addProperty(
+ "App::PropertyFloatConstraint",
+ "Shading",
+ "AnalysisOptions",
+ QT_TRANSLATE_NOOP("App::Property", "Amount of shading on the analysis overlay"),
+ )
viewobj.DraftAngle1 = (1.0, 0.0, 90.0, 0.1)
viewobj.DraftAngle2 = (1.0, 0.0, 90.0, 0.1)
viewobj.DraftTol1 = (0.05, 0.0, 90.0, 0.05)
@@ -198,4 +250,4 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('Curves_DraftAnalysis', DraftAnalysisCommand())
+FreeCADGui.addCommand("Curves_DraftAnalysis", DraftAnalysisCommand())
diff --git a/freecad/Curves/ExtractShapes.py b/freecad/Curves/ExtractShapes.py
index 06a4ac6..08aa27b 100644
--- a/freecad/Curves/ExtractShapes.py
+++ b/freecad/Curves/ExtractShapes.py
@@ -1,21 +1,29 @@
# -*- coding: utf-8 -*-
-__title__ = "Extract subshape"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_ExtractSubshape", "Extract subshape")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = """Make a non-parametric copy of selected subshapes.
-Same as Part_ElementCopy"""
+__doc__ = translate(
+ "Curves_ExtractSubshape",
+ """Make a non-parametric copy of selected subshapes.
+Same as Part_ElementCopy""",
+)
import os
-import FreeCAD
import FreeCADGui
from freecad.Curves import ICONPATH
-TOOL_ICON = os.path.join(ICONPATH, 'extract.svg')
+TOOL_ICON = os.path.join(ICONPATH, "extract.svg")
class extract:
"""Make a non-parametric copy of selected subshapes."""
+
def Activated(self):
s = FreeCADGui.Selection.getSelectionEx()
for o in s:
@@ -31,9 +39,11 @@ def Activated(self):
FreeCAD.ActiveDocument.recompute()
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}\n\n{}".format(__title__, __doc__)}
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}\n\n{}".format(__title__, __doc__),
+ }
-FreeCADGui.addCommand('extract', extract())
+FreeCADGui.addCommand("Curves_ExtractSubshape", extract())
diff --git a/freecad/Curves/FC_interaction_example.py b/freecad/Curves/FC_interaction_example.py
index 2b39bad..2b81bf6 100644
--- a/freecad/Curves/FC_interaction_example.py
+++ b/freecad/Curves/FC_interaction_example.py
@@ -9,6 +9,9 @@
from PySide2.QtGui import QColor
from pivy import quarter, coin, graphics, utils
+translate = FreeCAD.Qt.translate
+
+
class ConnectionMarker(graphics.Marker):
def __init__(self, points):
super(ConnectionMarker, self).__init__(points, True)
@@ -133,7 +136,7 @@ def __init__(self, points=[], fp = None):
elif isinstance(points[0],(tuple,list)):
self.points = [MarkerOnEdge([p]) for p in points]
else:
- FreeCAD.Console.PrintError("InterpolationPolygon : bad input")
+ FreeCAD.Console.PrintError(translate("Log", "InterpolationPolygon : bad input"))
# Setup coin objects
if not FreeCAD.ActiveDocument:
@@ -171,7 +174,7 @@ def update_curve(self):
FreeCAD.Console.PrintMessage("pts :\n%s\n"%str(pts))
if len(pts) > 1:
self.curve.interpolate(pts)
- #FreeCAD.Console.PrintMessage("update_curve\n")
+ #FreeCAD.Console.PrintMessage(translate("Log", "update_curve\n"))
if self.fp:
self.fp.Shape = self.curve.toShape()
diff --git a/freecad/Curves/FaceMapFP.py b/freecad/Curves/FaceMapFP.py
index 8c1a8d0..937af08 100644
--- a/freecad/Curves/FaceMapFP.py
+++ b/freecad/Curves/FaceMapFP.py
@@ -13,7 +13,9 @@
from freecad.Curves.nurbs_tools import nurbs_quad
from freecad.Curves import ICONPATH
-TOOL_ICON = os.path.join(ICONPATH, 'icon.svg')
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+TOOL_ICON = os.path.join(ICONPATH, "icon.svg")
# debug = _utils.debug
# debug = _utils.doNothing
@@ -71,14 +73,30 @@ class FaceMapFP:
"""Creates a ..."""
def __init__(self, obj):
"""Add the properties"""
- obj.addProperty("App::App::PropertyLinkSub", "Source",
- "Base", "Input face")
- obj.addProperty("App::PropertyFloat", "SizeU",
- "Dimensions", "Size of the map in the U direction")
- obj.addProperty("App::PropertyFloat", "SizeV",
- "Dimensions", "Size of the map in the V direction")
- obj.addProperty("App::PropertyBool", "AddBounds",
- "Settings", "Add the bounding box of the face")
+ obj.addProperty(
+ "App::App::PropertyLinkSub",
+ "Source",
+ "Base",
+ QT_TRANSLATE_NOOP("App::Property", "Input face"),
+ )
+ obj.addProperty(
+ "App::PropertyFloat",
+ "SizeU",
+ "Dimensions",
+ QT_TRANSLATE_NOOP("App::Property", "Size of the map in the U direction"),
+ )
+ obj.addProperty(
+ "App::PropertyFloat",
+ "SizeV",
+ "Dimensions",
+ QT_TRANSLATE_NOOP("App::Property", "Size of the map in the V direction"),
+ )
+ obj.addProperty(
+ "App::PropertyBool",
+ "AddBounds",
+ "Settings",
+ QT_TRANSLATE_NOOP("App::Property", "Add the bounding box of the face"),
+ )
obj.SizeU = 1.0
obj.SizeV = 1.0
obj.Proxy = self
@@ -136,7 +154,7 @@ def makeFeature(self, sel=None):
def Activated(self):
sel = FreeCADGui.Selection.getSelection()
if sel == []:
- FreeCAD.Console.PrintError("Select something first !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select something first !\n"))
else:
self.makeFeature(sel)
diff --git a/freecad/Curves/FlattenFP.py b/freecad/Curves/FlattenFP.py
index a670e96..d9e7415 100644
--- a/freecad/Curves/FlattenFP.py
+++ b/freecad/Curves/FlattenFP.py
@@ -1,15 +1,24 @@
# -*- coding: utf-8 -*-
-__title__ = 'Flatten face'
-__author__ = 'Christophe Grellier (Chris_G)'
-__license__ = 'LGPL 2.1'
-__doc__ = 'Creates a flat developed face from conical and cylindrical faces'
-__usage__ = """You must select a conical or cylindrical face in the 3D View.
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_FlattenFace", "Flatten face")
+__author__ = "Christophe Grellier (Chris_G)"
+__license__ = "LGPL 2.1"
+__doc__ = translate(
+ "Curves_FlattenFace", "Creates a flat developed face from conical and cylindrical faces"
+)
+__usage__ = translate(
+ "Curves_FlattenFace",
+ """You must select a conical or cylindrical face in the 3D View.
InPlace property puts the unrolled face tangent to the source face (InPlace = True)
-or in the XY plane (InPlace = False)"""
+or in the XY plane (InPlace = False)""",
+)
import os
-import FreeCAD
import FreeCADGui
import Part
from math import pi
@@ -352,12 +361,24 @@ def flatten_face_new(face, inPlace=False, size=0.0):
class FlattenProxy:
def __init__(self, obj):
"""Add the properties"""
- obj.addProperty("App::PropertyLinkSub", "Source",
- "Source", "The conical face to flatten")
- obj.addProperty("App::PropertyBool", "InPlace",
- "Settings", "Unroll the face in place")
- obj.addProperty("App::PropertyFloat", "Size",
- "Settings", "Size of the underlying surface")
+ obj.addProperty(
+ "App::PropertyLinkSub",
+ "Source",
+ "Source",
+ QT_TRANSLATE_NOOP("App::Property", "The conical face to flatten"),
+ )
+ obj.addProperty(
+ "App::PropertyBool",
+ "InPlace",
+ "Settings",
+ QT_TRANSLATE_NOOP("App::Property", "Unroll the face in place"),
+ )
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Size",
+ "Settings",
+ QT_TRANSLATE_NOOP("App::Property", "Size of the underlying surface"),
+ )
obj.setEditorMode("Size", 2)
obj.Size = 0.0
preferences = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Curves")
@@ -402,14 +423,16 @@ def makeFeature(self, sel=None):
def Activated(self):
sel = FreeCADGui.Selection.getSelectionEx()
if sel == []:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
for so in sel:
for sn in so.SubElementNames:
subo = so.Object.getSubObject(sn)
if hasattr(subo, "Surface") and isinstance(subo.Surface, (Part.Cylinder, Part.Cone, Part.SurfaceOfExtrusion)):
self.makeFeature((so.Object, sn))
else:
- FreeCAD.Console.PrintError("Bad input :{}-{}\n".format(so.Object.Label, sn))
+ FreeCAD.Console.PrintError(translate("Log", "Bad input :{}-{}\n")).format(
+ so.Object.Label, sn
+ )
def IsActive(self):
if FreeCAD.ActiveDocument:
@@ -418,9 +441,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('Curves_FlattenFace', Curves_Flatten_Face_Cmd())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_FlattenFace", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_FlattenFace", Curves_Flatten_Face_Cmd())
diff --git a/freecad/Curves/GeomInfo.py b/freecad/Curves/GeomInfo.py
index 1563be9..4fb77a3 100644
--- a/freecad/Curves/GeomInfo.py
+++ b/freecad/Curves/GeomInfo.py
@@ -1,16 +1,23 @@
# -*- coding: utf-8 -*-
-__title__ = "GeomInfo"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_GeometryInfo", "GeomInfo")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Display geometry information about selected shape"
-__usage__ = """While active, this tool displays information about the geometry of an edge or face.
-It displays poles, knots and weights of Bezier and BSpline curves and surfaces in the 3D View."""
+__doc__ = translate("Curves_GeometryInfo", "Display geometry information about selected shape")
+__usage__ = translate(
+ "Curves_GeometryInfo",
+ """While active, this tool displays information about the geometry of an edge or face.
+It displays poles, knots and weights of Bezier and BSpline curves and surfaces in the 3D View.""",
+)
import os
import re
-import FreeCAD
import FreeCADGui
import Part
from . import _utils
@@ -27,7 +34,7 @@
def debug(string):
if DEBUG:
FreeCAD.Console.PrintMessage(string)
- FreeCAD.Console.PrintMessage("\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "\n"))
def beautify(shp):
@@ -466,7 +473,7 @@ def setPreselection(self, doc, obj, sub):
pass
def clearSelection(self, doc): # If screen is clicked, delete selection
- # FreeCAD.Console.PrintMessage("clearSelection\n")
+ # FreeCAD.Console.PrintMessage(translate("Log", "clearSelection\n"))
if self.Active:
self.SoText2.string = ""
self.removeGrid()
@@ -641,4 +648,4 @@ def GetResources(self):
'Checkable': False}
-FreeCADGui.addCommand('GeomInfo', GeomInfo())
+FreeCADGui.addCommand("Curves_GeometryInfo", GeomInfo())
diff --git a/freecad/Curves/HQRuledSurfaceFP.py b/freecad/Curves/HQRuledSurfaceFP.py
index 9937a5d..50de2a1 100644
--- a/freecad/Curves/HQRuledSurfaceFP.py
+++ b/freecad/Curves/HQRuledSurfaceFP.py
@@ -19,9 +19,11 @@
from freecad.Curves import _utils
from freecad.Curves import ICONPATH
-TOOL_ICON = os.path.join( ICONPATH, 'ruled_surface.svg')
-#debug = _utils.debug
-#debug = _utils.doNothing
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+TOOL_ICON = os.path.join(ICONPATH, "ruled_surface.svg")
+# debug = _utils.debug
+# debug = _utils.doNothing
props = """
App::PropertyBool
@@ -76,14 +78,54 @@ class HQ_Ruled_SurfaceFP:
"""Creates a ..."""
def __init__(self, obj, sources):
"""Add the properties"""
- obj.addProperty("App::PropertyLinkList", "SourceObjects", "HQ_Ruled_Surface", "SourceObjects")
- obj.addProperty("App::PropertyLinkSubList", "SourceShapes", "HQ_Ruled_Surface", "SourceShapes")
- obj.addProperty("App::PropertyInteger", "Samples", "HQ_Ruled_Surface", "Number of orthogonal samples").Samples = 20
- obj.addProperty("App::PropertyFloatConstraint","SmoothingFactorStart", "HQ_Ruled_Surface", "Smoothing factor on curve start")
- obj.addProperty("App::PropertyFloatConstraint","SmoothingFactorEnd", "HQ_Ruled_Surface", "Smoothing factor on curve end")
- obj.addProperty("App::PropertyInteger", "Method", "HQ_Ruled_Surface", "Projection method (1,2,3,4)").Method = 3
- obj.addProperty("App::PropertyFloat", "Tol3D", "HQ_Ruled_Surface", "3D tolerance").Tol3D = 1e-5
- obj.addProperty("App::PropertyFloat", "Tol2D", "HQ_Ruled_Surface", "Parametric tolerance").Tol2D = 1e-8
+ obj.addProperty(
+ "App::PropertyLinkList",
+ "SourceObjects",
+ "HQ_Ruled_Surface",
+ QT_TRANSLATE_NOOP("App::Property", "SourceObjects"),
+ )
+ obj.addProperty(
+ "App::PropertyLinkSubList",
+ "SourceShapes",
+ "HQ_Ruled_Surface",
+ QT_TRANSLATE_NOOP("App::Property", "SourceShapes"),
+ )
+ obj.addProperty(
+ "App::PropertyInteger",
+ "Samples",
+ "HQ_Ruled_Surface",
+ QT_TRANSLATE_NOOP("App::Property", "Number of orthogonal samples"),
+ ).Samples = 20
+ obj.addProperty(
+ "App::PropertyFloatConstraint",
+ "SmoothingFactorStart",
+ "HQ_Ruled_Surface",
+ QT_TRANSLATE_NOOP("App::Property", "Smoothing factor on curve start"),
+ )
+ obj.addProperty(
+ "App::PropertyFloatConstraint",
+ "SmoothingFactorEnd",
+ "HQ_Ruled_Surface",
+ QT_TRANSLATE_NOOP("App::Property", "Smoothing factor on curve end"),
+ )
+ obj.addProperty(
+ "App::PropertyInteger",
+ "Method",
+ "HQ_Ruled_Surface",
+ QT_TRANSLATE_NOOP("App::Property", "Projection method (1,2,3,4)"),
+ ).Method = 3
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Tol3D",
+ "HQ_Ruled_Surface",
+ QT_TRANSLATE_NOOP("App::Property", "3D tolerance"),
+ ).Tol3D = 1e-5
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Tol2D",
+ "HQ_Ruled_Surface",
+ QT_TRANSLATE_NOOP("App::Property", "Parametric tolerance"),
+ ).Tol2D = 1e-8
obj.SmoothingFactorStart = (0.2, 0.0, 0.5, 0.05)
obj.SmoothingFactorEnd = (0.2, 0.0, 0.5, 0.05)
objs = []
@@ -174,7 +216,7 @@ def Activated(self):
edges.append(so.Object)
if len(edges) < 1:
- FreeCAD.Console.PrintError("Select something first !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select something first !\n"))
else:
self.makeFeature(edges)
@@ -189,4 +231,4 @@ def GetResources(self):
'MenuText': __title__,
'ToolTip': __doc__}
-FreeCADGui.addCommand('hq_ruled_surface', HQ_Ruled_Surface_Command())
+FreeCADGui.addCommand("hq_ruled_surface", HQ_Ruled_Surface_Command())
diff --git a/freecad/Curves/HelicalSweepFP.py b/freecad/Curves/HelicalSweepFP.py
index 74d30ca..5d1fae3 100644
--- a/freecad/Curves/HelicalSweepFP.py
+++ b/freecad/Curves/HelicalSweepFP.py
@@ -20,9 +20,10 @@
from freecad.Curves import ICONPATH
-TOOL_ICON = os.path.join( ICONPATH, 'helical_sweep.svg')
-#debug = _utils.debug
-#debug = _utils.doNothing
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+TOOL_ICON = os.path.join(ICONPATH, "helical_sweep.svg")
+# debug = _utils.debug
+# debug = _utils.doNothing
props = """
App::PropertyBool
@@ -177,10 +178,30 @@ class HelicalSweepFP:
def __init__(self, obj):
"""Add the properties"""
obj.addProperty("App::PropertyLink", "Profile", "Profile object")
- obj.addProperty("App::PropertyFloat", "Turns", "Settings", "Number of turns").Turns = 1.0
- obj.addProperty("App::PropertyFloat", "Lead", "Settings", "Thread lead (-1 for auto)").Lead = -1
- obj.addProperty("App::PropertyBool", "Rational", "Settings", "Allow rational bsplines").Rational = False
- obj.addProperty("App::PropertyBool", "Solid", "Settings", "Create a solid shape").Solid = False
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Turns",
+ "Settings",
+ QT_TRANSLATE_NOOP("App::Property", "Number of turns"),
+ ).Turns = 1.0
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Lead",
+ "Settings",
+ QT_TRANSLATE_NOOP("App::Property", "Thread lead (-1 for auto)"),
+ ).Lead = -1
+ obj.addProperty(
+ "App::PropertyBool",
+ "Rational",
+ "Settings",
+ QT_TRANSLATE_NOOP("App::Property", "Allow rational bsplines"),
+ ).Rational = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "Solid",
+ "Settings",
+ QT_TRANSLATE_NOOP("App::Property", "Create a solid shape"),
+ ).Solid = False
obj.Proxy = self
def execute(self, obj):
diff --git a/freecad/Curves/IsoCurve.py b/freecad/Curves/IsoCurve.py
index f03b512..9b35c89 100644
--- a/freecad/Curves/IsoCurve.py
+++ b/freecad/Curves/IsoCurve.py
@@ -23,7 +23,8 @@
from freecad.Curves import _utils
from freecad.Curves import ICONPATH
-TOOL_ICON = os.path.join(ICONPATH, 'isocurve.svg')
+QT_TRANSLATE_NOOP = App.Qt.QT_TRANSLATE_NOOP
+TOOL_ICON = os.path.join(ICONPATH, "isocurve.svg")
# debug = _utils.debug
debug = _utils.doNothing
@@ -41,12 +42,42 @@ class IsoCurve:
"The IsoCurve feature object"
def __init__(self, selfobj):
- selfobj.addProperty("App::PropertyLinkSub", "Face", "IsoCurve", "Input face")
- selfobj.addProperty("App::PropertyFloat", "Parameter", "IsoCurve", "IsoCurve parameter").Parameter = 0.
- selfobj.addProperty("App::PropertyInteger", "NumberU", "IsoCurve", "Number of IsoCurve in U direction").NumberU = 5
- selfobj.addProperty("App::PropertyInteger", "NumberV", "IsoCurve", "Number of IsoCurve in V direction").NumberV = 5
- selfobj.addProperty("App::PropertyEnumeration", "Mode", "IsoCurve", "Number of IsoCurve").Mode = ["Single", "Multi"]
- selfobj.addProperty("App::PropertyEnumeration", "Orientation", "IsoCurve", "Curve Orientation").Orientation = ["U", "V"]
+ selfobj.addProperty(
+ "App::PropertyLinkSub",
+ "Face",
+ "IsoCurve",
+ QT_TRANSLATE_NOOP("App::Property", "Input face"),
+ )
+ selfobj.addProperty(
+ "App::PropertyFloat",
+ "Parameter",
+ "IsoCurve",
+ QT_TRANSLATE_NOOP("App::Property", "IsoCurve parameter"),
+ ).Parameter = 0.0
+ selfobj.addProperty(
+ "App::PropertyInteger",
+ "NumberU",
+ "IsoCurve",
+ QT_TRANSLATE_NOOP("App::Property", "Number of IsoCurve in U direction"),
+ ).NumberU = 5
+ selfobj.addProperty(
+ "App::PropertyInteger",
+ "NumberV",
+ "IsoCurve",
+ QT_TRANSLATE_NOOP("App::Property", "Number of IsoCurve in V direction"),
+ ).NumberV = 5
+ selfobj.addProperty(
+ "App::PropertyEnumeration",
+ "Mode",
+ "IsoCurve",
+ QT_TRANSLATE_NOOP("App::Property", "Number of IsoCurve"),
+ ).Mode = ["Single", "Multi"]
+ selfobj.addProperty(
+ "App::PropertyEnumeration",
+ "Orientation",
+ "IsoCurve",
+ QT_TRANSLATE_NOOP("App::Property", "Curve Orientation"),
+ ).Orientation = ["U", "V"]
selfobj.Mode = "Multi"
selfobj.setEditorMode("Parameter", 2)
selfobj.setEditorMode("Orientation", 2)
@@ -222,7 +253,7 @@ def IsActive(self):
if App.GuiUp:
- Gui.addCommand("IsoCurve", CommandMacroIsoCurve())
+ Gui.addCommand("Curves_IsoCurve", CommandMacroIsoCurve())
def run():
diff --git a/freecad/Curves/JoinCurves.py b/freecad/Curves/JoinCurves.py
index ab51549..2a699d4 100644
--- a/freecad/Curves/JoinCurves.py
+++ b/freecad/Curves/JoinCurves.py
@@ -1,15 +1,22 @@
# -*- coding: utf-8 -*-
-__title__ = "joinCurves"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_JoinCurve", "joinCurves")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Joins the selected edges into a BSpline Curve"
-__usage__ = """Select the edges to join in the 3D View, or select an object containing multiple edges in the Tree View.
+__doc__ = translate("Curves_JoinCurve", "Joins the selected edges into a BSpline Curve")
+__usage__ = translate(
+ "Curves_JoinCurve",
+ """Select the edges to join in the 3D View, or select an object containing multiple edges in the Tree View.
Activate the tool.
-The output is a single BSpline curve joining all selected edges."""
+The output is a single BSpline curve joining all selected edges.""",
+)
import os
-import FreeCAD
import FreeCADGui
import Part
from . import _utils
@@ -81,15 +88,55 @@ def forceClosed(curves, tol=1e-7):
class join:
"joins the selected edges into a single BSpline Curve"
def __init__(self, obj):
- ''' Add the properties '''
- obj.addProperty("App::PropertyLinkSubList", "Edges", "InputSources", "List of edges to join")
- obj.addProperty("App::PropertyLink", "Base", "InputSources", "Join all the edges of this base object")
- obj.addProperty("App::PropertyFloat", "Tolerance", "Join", "Tolerance").Tolerance = 0.01
- obj.addProperty("App::PropertyBool", "CornerBreak", "Join", "Break on sharp corners").CornerBreak = False
- obj.addProperty("App::PropertyBool", "ForceContact", "Join", "Force connection of edges").ForceContact = True
- obj.addProperty("App::PropertyBool", "ForceClosed", "Join", "Force closed curve").ForceClosed = False
- obj.addProperty("App::PropertyBool", "Reverse", "Join", "Reverse the output curve").Reverse = False
- obj.addProperty("App::PropertyInteger", "StartOffset", "Join", "Set the start point of closed curve").StartOffset = 0
+ """Add the properties"""
+ obj.addProperty(
+ "App::PropertyLinkSubList",
+ "Edges",
+ "InputSources",
+ QT_TRANSLATE_NOOP("App::Property", "List of edges to join"),
+ )
+ obj.addProperty(
+ "App::PropertyLink",
+ "Base",
+ "InputSources",
+ QT_TRANSLATE_NOOP("App::Property", "Join all the edges of this base object"),
+ )
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Tolerance",
+ "Join",
+ QT_TRANSLATE_NOOP("App::Property", "Tolerance"),
+ ).Tolerance = 0.01
+ obj.addProperty(
+ "App::PropertyBool",
+ "CornerBreak",
+ "Join",
+ QT_TRANSLATE_NOOP("App::Property", "Break on sharp corners"),
+ ).CornerBreak = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "ForceContact",
+ "Join",
+ QT_TRANSLATE_NOOP("App::Property", "Force connection of edges"),
+ ).ForceContact = True
+ obj.addProperty(
+ "App::PropertyBool",
+ "ForceClosed",
+ "Join",
+ QT_TRANSLATE_NOOP("App::Property", "Force closed curve"),
+ ).ForceClosed = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "Reverse",
+ "Join",
+ QT_TRANSLATE_NOOP("App::Property", "Reverse the output curve"),
+ ).Reverse = False
+ obj.addProperty(
+ "App::PropertyInteger",
+ "StartOffset",
+ "Join",
+ QT_TRANSLATE_NOOP("App::Property", "Set the start point of closed curve"),
+ ).StartOffset = 0
obj.Proxy = self
def onChanged(self, fp, prop):
@@ -232,7 +279,7 @@ def Activated(self):
except AttributeError:
pass
if sel == []:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
for selobj in sel:
if selobj.HasSubObjects:
for i in range(len(selobj.SubObjects)):
@@ -253,9 +300,13 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__, translate("Curves_JoinCurve", "Usage"), " ".join(__usage__.splitlines())
+ ),
+ }
-FreeCADGui.addCommand('join', joinCommand())
+FreeCADGui.addCommand("Curves_JoinCurve", joinCommand())
diff --git a/freecad/Curves/Outline_FP.py b/freecad/Curves/Outline_FP.py
index fcfd4c0..ca49d09 100644
--- a/freecad/Curves/Outline_FP.py
+++ b/freecad/Curves/Outline_FP.py
@@ -15,9 +15,11 @@
import _utils
import approximate_extension
-TOOL_ICON = _utils.iconsPath() + 'icon.svg'
-#debug = _utils.debug
-#debug = _utils.doNothing
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+TOOL_ICON = _utils.iconsPath() + "icon.svg"
+# debug = _utils.debug
+# debug = _utils.doNothing
props = """
App::PropertyBool
@@ -72,9 +74,9 @@ class OutlineFP:
"""Creates a Outline curve"""
def __init__(self, obj, s):
"""Add the properties"""
- obj.addProperty("App::PropertyLink", "Source", "Outline", "Source object").Source = s
- obj.addProperty("App::PropertyVector", "Direction", "Outline", "Direction Vector").Direction = FreeCAD.Vector(0,0,1)
- obj.addProperty("App::PropertyInteger", "RadialSamples", "Outline", "Number of samples around object").RadialSamples = 360
+ obj.addProperty("App::PropertyLink", "Source", "Outline", QT_TRANSLATE_NOOP("App::Property", "Source object")).Source = s
+ obj.addProperty("App::PropertyVector", "Direction", "Outline", QT_TRANSLATE_NOOP("App::Property", "Direction Vector")).Direction = FreeCAD.Vector(0,0,1)
+ obj.addProperty("App::PropertyInteger", "RadialSamples", "Outline", QT_TRANSLATE_NOOP("App::Property", "Number of samples around object")).RadialSamples = 360
obj.Proxy = self
def execute(self, obj):
@@ -151,7 +153,7 @@ def makeFeature(self,sel):
def Activated(self):
sel = FreeCADGui.Selection.getSelection()
if sel == []:
- FreeCAD.Console.PrintError("Select something first !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select something first !\n"))
else:
self.makeFeature(sel[0])
diff --git a/freecad/Curves/ParametricBlendCurve.py b/freecad/Curves/ParametricBlendCurve.py
index 7262f98..9242265 100644
--- a/freecad/Curves/ParametricBlendCurve.py
+++ b/freecad/Curves/ParametricBlendCurve.py
@@ -1,12 +1,19 @@
# -*- coding: utf-8 -*-
-__title__ = "Blend curve"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_ParametricBlendCurve", "Blend curve")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Blend curve between two edges. Double-clic object to enable/disable freehand mouse editing."
+__doc__ = QT_TRANSLATE_NOOP(
+ "Curves_ParametricBlendCurve",
+ "Blend curve between two edges. Double-clic object to enable/disable freehand mouse editing.",
+)
import os
-import FreeCAD
import FreeCADGui
import Part
from freecad.Curves import _utils
@@ -30,22 +37,83 @@
class BlendCurveFP:
def __init__(self, obj, edges):
debug("BlendCurve class Init")
- obj.addProperty("App::PropertyLinkSub", "Edge1", "Edge1", "Edge 1").Edge1 = edges[0]
- obj.addProperty("App::PropertyLinkSub", "Edge2", "Edge2", "Edge 2").Edge2 = edges[1]
- # obj.addProperty("App::PropertyInteger", "DegreeMax", "BlendCurve", "Max degree of the Blend curve").DegreeMax = 9
- obj.addProperty("App::PropertyDistance", "Parameter1", "Edge1", "Location on first edge")
- obj.addProperty("App::PropertyBool", "Reverse1", "Edge1", "Reverse Edge").Reverse1 = False
- obj.addProperty("App::PropertyFloatConstraint", "Scale1", "Edge1", "Scale of blend curve")
- obj.addProperty("App::PropertyEnumeration", "Continuity1", "Edge1", "Continuity").Continuity1 = ["C0", "G1", "G2", "G3", "G4"]
- obj.addProperty("App::PropertyDistance", "Parameter2", "Edge2", "Location on second edge")
- obj.addProperty("App::PropertyBool", "Reverse2", "Edge2", "Reverse Edge").Reverse2 = False
- obj.addProperty("App::PropertyFloatConstraint", "Scale2", "Edge2", "Scale of blend curve")
- obj.addProperty("App::PropertyEnumeration", "Continuity2", "Edge2", "Continuity").Continuity2 = ["C0", "G1", "G2", "G3", "G4"]
- obj.addProperty("App::PropertyVectorList", "CurvePts", "BlendCurve", "Poles of the Bezier curve")
- obj.addProperty("App::PropertyEnumeration", "Output", "BlendCurve", "Output type").Output = ["Wire", "Joined", "Single"]
- obj.addProperty("App::PropertyBool", "AutoScale", "BlendCurve", "Compute scales to get minimal curvature along curve").AutoScale = False
- obj.Scale1 = (1., -5.0, 5.0, 0.05)
- obj.Scale2 = (1., -5.0, 5.0, 0.05)
+ obj.addProperty(
+ "App::PropertyLinkSub", "Edge1", "Edge1", QT_TRANSLATE_NOOP("App::Property", "Edge 1")
+ ).Edge1 = edges[0]
+ obj.addProperty(
+ "App::PropertyLinkSub", "Edge2", "Edge2", QT_TRANSLATE_NOOP("App::Property", "Edge 2")
+ ).Edge2 = edges[1]
+ # obj.addProperty("App::PropertyInteger", "DegreeMax", "BlendCurve", QT_TRANSLATE_NOOP("App::Property", "Max degree of the Blend curve")).DegreeMax = 9
+ obj.addProperty(
+ "App::PropertyDistance",
+ "Parameter1",
+ "Edge1",
+ QT_TRANSLATE_NOOP("App::Property", "Location on first edge"),
+ )
+ obj.addProperty(
+ "App::PropertyBool",
+ "Reverse1",
+ "Edge1",
+ QT_TRANSLATE_NOOP("App::Property", "Reverse Edge"),
+ ).Reverse1 = False
+ obj.addProperty(
+ "App::PropertyFloatConstraint",
+ "Scale1",
+ "Edge1",
+ QT_TRANSLATE_NOOP("App::Property", "Scale of blend curve"),
+ )
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Continuity1",
+ "Edge1",
+ QT_TRANSLATE_NOOP("App::Property", "Continuity"),
+ ).Continuity1 = ["C0", "G1", "G2", "G3", "G4"]
+ obj.addProperty(
+ "App::PropertyDistance",
+ "Parameter2",
+ "Edge2",
+ QT_TRANSLATE_NOOP("App::Property", "Location on second edge"),
+ )
+ obj.addProperty(
+ "App::PropertyBool",
+ "Reverse2",
+ "Edge2",
+ QT_TRANSLATE_NOOP("App::Property", "Reverse Edge"),
+ ).Reverse2 = False
+ obj.addProperty(
+ "App::PropertyFloatConstraint",
+ "Scale2",
+ "Edge2",
+ QT_TRANSLATE_NOOP("App::Property", "Scale of blend curve"),
+ )
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Continuity2",
+ "Edge2",
+ QT_TRANSLATE_NOOP("App::Property", "Continuity"),
+ ).Continuity2 = ["C0", "G1", "G2", "G3", "G4"]
+ obj.addProperty(
+ "App::PropertyVectorList",
+ "CurvePts",
+ "BlendCurve",
+ QT_TRANSLATE_NOOP("App::Property", "Poles of the Bezier curve"),
+ )
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Output",
+ "BlendCurve",
+ QT_TRANSLATE_NOOP("App::Property", "Output type"),
+ ).Output = ["Wire", "Joined", "Single"]
+ obj.addProperty(
+ "App::PropertyBool",
+ "AutoScale",
+ "BlendCurve",
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Compute scales to get minimal curvature along curve"
+ ),
+ ).AutoScale = False
+ obj.Scale1 = (1.0, -5.0, 5.0, 0.05)
+ obj.Scale2 = (1.0, -5.0, 5.0, 0.05)
obj.setEditorMode("CurvePts", 2)
obj.Proxy = self
@@ -53,7 +121,11 @@ def check_minimize(self, fp):
if blend_curve.CAN_MINIMIZE:
fp.setEditorMode("AutoScale", 0)
else:
- FreeCAD.Console.PrintWarning("BlendCurve: Install 'scipy' python package for AutoScale feature\n")
+ FreeCAD.Console.PrintWarning(
+ translate(
+ "Log", "BlendCurve: Install 'scipy' python package for AutoScale feature\n"
+ )
+ )
fp.setEditorMode("AutoScale", 2)
def getShape(self, fp, prop):
@@ -236,7 +308,7 @@ def __init__(self, points=[], fp=None):
elif isinstance(p, manipulators.CustomText):
self.points.append(p)
else:
- FreeCAD.Console.PrintError("pointEditor : bad input")
+ FreeCAD.Console.PrintError(translate("Log", "pointEditor : bad input"))
for p in points:
if hasattr(p, "ctrl_keys"):
for key in p.ctrl_keys:
@@ -745,4 +817,4 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('ParametricBlendCurve', ParametricBlendCurve())
+FreeCADGui.addCommand("Curves_ParametricBlendCurve", ParametricBlendCurve())
diff --git a/freecad/Curves/ParametricComb.py b/freecad/Curves/ParametricComb.py
index 4779318..95294ea 100644
--- a/freecad/Curves/ParametricComb.py
+++ b/freecad/Curves/ParametricComb.py
@@ -1,12 +1,18 @@
# -*- coding: utf-8 -*-
-__title__ = "Comb plot"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_ParametricComb", "Comb plot")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = 'Creates a parametric Comb plot on selected edges'
+__doc__ = QT_TRANSLATE_NOOP(
+ "Curves_ParametricComb", "Creates a parametric Comb plot on selected edges"
+)
import os
-import FreeCAD
import FreeCADGui
import Part
# from freecad.Curves import _utils
@@ -172,22 +178,22 @@ def __init__(self, obj , edge):
''' Add the properties '''
debug("Comb class Init")
obj.addProperty("App::PropertyLinkSubList", "Edge",
- "Comb", "Edge").Edge = edge
- # obj.addProperty("App::PropertyEnumeration","Type","Comb","Comb Type").Type=["Curvature","Unit Normal"]
+ "Comb", QT_TRANSLATE_NOOP("App::Property", "Edge")).Edge = edge
+ # obj.addProperty("App::PropertyEnumeration","Type","Comb",QT_TRANSLATE_NOOP("App::Property", "Comb Type")).Type=["Curvature","Unit Normal"]
obj.addProperty("App::PropertyFloat", "Scale",
- "Comb", "Scale (%). 0 for AutoScale").Scale = 0.0
- # obj.addProperty("App::PropertyBool","ScaleAuto","Comb","Automatic Scale").ScaleAuto = True
+ "Comb", QT_TRANSLATE_NOOP("App::Property", "Scale (%). 0 for AutoScale")).Scale = 0.0
+ # obj.addProperty("App::PropertyBool","ScaleAuto","Comb",QT_TRANSLATE_NOOP("App::Property", "Automatic Scale")).ScaleAuto = True
obj.addProperty("App::PropertyIntegerConstraint", "Samples",
- "Comb", "Number of samples").Samples = 100
+ "Comb", QT_TRANSLATE_NOOP("App::Property", "Number of samples")).Samples = 100
obj.addProperty("App::PropertyInteger", "Number",
- "Surface", "Number of surface samples").Number = 3
+ "Surface", QT_TRANSLATE_NOOP("App::Property", "Number of surface samples")).Number = 3
obj.addProperty("App::PropertyEnumeration", "Orientation",
- "Surface", "Surface Comb Orientation").Orientation = ["U", "V", "UV"]
- # obj.addProperty("App::PropertyFloat","TotalLength","Comb","Total length of edges")
+ "Surface", QT_TRANSLATE_NOOP("App::Property", "Surface Comb Orientation")).Orientation = ["U", "V", "UV"]
+ # obj.addProperty("App::PropertyFloat","TotalLength","Comb",QT_TRANSLATE_NOOP("App::Property", "Total length of edges"))
obj.addProperty("App::PropertyVectorList", "CombPoints",
- "Comb", "CombPoints")
+ "Comb", QT_TRANSLATE_NOOP("App::Property", "CombPoints"))
obj.addProperty("Part::PropertyPartShape", "Shape",
- "Comb", "Shape of comb plot")
+ "Comb", QT_TRANSLATE_NOOP("App::Property", "Shape of comb plot"))
obj.Proxy = self
# obj.Samples = (20,2,1000,10)
obj.CombPoints = []
@@ -396,9 +402,9 @@ class ViewProviderComb:
def __init__(self, obj):
"Set this object to the proxy object of the actual view provider"
obj.addProperty("App::PropertyColor", "CurveColor",
- "Comb", "Color of the curvature curve").CurveColor = (0.8, 0.0, 0.0)
+ "Comb", QT_TRANSLATE_NOOP("App::Property", "Color of the curvature curve")).CurveColor = (0.8, 0.0, 0.0)
obj.addProperty("App::PropertyColor", "CombColor",
- "Comb", "Color of the curvature comb").CombColor = (0.0, 0.8, 0.0)
+ "Comb", QT_TRANSLATE_NOOP("App::Property", "Color of the curvature comb")).CombColor = (0.0, 0.8, 0.0)
self.Object = obj.Object
obj.Proxy = self
@@ -466,16 +472,16 @@ def loc_cb(self, event_callback):
def setEdit(self, vobj, mode=0):
if mode == 0:
- FreeCAD.Console.PrintWarning("--- Entering Comb Edit Mode ---\n")
- FreeCAD.Console.PrintMessage("Nb of samples : CTRL + Mouse Up / Down\n")
- FreeCAD.Console.PrintMessage("Comb scale : SHIFT + Mouse Up / Down\n")
+ FreeCAD.Console.PrintWarning(translate("Log", "--- Entering Comb Edit Mode ---\n"))
+ FreeCAD.Console.PrintMessage(translate("Log", "Nb of samples : CTRL + Mouse Up / Down\n"))
+ FreeCAD.Console.PrintMessage(translate("Log", "Comb scale : SHIFT + Mouse Up / Down\n"))
self.view = FreeCADGui.ActiveDocument.ActiveView
self.locCB = self.view.addEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.loc_cb)
return True
return False
def unsetEdit(self, vobj, mode=0):
- FreeCAD.Console.PrintWarning("--- Exiting Comb Edit Mode ---\n")
+ FreeCAD.Console.PrintWarning(translate("Log", "--- Exiting Comb Edit Mode ---\n"))
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.locCB)
return False
@@ -602,7 +608,4 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('ParametricComb', ParametricComb())
-
-
-
+FreeCADGui.addCommand("Curves_ParametricComb", ParametricComb())
diff --git a/freecad/Curves/PlateSurface.py b/freecad/Curves/PlateSurface.py
index 6b7a61c..5044950 100644
--- a/freecad/Curves/PlateSurface.py
+++ b/freecad/Curves/PlateSurface.py
@@ -12,7 +12,7 @@
def debug(string):
if DEBUG:
FreeCAD.Console.PrintMessage(string)
- FreeCAD.Console.PrintMessage("\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "\n"))
def linkSubList_convertToOldStyle(references):
@@ -36,25 +36,25 @@ def __init__(self, obj):
debug("\nplateSurfFP class init\n")
# List of constraint objects
- obj.addProperty("App::PropertyLinkList", "Objects", "Plate", "List of constraint objects")
+ obj.addProperty("App::PropertyLinkList", "Objects", "Plate", QT_TRANSLATE_NOOP("App::Property", "List of constraint objects"))
# Arguments of the PlateSurface algorithm
- obj.addProperty("App::PropertyIntegerConstraint", "PlateDegree", "Plate", "Plate degree")
- obj.addProperty("App::PropertyIntegerConstraint", "Iterations", "Plate", "Number of iterations")
- obj.addProperty("App::PropertyFloat", "Tol2d", "Plate", "2D Tolerance")
- obj.addProperty("App::PropertyFloat", "Tol3d", "Plate", "3D Tolerance")
- obj.addProperty("App::PropertyFloat", "TolAngular", "Plate", "Angular Tolerance").TolAngular = 0.1
- obj.addProperty("App::PropertyFloat", "TolCurvature", "Plate", "Curvature Tolerance").TolCurvature = 0.1
- obj.addProperty("App::PropertyBool", "Anisotropie", "Plate", "Anisotropie").Anisotropie = False
+ obj.addProperty("App::PropertyIntegerConstraint", "PlateDegree", "Plate", QT_TRANSLATE_NOOP("App::Property", "Plate degree"))
+ obj.addProperty("App::PropertyIntegerConstraint", "Iterations", "Plate", QT_TRANSLATE_NOOP("App::Property", "Number of iterations"))
+ obj.addProperty("App::PropertyFloat", "Tol2d", "Plate", QT_TRANSLATE_NOOP("App::Property", "2D Tolerance"))
+ obj.addProperty("App::PropertyFloat", "Tol3d", "Plate", QT_TRANSLATE_NOOP("App::Property", "3D Tolerance"))
+ obj.addProperty("App::PropertyFloat", "TolAngular", "Plate", QT_TRANSLATE_NOOP("App::Property", "Angular Tolerance")).TolAngular = 0.1
+ obj.addProperty("App::PropertyFloat", "TolCurvature", "Plate", QT_TRANSLATE_NOOP("App::Property", "Curvature Tolerance")).TolCurvature = 0.1
+ obj.addProperty("App::PropertyBool", "Anisotropie", "Plate", QT_TRANSLATE_NOOP("App::Property", "Anisotropie")).Anisotropie = False
# Arguments of the BSpline approximation
- obj.addProperty("App::PropertyIntegerConstraint", "MaxDegree", "SurfaceApproximation", "Max degree of Bspline approximation")
- obj.addProperty("App::PropertyIntegerConstraint", "MaxSegments", "SurfaceApproximation", "Max Number of surface segments")
- obj.addProperty("App::PropertyFloat", "MaxDistance", "SurfaceApproximation", "Max Distance to plate surface").MaxDistance = 0.001
- obj.addProperty("App::PropertyFloat", "Tolerance", "SurfaceApproximation", "3D Tolerance of Bspline approximation").Tolerance = 0.01
- obj.addProperty("App::PropertyIntegerConstraint", "CritOrder", "SurfaceApproximation", "Criterion Order")
- obj.addProperty("App::PropertyEnumeration", "Continuity", "SurfaceApproximation", "Desired continuity of the surface").Continuity=["C0","C1","C2"]
- obj.addProperty("App::PropertyFloat", "EnlargeCoeff", "SurfaceApproximation", "Enlarge Coefficient").EnlargeCoeff = 1.1
+ obj.addProperty("App::PropertyIntegerConstraint", "MaxDegree", "SurfaceApproximation", QT_TRANSLATE_NOOP("App::Property", "Max degree of Bspline approximation"))
+ obj.addProperty("App::PropertyIntegerConstraint", "MaxSegments", "SurfaceApproximation", QT_TRANSLATE_NOOP("App::Property", "Max Number of surface segments"))
+ obj.addProperty("App::PropertyFloat", "MaxDistance", "SurfaceApproximation", QT_TRANSLATE_NOOP("App::Property", "Max Distance to plate surface")).MaxDistance = 0.001
+ obj.addProperty("App::PropertyFloat", "Tolerance", "SurfaceApproximation", QT_TRANSLATE_NOOP("App::Property", "3D Tolerance of Bspline approximation")).Tolerance = 0.01
+ obj.addProperty("App::PropertyIntegerConstraint", "CritOrder", "SurfaceApproximation", QT_TRANSLATE_NOOP("App::Property", "Criterion Order"))
+ obj.addProperty("App::PropertyEnumeration", "Continuity", "SurfaceApproximation", QT_TRANSLATE_NOOP("App::Property", "Desired continuity of the surface")).Continuity=["C0","C1","C2"]
+ obj.addProperty("App::PropertyFloat", "EnlargeCoeff", "SurfaceApproximation", QT_TRANSLATE_NOOP("App::Property", "Enlarge Coefficient")).EnlargeCoeff = 1.1
obj.Proxy = self
obj.PlateDegree = ( 3, 3, 25, 1)
diff --git a/freecad/Curves/PointInterpolation.py b/freecad/Curves/PointInterpolation.py
index eb397fd..f9c2290 100644
--- a/freecad/Curves/PointInterpolation.py
+++ b/freecad/Curves/PointInterpolation.py
@@ -25,8 +25,8 @@ def __init__(self, points, periodic=False):
self.Periodic = periodic
self.check_duplicates()
if self.Periodic and (not self.Duplicates) and self.are_closed():
- FreeCAD.Console.PrintMessage("Periodic interpolation\n")
- FreeCAD.Console.PrintMessage("Ignoring duplicate last point\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Periodic interpolation\n"))
+ FreeCAD.Console.PrintMessage(translate("Log", "Ignoring duplicate last point\n"))
self.Points = points[:-1]
def are_closed(self):
@@ -41,7 +41,7 @@ def check_duplicates(self):
if self.Points[i].distanceToPoint(self.Points[i - 1]) > self.Tolerance:
self.Duplicates = False
break
- FreeCAD.Console.PrintMessage("Duplicates point list\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Duplicates point list\n"))
return self.Duplicates
def parameters_along_curve(self, curve):
@@ -54,8 +54,8 @@ def parameters_along_curve(self, curve):
if par > params[-1]:
params.append(par)
else:
- FreeCAD.Console.PrintError("Parameters are not increasing\n")
- FreeCAD.Console.PrintError("Falling back to ChordLength\n")
+ FreeCAD.Console.PrintError(translate("Log", "Parameters are not increasing\n"))
+ FreeCAD.Console.PrintError(translate("Log", "Falling back to ChordLength\n"))
params = self.get_parameters("ChordLength")
break
return params
diff --git a/freecad/Curves/ProfileSketch.py b/freecad/Curves/ProfileSketch.py
index eec2f99..18bc356 100644
--- a/freecad/Curves/ProfileSketch.py
+++ b/freecad/Curves/ProfileSketch.py
@@ -18,18 +18,18 @@
def debug(string):
if DEBUG:
FreeCAD.Console.PrintMessage(string)
- FreeCAD.Console.PrintMessage("\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "\n"))
class profileSupportFP:
"creates a profile sketch"
def __init__(self, obj):
''' Add the properties '''
- obj.addProperty("App::PropertyLinkSub", "Edge1", "Profile", "First support edge")
- obj.addProperty("App::PropertyLinkSub", "Edge2", "Profile", "Second support edge")
- obj.addProperty("App::PropertyFloat", "Parameter1", "Profile", "Parameter on first edge")
- obj.addProperty("App::PropertyFloat", "Parameter2", "Profile", "Parameter on second edge")
- obj.addProperty("App::PropertyVector", "MainAxis", "Profile", "Main axis of the sketch")
+ obj.addProperty("App::PropertyLinkSub", "Edge1", "Profile", QT_TRANSLATE_NOOP("App::Property", "First support edge"))
+ obj.addProperty("App::PropertyLinkSub", "Edge2", "Profile", QT_TRANSLATE_NOOP("App::Property", "Second support edge"))
+ obj.addProperty("App::PropertyFloat", "Parameter1", "Profile", QT_TRANSLATE_NOOP("App::Property", "Parameter on first edge"))
+ obj.addProperty("App::PropertyFloat", "Parameter2", "Profile", QT_TRANSLATE_NOOP("App::Property", "Parameter on second edge"))
+ obj.addProperty("App::PropertyVector", "MainAxis", "Profile", QT_TRANSLATE_NOOP("App::Property", "Main axis of the sketch"))
obj.Proxy = self
def getEdges(self, obj):
@@ -127,7 +127,7 @@ def Activated(self):
params = []
sel = FreeCADGui.Selection.getSelectionEx()
if sel == []:
- FreeCAD.Console.PrintError("Select 2 edges or vertexes first !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select 2 edges or vertexes first !\n"))
for selobj in sel:
if selobj.HasSubObjects:
for i in range(len(selobj.SubObjects)):
@@ -144,7 +144,7 @@ def Activated(self):
# par = poe[2][0][2]
params.append(0)
else:
- FreeCAD.Console.PrintError("Select 2 edges or vertexes first !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select 2 edges or vertexes first !\n"))
if shapes:
self.makeProfileFeature(shapes, params)
@@ -160,4 +160,4 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('profileSupportCmd', profSupCommand())
+FreeCADGui.addCommand("Curves_ProfileSupportPlane", profSupCommand())
diff --git a/freecad/Curves/ProfileSupportFP.py b/freecad/Curves/ProfileSupportFP.py
index 7fd4017..8dd6237 100644
--- a/freecad/Curves/ProfileSupportFP.py
+++ b/freecad/Curves/ProfileSupportFP.py
@@ -72,25 +72,25 @@ class ProfileSupportFP:
def __init__(self, obj, rail1, rail2, prof=None):
"""Add the properties"""
obj.addProperty("App::PropertyLink", "Rail1",
- "Sources", "Tooltip")
+ "Sources", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.addProperty("App::PropertyLink", "Rail2",
- "Sources", "Tooltip")
+ "Sources", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.addProperty("App::PropertyLink", "ProfileShape",
- "Sources", "Tooltip")
+ "Sources", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.addProperty("App::PropertyFloatConstraint", "Position1",
- "Settings", "Tooltip")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.addProperty("App::PropertyFloatConstraint", "Position2",
- "Settings", "Tooltip")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.addProperty("App::PropertyFloatConstraint", "NormalPosition",
- "Settings", "Tooltip")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.addProperty("App::PropertyBool", "NormalReverse",
- "Settings", "Tooltip")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.addProperty("App::PropertyDistance", "ChordLength",
- "Info", "Tooltip")
+ "Info", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.addProperty("App::PropertyDistance", "Rail1Length",
- "Info", "Tooltip")
+ "Info", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.addProperty("App::PropertyDistance", "Rail2Length",
- "Info", "Tooltip")
+ "Info", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
# obj.setPropertyStatus("ChordLength", "Output")
# obj.setPropertyStatus("Rail1Length", "Output")
# obj.setPropertyStatus("Rail2Length", "Output")
@@ -209,7 +209,7 @@ def makeFeature(self, r1, r2, pr=None):
def Activated(self):
sel = FreeCADGui.Selection.getSelection()
if len(sel) < 2:
- FreeCAD.Console.PrintError("Select 2 rail objects, and optionally some profile objects\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select 2 rail objects, and optionally some profile objects\n"))
elif len(sel) == 2:
self.makeFeature(sel[0], sel[1], None)
else:
diff --git a/freecad/Curves/ReflectLinesFP.py b/freecad/Curves/ReflectLinesFP.py
index 60f75f8..612a95e 100644
--- a/freecad/Curves/ReflectLinesFP.py
+++ b/freecad/Curves/ReflectLinesFP.py
@@ -1,16 +1,26 @@
# -*- coding: utf-8 -*-
-__title__ = "Reflect Lines"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_ReflectLines", "Reflect Lines")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Creates the reflect lines on a shape, according to a view direction"
-__usage__ = """Select an object and activate tool.
+__doc__ = translate(
+ "Curves_ReflectLines", "Creates the reflect lines on a shape, according to a view direction"
+)
+__usage__ = translate(
+ "Curves_ReflectLines",
+ """Select an object and activate tool.
This will create reflect lines according to the current view direction.
If selected object is a ReflectLines object, the view direction will be updated to the current camera direction.
If property OnShape is True, the lines will be ON the input shape (ViewPos and UpDir properties won't be used).
Otherwise, lines will be on the XY plane.
If view property TrackCam is True, the view direction will keep updating upon camera movements.
-"""
+""",
+)
import os
import FreeCAD
@@ -30,35 +40,35 @@ class ReflectLinesFP:
def __init__(self, obj, src):
"""Add the properties"""
obj.addProperty("App::PropertyLink", "Source",
- "ReflectLines", "Source object")
+ "ReflectLines", QT_TRANSLATE_NOOP("App::Property", "Source object"))
obj.addProperty("App::PropertyLinkSubList", "IndivFaces",
- "ReflectLines", "Individual faces")
+ "ReflectLines", QT_TRANSLATE_NOOP("App::Property", "Individual faces"))
obj.addProperty("App::PropertyVector", "ViewPos",
- "ReflectLines", "View position")
+ "ReflectLines", QT_TRANSLATE_NOOP("App::Property", "View position"))
obj.addProperty("App::PropertyVector", "ViewDir",
- "ReflectLines", "View direction")
+ "ReflectLines", QT_TRANSLATE_NOOP("App::Property", "View direction"))
obj.addProperty("App::PropertyVector", "UpDir",
- "ReflectLines", "Up direction")
+ "ReflectLines", QT_TRANSLATE_NOOP("App::Property", "Up direction"))
obj.addProperty("App::PropertyBool", "RemoveDuplicates",
- "CleaningOptions", "Remove duplicate edges").RemoveDuplicates = False
+ "CleaningOptions", QT_TRANSLATE_NOOP("App::Property", "Remove duplicate edges")).RemoveDuplicates = False
obj.addProperty("App::PropertyInteger", "Samples",
- "CleaningOptions", "Number of edge samples").Samples = 10
+ "CleaningOptions", QT_TRANSLATE_NOOP("App::Property", "Number of edge samples")).Samples = 10
obj.addProperty("App::PropertyQuantity", "CleaningTolerance",
- "CleaningOptions", "CleaningTolerance for duplicate detection").CleaningTolerance = 1e-3
+ "CleaningOptions", QT_TRANSLATE_NOOP("App::Property", "CleaningTolerance for duplicate detection")).CleaningTolerance = 1e-3
obj.addProperty("App::PropertyBool", "IsoLine",
- "EdgeType", "Isoparametric lines").IsoLine = True
+ "EdgeType", QT_TRANSLATE_NOOP("App::Property", "Isoparametric lines")).IsoLine = True
obj.addProperty("App::PropertyBool", "OutLine",
- "EdgeType", "Outline silhouette lines").OutLine = True
+ "EdgeType", QT_TRANSLATE_NOOP("App::Property", "Outline silhouette lines")).OutLine = True
obj.addProperty("App::PropertyBool", "Rg1Line",
- "EdgeType", "smooth edge of G1-continuity between two surfaces").Rg1Line = True
+ "EdgeType", QT_TRANSLATE_NOOP("App::Property", "smooth edge of G1-continuity between two surfaces")).Rg1Line = True
obj.addProperty("App::PropertyBool", "RgNLine",
- "EdgeType", "sewn edge of CN-continuity on one surface").RgNLine = True
+ "EdgeType", QT_TRANSLATE_NOOP("App::Property", "sewn edge of CN-continuity on one surface")).RgNLine = True
obj.addProperty("App::PropertyBool", "Sharp",
- "EdgeType", "sharp edge (of C0-continuity)").Sharp = True
+ "EdgeType", QT_TRANSLATE_NOOP("App::Property", "sharp edge (of C0-continuity)")).Sharp = True
obj.addProperty("App::PropertyBool", "Visible",
- "ReflectLines", "Generate the visible lines, or the hidden lines").Visible = True
+ "ReflectLines", QT_TRANSLATE_NOOP("App::Property", "Generate the visible lines, or the hidden lines")).Visible = True
obj.addProperty("App::PropertyBool", "OnShape",
- "ReflectLines", "Output on-shape 3D lines").OnShape = True
+ "ReflectLines", QT_TRANSLATE_NOOP("App::Property", "Output on-shape 3D lines")).OnShape = True
# obj.Samples = [10,3,999,1]
obj.ViewPos = FreeCAD.Vector(0, 0, 0)
obj.ViewDir = FreeCAD.Vector(0, 0, 1)
@@ -121,7 +131,7 @@ def onChanged(self, obj, prop):
class ReflectLinesVP:
def __init__(self, vobj):
vobj.addProperty("App::PropertyBool", "TrackCamera",
- "AutoView", "Track camera movements").TrackCamera = False
+ "AutoView", QT_TRANSLATE_NOOP("App::Property", "Track camera movements")).TrackCamera = False
vobj.Proxy = self
def onChanged(self, vobj, prop):
@@ -171,7 +181,7 @@ def makeFeature(self, s):
def Activated(self):
sel = FreeCADGui.Selection.getSelectionEx()
if sel == []:
- FreeCAD.Console.PrintError("Select an object first !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select an object first !\n"))
else:
rot = FreeCADGui.ActiveDocument.ActiveView.getCameraOrientation()
vdir = FreeCAD.Vector(0, 0, 1)
@@ -206,9 +216,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('ReflectLines', ReflectLinesCommand())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_ReflectLines", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_ReflectLines", ReflectLinesCommand())
diff --git a/freecad/Curves/RotationSweepFP.py b/freecad/Curves/RotationSweepFP.py
index 1e36e0d..e39512a 100644
--- a/freecad/Curves/RotationSweepFP.py
+++ b/freecad/Curves/RotationSweepFP.py
@@ -1,11 +1,19 @@
# -*- coding: utf-8 -*-
-__title__ = 'Rotation Sweep'
-__author__ = 'Christophe Grellier (Chris_G)'
-__license__ = 'LGPL 2.1'
-__doc__ = 'Sweep some profiles along a path, and around a point'
-__usage__ = """Select a sweep path and some profiles in the 3D View.
-If TrimPath is False, the Sweep surface will be extrapolated to fit the whole path."""
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_RotationSweep", "Rotation Sweep")
+__author__ = "Christophe Grellier (Chris_G)"
+__license__ = "LGPL 2.1"
+__doc__ = translate("Curves_RotationSweep", "Sweep some profiles along a path, and around a point")
+__usage__ = translate(
+ "Curves_RotationSweep",
+ """Select a sweep path and some profiles in the 3D View.
+If TrimPath is False, the Sweep surface will be extrapolated to fit the whole path.""",
+)
import os
import FreeCAD
@@ -29,19 +37,19 @@ class RotsweepProxyFP:
def __init__(self, obj):
"""Add the properties"""
obj.addProperty("App::PropertyLinkSubList", "Profiles",
- "InputShapes", "The list of profiles to sweep")
+ "InputShapes", QT_TRANSLATE_NOOP("App::Property", "The list of profiles to sweep"))
obj.addProperty("App::PropertyLinkSub", "Path",
- "InputShapes", "The sweep path")
+ "InputShapes", QT_TRANSLATE_NOOP("App::Property", "The sweep path"))
obj.addProperty("App::PropertyLinkSub", "FaceSupport",
- "ExtraProfiles", "Face support of the sweep path")
+ "ExtraProfiles", QT_TRANSLATE_NOOP("App::Property", "Face support of the sweep path"))
obj.addProperty("App::PropertyBool", "TrimPath",
- "Settings", "Trim the sweep shape").TrimPath = True
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Trim the sweep shape")).TrimPath = True
obj.addProperty("App::PropertyBool", "ViewProfiles",
- "Settings", "Add profiles to the sweep shape")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Add profiles to the sweep shape"))
obj.addProperty("App::PropertyInteger", "ExtraProfiles",
- "ExtraProfiles", "Number of extra profiles")
+ "ExtraProfiles", QT_TRANSLATE_NOOP("App::Property", "Number of extra profiles"))
obj.addProperty("App::PropertyBool", "SmoothTop",
- "Settings", "Build a smooth top with extra profiles")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Build a smooth top with extra profiles"))
obj.setEditorMode("ViewProfiles", 2)
# obj.setEditorMode("ExtraProfiles", 2)
obj.Proxy = self
@@ -210,9 +218,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('Curves_RotationSweep', RotsweepFPCommand())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_RotationSweep", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_RotationSweep", RotsweepFPCommand())
diff --git a/freecad/Curves/Sketch_On_Surface.py b/freecad/Curves/Sketch_On_Surface.py
index de650a1..2b771fd 100644
--- a/freecad/Curves/Sketch_On_Surface.py
+++ b/freecad/Curves/Sketch_On_Surface.py
@@ -163,26 +163,26 @@ class sketchOnSurface:
"This feature object maps a sketch on a surface"
def __init__(self, obj):
obj.addProperty("App::PropertyLink", "Sketch", "SketchOnSurface",
- "Input Sketch")
+ QT_TRANSLATE_NOOP("App::Property", "Input Sketch"))
obj.addProperty("App::PropertyLinkList", "ExtraObjects",
"SketchOnSurface",
- "Additional objects that will be mapped on surface")
+ QT_TRANSLATE_NOOP("App::Property", "Additional objects that will be mapped on surface"))
obj.addProperty("App::PropertyBool", "FillFaces", "Settings",
- "Make faces from closed wires").FillFaces = False
+ QT_TRANSLATE_NOOP("App::Property", "Make faces from closed wires")).FillFaces = False
obj.addProperty("App::PropertyBool", "FillExtrusion", "Settings",
- "Add extrusion faces").FillExtrusion = True
+ QT_TRANSLATE_NOOP("App::Property", "Add extrusion faces")).FillExtrusion = True
obj.addProperty("App::PropertyFloat", "Offset", "Settings",
- "Offset distance of mapped sketch").Offset = 0.0
+ QT_TRANSLATE_NOOP("App::Property", "Offset distance of mapped sketch")).Offset = 0.0
obj.addProperty("App::PropertyFloat", "Thickness", "Settings",
- "Extrusion thickness").Thickness = 0.0
+ QT_TRANSLATE_NOOP("App::Property", "Extrusion thickness")).Thickness = 0.0
obj.addProperty("App::PropertyBool", "ReverseU", "Touchup",
- "Reverse U direction").ReverseU = False
+ QT_TRANSLATE_NOOP("App::Property", "Reverse U direction")).ReverseU = False
obj.addProperty("App::PropertyBool", "ReverseV", "Touchup",
- "Reverse V direction").ReverseV = False
+ QT_TRANSLATE_NOOP("App::Property", "Reverse V direction")).ReverseV = False
obj.addProperty("App::PropertyBool", "SwapUV", "Touchup",
- "Swap U and V directions").ReverseV = False
+ QT_TRANSLATE_NOOP("App::Property", "Swap U and V directions")).ReverseV = False
obj.addProperty("App::PropertyBool", "ConstructionBounds", "Touchup",
- "include construction geometry in sketch bounds").ConstructionBounds = True
+ QT_TRANSLATE_NOOP("App::Property", "include construction geometry in sketch bounds")).ConstructionBounds = True
obj.Proxy = self
def force_closed_bspline2d(self, c2d):
@@ -379,7 +379,7 @@ def execute(self, obj):
# faces.extend(loft.Faces)
# except Part.OCCError:
# # error_wires.extend([shapes_1[i].Wires[j], shapes_2[i].Wires[j]])
- # FreeCAD.Console.PrintError("Sketch on surface : failed to create loft face ({},{})".format(i,j))
+ # FreeCAD.Console.PrintError(translate("Log", "Sketch on surface : failed to create loft face ({},{})")).format(i,j)
try:
shell = Part.Shell(faces)
shell.sewShape()
@@ -388,7 +388,7 @@ def execute(self, obj):
solid.fixTolerance(1e-5)
shapes.append(solid)
except Exception:
- FreeCAD.Console.PrintWarning("Sketch on surface : failed to create solid # {}.\n".format(i + 1))
+ FreeCAD.Console.PrintWarning(translate("Log", "Sketch on surface : failed to create solid # {}.\n")).format(i + 1)
shapes.extend(faces)
else:
ruled = ruled_surface(shapes_1[i].Wires[0], shapes_2[i].Wires[0])
@@ -514,7 +514,7 @@ def Activated(self):
doc = FreeCAD.ActiveDocument
sketch, face_link = self.get_selection()
if not sketch and not face_link:
- FreeCAD.Console.PrintMessage("Please select a face (in the 3D view) or a sketch\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Please select a face (in the 3D view) or a sketch\n"))
return
if not sketch:
sketch = doc.addObject('Sketcher::SketchObject', 'Mapped_Sketch')
@@ -539,4 +539,4 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('SoS', SoS())
+FreeCADGui.addCommand("Curves_SketchOnSurface", SoS())
diff --git a/freecad/Curves/SurfaceAnalysisFP.py b/freecad/Curves/SurfaceAnalysisFP.py
index 6f51f83..3e63dcb 100644
--- a/freecad/Curves/SurfaceAnalysisFP.py
+++ b/freecad/Curves/SurfaceAnalysisFP.py
@@ -74,7 +74,7 @@ class SurfaceAnalysisProxyFP:
def __init__(self, obj):
"""Add the properties"""
obj.addProperty("App::PropertyLinkList", "Sources",
- "Group", "Tooltip")
+ "Group", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.Proxy = self
def execute(self, obj):
@@ -87,29 +87,29 @@ def onChanged(self, obj, prop):
class SurfaceAnalysisProxyVP:
def __init__(self, viewobj):
viewobj.addProperty("App::PropertyVector", "Direction",
- "AnalysisMode", "Analysis Direction")
+ "AnalysisMode", QT_TRANSLATE_NOOP("App::Property", "Analysis Direction"))
viewobj.addProperty("App::PropertyEnumeration", "Mode",
- "AnalysisMode", "Analysis Mode")
+ "AnalysisMode", QT_TRANSLATE_NOOP("App::Property", "Analysis Mode"))
viewobj.addProperty("App::PropertyBool", "Fixed",
- "AnalysisMode", "Fix analysis direction to global coordinate system")
+ "AnalysisMode", QT_TRANSLATE_NOOP("App::Property", "Fix analysis direction to global coordinate system"))
viewobj.addProperty("App::PropertyInteger", "StripesNumber",
- "AnalysisOptions", "Number of stripes (Zebra, Rainbow)")
+ "AnalysisOptions", QT_TRANSLATE_NOOP("App::Property", "Number of stripes (Zebra, Rainbow)"))
viewobj.addProperty("App::PropertyFloatConstraint", "StripesRatio",
- "AnalysisOptions", "Relative width of stripes (Zebra)")
+ "AnalysisOptions", QT_TRANSLATE_NOOP("App::Property", "Relative width of stripes (Zebra)"))
viewobj.addProperty("App::PropertyColor", "Color1",
- "AnalysisOptions", "First color (Zebra, Rainbow, Isophote)")
+ "AnalysisOptions", QT_TRANSLATE_NOOP("App::Property", "First color (Zebra, Rainbow, Isophote)"))
viewobj.addProperty("App::PropertyColor", "Color2",
- "AnalysisOptions", "Second color (Zebra, Rainbow, Isophote)")
+ "AnalysisOptions", QT_TRANSLATE_NOOP("App::Property", "Second color (Zebra, Rainbow, Isophote)"))
viewobj.addProperty("App::PropertyFloatConstraint", "RainbowAngle1",
- "AnalysisOptions", "Start angle of the rainbow")
+ "AnalysisOptions", QT_TRANSLATE_NOOP("App::Property", "Start angle of the rainbow"))
viewobj.addProperty("App::PropertyFloatConstraint", "RainbowAngle2",
- "AnalysisOptions", "End angle of the rainbow")
+ "AnalysisOptions", QT_TRANSLATE_NOOP("App::Property", "End angle of the rainbow"))
viewobj.addProperty("App::PropertyFloatList", "IsoAngles",
- "AnalysisOptions", "Angles of isophote curves")
+ "AnalysisOptions", QT_TRANSLATE_NOOP("App::Property", "Angles of isophote curves"))
viewobj.addProperty("App::PropertyFloat", "IsoTolerance",
- "AnalysisOptions", "Angular tolerance of isophote curves")
+ "AnalysisOptions", QT_TRANSLATE_NOOP("App::Property", "Angular tolerance of isophote curves"))
viewobj.addProperty("App::PropertyFloatConstraint", "Shading",
- "AnalysisMode", "Amount of shading on the analysis overlay")
+ "AnalysisMode", QT_TRANSLATE_NOOP("App::Property", "Amount of shading on the analysis overlay"))
viewobj.Direction = (1, 0, 0)
viewobj.Mode = ["Zebra", "Rainbow", "Isophote"]
viewobj.Mode = "Zebra"
@@ -240,7 +240,7 @@ def setPreselection(self, doc, obj, sub):
pass
def clearSelection(self, doc): # If screen is clicked, delete selection
- # FreeCAD.Console.PrintMessage("clearSelection\n")
+ # FreeCAD.Console.PrintMessage(translate("Log", "clearSelection\n"))
pass # self.Object.ViewObject.DraftAngles = []
class SurfaceAnalysisCommand:
diff --git a/freecad/Curves/Sweep2Rails.py b/freecad/Curves/Sweep2Rails.py
index 7598a6c..fb08df0 100644
--- a/freecad/Curves/Sweep2Rails.py
+++ b/freecad/Curves/Sweep2Rails.py
@@ -16,21 +16,21 @@
def debug(string):
if DEBUG:
FreeCAD.Console.PrintMessage(string)
- FreeCAD.Console.PrintMessage("\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "\n"))
class sweep2rails:
def __init__(self, obj):
obj.Proxy = self
- obj.addProperty("App::PropertyLink", "Birail", "Base", "Birail object")
- obj.addProperty("App::PropertyLinkList", "Profiles", "Base", "List of profiles")
- obj.addProperty("App::PropertyEnumeration","Blending", "Base", "Blending method").Blending = ["Average","Blend","Rail1","Rail2"]
- obj.addProperty("App::PropertyFloat", "Parametrization","Base", "Parametrization of interpolating curves")
- obj.addProperty("App::PropertyInteger", "ProfileSamples", "Base", "Profile Samples")
- obj.addProperty("App::PropertyInteger", "RailSamples", "Base", "Profile Samples")
- obj.addProperty("App::PropertyBool", "Extend", "Base", "Extend to rail limits")
- obj.addProperty("App::PropertyVectorList", "Points", "Base", "Points")
- obj.addProperty("Part::PropertyPartShape", "Shape", "Base", "Shape")
+ obj.addProperty("App::PropertyLink", "Birail", "Base", QT_TRANSLATE_NOOP("App::Property", "Birail object"))
+ obj.addProperty("App::PropertyLinkList", "Profiles", "Base", QT_TRANSLATE_NOOP("App::Property", "List of profiles"))
+ obj.addProperty("App::PropertyEnumeration","Blending", "Base", QT_TRANSLATE_NOOP("App::Property", "Blending method")).Blending = ["Average","Blend","Rail1","Rail2"]
+ obj.addProperty("App::PropertyFloat", "Parametrization","Base", QT_TRANSLATE_NOOP("App::Property", "Parametrization of interpolating curves"))
+ obj.addProperty("App::PropertyInteger", "ProfileSamples", "Base", QT_TRANSLATE_NOOP("App::Property", "Profile Samples"))
+ obj.addProperty("App::PropertyInteger", "RailSamples", "Base", QT_TRANSLATE_NOOP("App::Property", "Profile Samples"))
+ obj.addProperty("App::PropertyBool", "Extend", "Base", QT_TRANSLATE_NOOP("App::Property", "Extend to rail limits"))
+ obj.addProperty("App::PropertyVectorList", "Points", "Base", QT_TRANSLATE_NOOP("App::Property", "Points"))
+ obj.addProperty("Part::PropertyPartShape", "Shape", "Base", QT_TRANSLATE_NOOP("App::Property", "Shape"))
obj.Blending = "Blend"
obj.ProfileSamples = 20
obj.RailSamples = 20
@@ -126,7 +126,7 @@ def attach(self, vobj):
# vobj.DisplayMode = "Wireframe"
def updateData(self, fp, prop):
- FreeCAD.Console.PrintMessage("updateDate : " + str(prop) + "\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "updateDate : " + str(prop) + "\n"))
if len(fp.Points) == fp.RailSamples * fp.ProfileSamples:
self.coord.points = fp.Points
self.row.vertices = (fp.RailSamples, fp.ProfileSamples)
@@ -134,7 +134,7 @@ def updateData(self, fp, prop):
def onChanged(self, vp, prop):
"Here we can do something when a single property got changed"
- FreeCAD.Console.PrintMessage("Change property: " + str(prop) + "\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Change property: " + str(prop) + "\n"))
def getDisplayModes(self, obj):
"Return a list of display modes."
@@ -184,7 +184,7 @@ def onDelete(self, feature, subelements):
for p in self.Object.Profiles:
p.ViewObject.show()
except Exception as err:
- FreeCAD.Console.PrintError("Error in onDelete: {0} \n".format(err))
+ FreeCAD.Console.PrintError(translate("Log", "Error in onDelete: {0} \n")).format(err)
return True
@@ -202,7 +202,7 @@ def parseSel(self, selectionObject):
def Activated(self):
s = FreeCADGui.Selection.getSelection()
if s == []:
- FreeCAD.Console.PrintError("Select a ruled surface and a list of profile edges\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select a ruled surface and a list of profile edges\n"))
return
myS2R = FreeCAD.ActiveDocument.addObject("App::FeaturePython",
"Sweep 2 rails")
@@ -225,4 +225,4 @@ def GetResources(self):
'ToolTip': 'Sweep profiles on 2 rails'}
-FreeCADGui.addCommand('sw2r', s2rCommand())
+FreeCADGui.addCommand("Curves_SweepToRails", s2rCommand())
diff --git a/freecad/Curves/Sweep2RailsFP.py b/freecad/Curves/Sweep2RailsFP.py
index d27565f..e38f298 100644
--- a/freecad/Curves/Sweep2RailsFP.py
+++ b/freecad/Curves/Sweep2RailsFP.py
@@ -73,9 +73,9 @@ class Sweep2RailsObjProxy:
def __init__(self, obj, sel):
"""Add the properties"""
obj.addProperty("App::PropertyLinkList", "Rails",
- "Sources", "Tooltip")
+ "Sources", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.addProperty("App::PropertyLinkList", "Profiles",
- "Sources", "Tooltip")
+ "Sources", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.Rails = sel[:2]
obj.Profiles = sel[2:]
obj.Proxy = self
@@ -148,7 +148,7 @@ def makeFeature(self, sel=None):
def Activated(self):
sel = FreeCADGui.Selection.getSelection()
if len(sel) < 1:
- FreeCAD.Console.PrintError("Select 2 rails and at least 2 profiles\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select 2 rails and at least 2 profiles\n"))
else:
self.makeFeature(sel)
diff --git a/freecad/Curves/TemplateFP.py b/freecad/Curves/TemplateFP.py
index 05a3675..a880c98 100644
--- a/freecad/Curves/TemplateFP.py
+++ b/freecad/Curves/TemplateFP.py
@@ -28,8 +28,8 @@ class TemplateFP:
"""Creates a ..."""
def __init__(self, obj):
"""Add the properties"""
- obj.addProperty("App::PropertyLinkList", "Sources", "Group", "Tooltip")
- obj.addProperty("App::PropertyFloat", "float", "Group", "Tooltip")
+ obj.addProperty("App::PropertyLinkList", "Sources", "Group", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
+ obj.addProperty("App::PropertyFloat", "float", "Group", QT_TRANSLATE_NOOP("App::Property", "Tooltip"))
obj.Proxy = self
def execute(self, obj):
@@ -77,7 +77,7 @@ def makeFeature(self, sel=None):
def Activated(self):
sel = FreeCADGui.Selection.getSelection()
if sel == []:
- FreeCAD.Console.PrintError("Select something first !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select something first !\n"))
else:
self.makeFeature(sel)
diff --git a/freecad/Curves/TrimFace.py b/freecad/Curves/TrimFace.py
index df98ea8..864d4b9 100644
--- a/freecad/Curves/TrimFace.py
+++ b/freecad/Curves/TrimFace.py
@@ -1,12 +1,16 @@
# -*- coding: utf-8 -*-
-__title__ = 'Trim face'
-__author__ = 'Christophe Grellier (Chris_G)'
-__license__ = 'LGPL 2.1'
-__doc__ = 'Trim a face with a projected curve'
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_Trim", "Trim face")
+__author__ = "Christophe Grellier (Chris_G)"
+__license__ = "LGPL 2.1"
+__doc__ = QT_TRANSLATE_NOOP("Curves_Trim", "Trim a face with a projected curve")
import os
-import FreeCAD
import FreeCADGui
import Part
# from freecad.Curves import _utils
@@ -16,7 +20,9 @@
import BOPTools.SplitAPI
splitAPI = BOPTools.SplitAPI
except ImportError:
- FreeCAD.Console.PrintError("Failed importing BOPTools. Fallback to Part API\n")
+ FreeCAD.Console.PrintError(
+ translate("Log", "Failed importing BOPTools. Fallback to Part API\n")
+ )
splitAPI = Part.BOPTools.SplitAPI
TOOL_ICON = os.path.join(ICONPATH, 'trimFace.svg')
@@ -26,23 +32,45 @@
def debug(string):
if DEBUG:
FreeCAD.Console.PrintMessage(string)
- FreeCAD.Console.PrintMessage("\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "\n"))
class trimFace:
def __init__(self, obj):
''' Add the properties '''
debug("\ntrimFace init")
- obj.addProperty("App::PropertyLinkSub", "Face",
- "TrimFace", "Input face")
- obj.addProperty("App::PropertyVector", "PickedPoint",
- "TrimFace", "Picked point in parametric space of the face (u,v,0)")
- obj.addProperty("App::PropertyLinkSubList", "Tool",
- "TrimFace", "Trimming curve")
- obj.addProperty("App::PropertyLink", "DirVector",
- "TrimFace", "Trimming Vector")
- obj.addProperty("App::PropertyVector", "Direction",
- "TrimFace", "Trimming direction")
+ obj.addProperty(
+ "App::PropertyLinkSub",
+ "Face",
+ "TrimFace",
+ QT_TRANSLATE_NOOP("App::Property", "Input face"),
+ )
+ obj.addProperty(
+ "App::PropertyVector",
+ "PickedPoint",
+ "TrimFace",
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Picked point in parametric space of the face (u,v,0)"
+ ),
+ )
+ obj.addProperty(
+ "App::PropertyLinkSubList",
+ "Tool",
+ "TrimFace",
+ QT_TRANSLATE_NOOP("App::Property", "Trimming curve"),
+ )
+ obj.addProperty(
+ "App::PropertyLink",
+ "DirVector",
+ "TrimFace",
+ QT_TRANSLATE_NOOP("App::Property", "Trimming Vector"),
+ )
+ obj.addProperty(
+ "App::PropertyVector",
+ "Direction",
+ "TrimFace",
+ QT_TRANSLATE_NOOP("App::Property", "Trimming direction"),
+ )
obj.Proxy = self
def getFace(self, link):
@@ -235,7 +263,6 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('Trim', trim())
-
+FreeCADGui.addCommand("Curves_Trim", trim())
diff --git a/freecad/Curves/Truncate_Extend_FP.py b/freecad/Curves/Truncate_Extend_FP.py
index 25b8b4c..d8375be 100644
--- a/freecad/Curves/Truncate_Extend_FP.py
+++ b/freecad/Curves/Truncate_Extend_FP.py
@@ -24,15 +24,15 @@ class TruncateExtendFP:
def __init__(self, obj):
"""Add the properties"""
obj.addProperty("App::PropertyLink", "Source",
- "InputObjects", "The object that will be truncated or extended")
+ "InputObjects", QT_TRANSLATE_NOOP("App::Property", "The object that will be truncated or extended"))
obj.addProperty("App::PropertyLink", "Cutter",
- "InputObjects", "The planar object that cuts the Source object")
+ "InputObjects", QT_TRANSLATE_NOOP("App::Property", "The planar object that cuts the Source object"))
obj.addProperty("App::PropertyDistance", "Distance",
- "Settings", "The distance to truncate (if negative) or extend (if positive)")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "The distance to truncate (if negative) or extend (if positive)"))
obj.addProperty("App::PropertyBool", "Refine",
- "Settings", "Refine shape (clean up redundant edges)")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Refine shape (clean up redundant edges)"))
obj.addProperty("App::PropertyBool", "Reverse",
- "Settings", "Reverse cutter plane normal")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Reverse cutter plane normal"))
obj.Distance = 10.0
obj.Proxy = self
@@ -128,7 +128,7 @@ def Activated(self):
elif len(sel) == 2:
self.makePartFeature(sel)
else:
- FreeCAD.Console.PrintError("Wrong Selection\n")
+ FreeCAD.Console.PrintError(translate("Log", "Wrong Selection\n"))
def IsActive(self):
if FreeCADGui.Selection.getSelection():
@@ -142,4 +142,4 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('Curve_TruncateExtendCmd', TruncateExtendCommand())
+FreeCADGui.addCommand("Curves_TruncateExtendCmd", TruncateExtendCommand())
diff --git a/freecad/Curves/ZebraTool.py b/freecad/Curves/ZebraTool.py
index d777b36..1377872 100644
--- a/freecad/Curves/ZebraTool.py
+++ b/freecad/Curves/ZebraTool.py
@@ -7,7 +7,9 @@
from pivy import coin
from freecad.Curves.Gui import Zebra_Gui
-TOOL_ICON = os.path.join(ICONPATH, 'zebra.svg')
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+TOOL_ICON = os.path.join(ICONPATH, "zebra.svg")
def execute_later(callback, delay=0):
@@ -140,12 +142,16 @@ def Activated(self):
ZebraTool.active = True
show_task_panel(ZebraForm(self.gui))
else:
- FreeCAD.Console.PrintMessage("Zebra already active\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Zebra already active\n"))
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': 'ZebraTool',
- 'ToolTip': 'Zebra texture for surface inspection'}
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": QT_TRANSLATE_NOOP("Curves_ZebraTool", "ZebraTool"),
+ "ToolTip": QT_TRANSLATE_NOOP(
+ "Curves_ZebraTool", "Zebra texture for surface inspection"
+ ),
+ }
-FreeCADGui.addCommand('ZebraTool', ZebraTool())
+FreeCADGui.addCommand("Curves_ZebraTool", ZebraTool())
diff --git a/freecad/Curves/__init__.py b/freecad/Curves/__init__.py
index 3df875b..f73512b 100644
--- a/freecad/Curves/__init__.py
+++ b/freecad/Curves/__init__.py
@@ -3,6 +3,7 @@
from .version import __version__
ICONPATH = os.path.join(os.path.dirname(__file__), "resources", "icons")
+TRANSLATIONPATH = os.path.join(os.path.dirname(__file__), "resources", "translations")
TOL3D = 1e-7
TOL2D = 1e-9
diff --git a/freecad/Curves/_utils.py b/freecad/Curves/_utils.py
index 0bcc59b..55816c2 100644
--- a/freecad/Curves/_utils.py
+++ b/freecad/Curves/_utils.py
@@ -89,7 +89,7 @@ def getShape(obj, prop, shape_type):
res.append(getSubShape(sh, shape_type, n))
return res
else:
- FreeCAD.Console.PrintError("CurvesWB._utils.getShape: wrong property type.\n")
+ FreeCAD.Console.PrintError(translate("Log", "CurvesWB._utils.getShape: wrong property type.\n"))
return None
else:
# FreeCAD.Console.PrintError("CurvesWB._utils.getShape: %r has no property %r\n"%(obj, prop))
diff --git a/freecad/Curves/adjacent_faces.py b/freecad/Curves/adjacent_faces.py
index af4cf73..66ed49c 100644
--- a/freecad/Curves/adjacent_faces.py
+++ b/freecad/Curves/adjacent_faces.py
@@ -1,11 +1,19 @@
# -*- coding: utf-8 -*-
-__title__ = "Select Adjacent faces"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_AdjacentFaces", "Select Adjacent faces")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Select the Adjacent faces of the selected subshape"
-__usage__ = """Select a face or an edge in the 3D View, activate tool
-and all the faces that touch it will be added to the selection."""
+__doc__ = translate("Curves_AdjacentFaces", "Select the Adjacent faces of the selected subshape")
+__usage__ = translate(
+ "Curves_AdjacentFaces",
+ """Select a face or an edge in the 3D View, activate tool
+and all the faces that touch it will be added to the selection.""",
+)
import os
import FreeCAD
@@ -64,7 +72,7 @@ def Activated(self):
for a in anc:
sel.addSelection(obj, self.get_subname(shape, a))
if len(result) == 0:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
def IsActive(self):
if FreeCAD.ActiveDocument:
@@ -73,9 +81,13 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {} ".format(__doc__, __usage__)}
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {} ".format(
+ __doc__, translate("Curves_AdjacentFaces", "Usage"), __usage__
+ ),
+ }
-addCommand('Curves_adjacent_faces', adjacentfacesCommand())
+addCommand("Curves_AdjacentFaces", adjacentfacesCommand())
diff --git a/freecad/Curves/approximate.py b/freecad/Curves/approximate.py
index 7911b2b..f251066 100644
--- a/freecad/Curves/approximate.py
+++ b/freecad/Curves/approximate.py
@@ -12,14 +12,16 @@
# from freecad.Curves import _utils
from freecad.Curves import ICONPATH
-TOOL_ICON = os.path.join(ICONPATH, 'approximate.svg')
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+TOOL_ICON = os.path.join(ICONPATH, "approximate.svg")
DEBUG = False
def debug(string):
if DEBUG:
FreeCAD.Console.PrintMessage(string)
- FreeCAD.Console.PrintMessage("\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "\n"))
# ********************************************************
# **** Part.BSplineCurve.approximate() documentation *****
@@ -59,38 +61,101 @@ class Approximate:
def __init__(self, obj, source):
''' Add the properties '''
debug("\nApproximate class Init\n")
- obj.addProperty("App::PropertyLink", "PointObject", "Approximate",
- "Object containing the points to approximate").PointObject = source
- obj.addProperty("App::PropertyBool", "ClampEnds", "General",
- "Clamp endpoints").ClampEnds = False
- obj.addProperty("App::PropertyBool", "Closed", "General",
- "Force a closed curve").Closed = False
- obj.addProperty("App::PropertyInteger", "DegreeMin", "General",
- "Minimum degree of the curve").DegreeMin = 3
- obj.addProperty("App::PropertyInteger", "DegreeMax", "General",
- "Maximum degree of the curve").DegreeMax = 5
- obj.addProperty("App::PropertyFloat", "ApproxTolerance", "General",
- "Approximation tolerance")
- obj.addProperty("App::PropertyEnumeration", "Continuity", "General",
- "Desired continuity of the curve").Continuity = ["C0", "C1", "G1", "C2", "G2", "C3", "CN"]
- obj.addProperty("App::PropertyEnumeration", "Method", "General",
- "Approximation method").Method = ["Parametrization", "Smoothing Algorithm"]
- obj.addProperty("App::PropertyEnumeration", "Parametrization", "Parameters",
- "Parametrization type").Parametrization = ["ChordLength", "Centripetal", "Uniform", "Curvilinear"]
- obj.addProperty("App::PropertyFloatConstraint", "LengthWeight", "Parameters",
- "Weight of curve length for smoothing algorithm").LengthWeight = 1.0
- obj.addProperty("App::PropertyFloatConstraint", "CurvatureWeight", "Parameters",
- "Weight of curve curvature for smoothing algorithm").CurvatureWeight = 1.0
- obj.addProperty("App::PropertyFloatConstraint", "TorsionWeight", "Parameters",
- "Weight of curve torsion for smoothing algorithm").TorsionWeight = 1.0
- obj.addProperty("App::PropertyInteger", "FirstIndex", "Range",
- "Index of first point").FirstIndex = 0
- obj.addProperty("App::PropertyInteger", "LastIndex", "Range",
- "Index of last point (-1 to ignore)")
- obj.addProperty("App::PropertyInteger", "StartOffset", "Range",
- "For closed curves, allows to choose the location of the join point").StartOffset = 0
- # obj.addProperty("App::PropertyVectorList", "Points", "Approximate", "Points")
- # obj.addProperty("Part::PropertyPartShape", "Shape", "Approximate", "Shape")
+ obj.addProperty(
+ "App::PropertyLink",
+ "PointObject",
+ "Approximate",
+ QT_TRANSLATE_NOOP("App::Property", "Object containing the points to approximate"),
+ ).PointObject = source
+ obj.addProperty(
+ "App::PropertyBool",
+ "ClampEnds",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Clamp endpoints"),
+ ).ClampEnds = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "Closed",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Force a closed curve"),
+ ).Closed = False
+ obj.addProperty(
+ "App::PropertyInteger",
+ "DegreeMin",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Minimum degree of the curve"),
+ ).DegreeMin = 3
+ obj.addProperty(
+ "App::PropertyInteger",
+ "DegreeMax",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Maximum degree of the curve"),
+ ).DegreeMax = 5
+ obj.addProperty(
+ "App::PropertyFloat",
+ "ApproxTolerance",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Approximation tolerance"),
+ )
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Continuity",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Desired continuity of the curve"),
+ ).Continuity = ["C0", "C1", "G1", "C2", "G2", "C3", "CN"]
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Method",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Approximation method"),
+ ).Method = ["Parametrization", "Smoothing Algorithm"]
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Parametrization",
+ "Parameters",
+ QT_TRANSLATE_NOOP("App::Property", "Parametrization type"),
+ ).Parametrization = ["ChordLength", "Centripetal", "Uniform", "Curvilinear"]
+ obj.addProperty(
+ "App::PropertyFloatConstraint",
+ "LengthWeight",
+ "Parameters",
+ QT_TRANSLATE_NOOP("App::Property", "Weight of curve length for smoothing algorithm"),
+ ).LengthWeight = 1.0
+ obj.addProperty(
+ "App::PropertyFloatConstraint",
+ "CurvatureWeight",
+ "Parameters",
+ QT_TRANSLATE_NOOP("App::Property", "Weight of curve curvature for smoothing algorithm"),
+ ).CurvatureWeight = 1.0
+ obj.addProperty(
+ "App::PropertyFloatConstraint",
+ "TorsionWeight",
+ "Parameters",
+ QT_TRANSLATE_NOOP("App::Property", "Weight of curve torsion for smoothing algorithm"),
+ ).TorsionWeight = 1.0
+ obj.addProperty(
+ "App::PropertyInteger",
+ "FirstIndex",
+ "Range",
+ QT_TRANSLATE_NOOP("App::Property", "Index of first point"),
+ ).FirstIndex = 0
+ obj.addProperty(
+ "App::PropertyInteger",
+ "LastIndex",
+ "Range",
+ QT_TRANSLATE_NOOP("App::Property", "Index of last point (-1 to ignore)"),
+ )
+ obj.addProperty(
+ "App::PropertyInteger",
+ "StartOffset",
+ "Range",
+ QT_TRANSLATE_NOOP(
+ "App::Property",
+ "For closed curves, allows to choose the location of the join point",
+ ),
+ ).StartOffset = 0
+ # obj.addProperty("App::PropertyVectorList", "Points", "Approximate", QT_TRANSLATE_NOOP("App::Property", "Points"))
+ # obj.addProperty("Part::PropertyPartShape", "Shape", "Approximate", QT_TRANSLATE_NOOP("App::Property", "Shape"))
obj.Proxy = self
self.obj = obj
self.Points = []
@@ -366,7 +431,7 @@ def onDelete(self, feature, subelements):
try:
self.Object.PointObject.ViewObject.Visibility = True
except Exception as err:
- FreeCAD.Console.PrintError("Error in onDelete: {0} \n".format(err))
+ FreeCAD.Console.PrintError(translate("Log", "Error in onDelete: {0} \n")).format(err)
return True
@@ -383,7 +448,9 @@ def parseSel(self, selectionObject):
if res:
return res
else:
- FreeCAD.Console.PrintMessage("\nPlease select an object that has at least 2 vertexes")
+ FreeCAD.Console.PrintMessage(
+ translate("Log", "\nPlease select an object that has at least 2 vertexes")
+ )
return None
def Activated(self):
@@ -411,12 +478,13 @@ def Activated(self):
FreeCAD.ActiveDocument.recompute()
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': 'Approximate',
- 'ToolTip': 'Approximate points to NURBS curve or surface'}
-
-
-FreeCADGui.addCommand('Approximate', approx())
-
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": QT_TRANSLATE_NOOP("Curves_Approximate", "Approximate"),
+ "ToolTip": QT_TRANSLATE_NOOP(
+ "Curves_Approximate", "Approximate points to NURBS curve or surface"
+ ),
+ }
+FreeCADGui.addCommand("Curves_Approximate", approx())
diff --git a/freecad/Curves/approximate_extension.py b/freecad/Curves/approximate_extension.py
index f3d3efb..b0a460e 100644
--- a/freecad/Curves/approximate_extension.py
+++ b/freecad/Curves/approximate_extension.py
@@ -51,14 +51,14 @@ class ApproximateExtension:
def __init__(self, obj):
''' Add the properties '''
debug("\nApproximate extension Init\n")
- obj.addProperty("App::PropertyInteger", "Samples", "ShapeApproximation", "Number of samples").Samples = 100
- obj.addProperty("App::PropertyBool", "Active", "ShapeApproximation", "Use approximation")
- obj.addProperty("App::PropertyInteger", "DegreeMin", "ShapeApproximation", "Minimum degree of the curve").DegreeMin = 3
- obj.addProperty("App::PropertyInteger", "DegreeMax", "ShapeApproximation", "Maximum degree of the curve").DegreeMax = 5
- obj.addProperty("App::PropertyFloat", "ApproxTolerance", "ShapeApproximation", "Approximation tolerance")
- obj.addProperty("App::PropertyEnumeration", "Continuity", "ShapeApproximation", "Desired continuity of the curve").Continuity = ["C0", "C1", "G1", "C2", "G2", "C3", "CN"]
- obj.addProperty("App::PropertyEnumeration", "Parametrization", "ShapeApproximation", "Parametrization type").Parametrization = ["ChordLength", "Centripetal", "Uniform"]
- obj.addProperty("App::PropertyPythonObject", "ExtensionProxy", "ShapeApproximation", "Proxy object of the approximation extension").ExtensionProxy = self
+ obj.addProperty("App::PropertyInteger", "Samples", "ShapeApproximation", QT_TRANSLATE_NOOP("App::Property", "Number of samples")).Samples = 100
+ obj.addProperty("App::PropertyBool", "Active", "ShapeApproximation", QT_TRANSLATE_NOOP("App::Property", "Use approximation"))
+ obj.addProperty("App::PropertyInteger", "DegreeMin", "ShapeApproximation", QT_TRANSLATE_NOOP("App::Property", "Minimum degree of the curve")).DegreeMin = 3
+ obj.addProperty("App::PropertyInteger", "DegreeMax", "ShapeApproximation", QT_TRANSLATE_NOOP("App::Property", "Maximum degree of the curve")).DegreeMax = 5
+ obj.addProperty("App::PropertyFloat", "ApproxTolerance", "ShapeApproximation", QT_TRANSLATE_NOOP("App::Property", "Approximation tolerance"))
+ obj.addProperty("App::PropertyEnumeration", "Continuity", "ShapeApproximation", QT_TRANSLATE_NOOP("App::Property", "Desired continuity of the curve")).Continuity = ["C0", "C1", "G1", "C2", "G2", "C3", "CN"]
+ obj.addProperty("App::PropertyEnumeration", "Parametrization", "ShapeApproximation", QT_TRANSLATE_NOOP("App::Property", "Parametrization type")).Parametrization = ["ChordLength", "Centripetal", "Uniform"]
+ obj.addProperty("App::PropertyPythonObject", "ExtensionProxy", "ShapeApproximation", QT_TRANSLATE_NOOP("App::Property", "Proxy object of the approximation extension")).ExtensionProxy = self
obj.Parametrization = "ChordLength"
obj.Continuity = 'C3'
self.setTolerance(obj)
diff --git a/freecad/Curves/blendSolidFP.py b/freecad/Curves/blendSolidFP.py
index 5196b0c..7b295ea 100644
--- a/freecad/Curves/blendSolidFP.py
+++ b/freecad/Curves/blendSolidFP.py
@@ -1,10 +1,20 @@
# -*- coding: utf-8 -*-
-__title__ = "BlendSolid"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_BlendSolid", "BlendSolid")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Create a solid between two faces with some continuity with their support shapes"
-__usage__ = "Select a face on each of the two solids to blend, in the 3D View."
+__doc__ = translate(
+ "Curves_BlendSolid",
+ "Create a solid between two faces with some continuity with their support shapes",
+)
+__usage__ = translate(
+ "Curves_BlendSolid", "Select a face on each of the two solids to blend, in the 3D View."
+)
import os
import FreeCAD
@@ -22,31 +32,31 @@ class BlendSolidProxy:
"""Proxy of a BlendSolid FeaturePython object"""
def __init__(self, obj):
obj.addProperty("App::PropertyLinkSubList", "Sources",
- "Base", "Faces to join")
+ "Base", QT_TRANSLATE_NOOP("App::Property", "Faces to join"))
obj.addProperty("App::PropertyInteger", "Samples",
- "Settings", "Number of samples to generate each surface")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Number of samples to generate each surface"))
obj.addProperty("App::PropertyBool", "Fuse",
- "Settings", "Fuse the 3 solids together")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Fuse the 3 solids together"))
# obj.addProperty("App::PropertyEnumeration", "Algo",
- # "Untwist", "Method used to untwist the wires")
+ # "Untwist", QT_TRANSLATE_NOOP("App::Property", "Method used to untwist the wires"))
# obj.addProperty("App::PropertyLinkSubList", "MatchingShapes",
- # "Untwist", "User selected matching edges or vertexes")
+ # "Untwist", QT_TRANSLATE_NOOP("App::Property", "User selected matching edges or vertexes"))
# obj.addProperty("App::PropertyVectorList", "Offset",
- # "Untwist", "Offset edge indices")
+ # "Untwist", QT_TRANSLATE_NOOP("App::Property", "Offset edge indices"))
obj.addProperty("App::PropertyInteger", "Continuity1",
- "Continuity", "Continuity order G... with shape 1")
+ "Continuity", QT_TRANSLATE_NOOP("App::Property", "Continuity order G... with shape 1"))
obj.addProperty("App::PropertyInteger", "Continuity2",
- "Continuity", "Continuity order G... with shape 2")
+ "Continuity", QT_TRANSLATE_NOOP("App::Property", "Continuity order G... with shape 2"))
obj.addProperty("App::PropertyEnumeration", "AutoScale",
- "Scale", "Compute scales to get regular poles, or minimal curvature")
+ "Scale", QT_TRANSLATE_NOOP("App::Property", "Compute scales to get regular poles, or minimal curvature"))
obj.addProperty("App::PropertyInteger", "ScaleSamples",
- "Scale", "Number of samples for auto scaling")
+ "Scale", QT_TRANSLATE_NOOP("App::Property", "Number of samples for auto scaling"))
obj.addProperty("App::PropertyFloatList", "Scale1",
- "Scale", "Scale values along face 1")
+ "Scale", QT_TRANSLATE_NOOP("App::Property", "Scale values along face 1"))
obj.addProperty("App::PropertyFloatList", "Scale2",
- "Scale", "Scale values along face 2")
+ "Scale", QT_TRANSLATE_NOOP("App::Property", "Scale values along face 2"))
obj.addProperty("App::PropertyString", "ShapeType",
- "Status", "Status of the created shape")
+ "Status", QT_TRANSLATE_NOOP("App::Property", "Status of the created shape"))
obj.ShapeType = ""
obj.setEditorMode("ShapeType", 1)
obj.ScaleSamples = 6
@@ -227,14 +237,14 @@ def Activated(self):
if "Face" in sen:
sources.append((selobj.Object, sen))
if not len(sources) == 2:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
else:
f1 = sources[0][0].getSubObject(sources[0][1])
f2 = sources[1][0].getSubObject(sources[1][1])
if len(f1.Edges) == len(f2.Edges):
self.makeFeature(sources)
else:
- FreeCAD.Console.PrintError("BlendSolid : The two faces must have the same number of edges\n")
+ FreeCAD.Console.PrintError(translate("Log", "BlendSolid : The two faces must have the same number of edges\n"))
def IsActive(self):
if FreeCAD.ActiveDocument:
@@ -243,9 +253,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_BlendSolid", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
-FreeCADGui.addCommand('Curves_BlendSolid', BlendSolidCommand())
+FreeCADGui.addCommand("Curves_BlendSolid", BlendSolidCommand())
diff --git a/freecad/Curves/blendSurface.py b/freecad/Curves/blendSurface.py
index bea8e0f..dbc94b1 100644
--- a/freecad/Curves/blendSurface.py
+++ b/freecad/Curves/blendSurface.py
@@ -77,7 +77,7 @@ def compute_scale(self, sc, edge):
elif isinstance(sc, (float, int)):
return([float(sc)] * self.railSamples)
else:
- FreeCAD.Console.PrintError("BlendSurface : failed to compute scale\n{}\n".format(sc))
+ FreeCAD.Console.PrintError(translate("Log", "BlendSurface : failed to compute scale\n{}\n")).format(sc)
return(None)
def cross_curves2(self):
diff --git a/freecad/Curves/blendSurfaceFP.py b/freecad/Curves/blendSurfaceFP.py
index 42c4bc6..98cdecd 100644
--- a/freecad/Curves/blendSurfaceFP.py
+++ b/freecad/Curves/blendSurfaceFP.py
@@ -15,7 +15,7 @@
def debug(string):
if DEBUG:
FreeCAD.Console.PrintMessage(string)
- FreeCAD.Console.PrintMessage("\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "\n"))
def downgradeArray(arr):
@@ -47,20 +47,20 @@ def getComboView(mw):
class blendSurfFP:
def __init__(self, obj):
obj.Proxy = self
- obj.addProperty("App::PropertyLink", "Edge1", "Base", "First edge")
- obj.addProperty("App::PropertyLink", "Edge2", "Base", "Second edge")
- #obj.addProperty("App::PropertyEnumeration","Blending", "Base", "Blending method").Blending = ["Average","Blend","Rail1","Rail2"]
- obj.addProperty("App::PropertyPlacement", "Placement", "Base", "Placement")
- obj.addProperty("App::PropertyFloatConstraint", "Scale1", "Edge1", "Scale of blend curve")
- obj.addProperty("App::PropertyEnumeration", "Continuity1","Edge1", "Continuity").Continuity1=["C0","G1","G2","G3","G4"]
- obj.addProperty("App::PropertyFloatConstraint", "Scale2", "Edge2", "Scale of blend curve")
- obj.addProperty("App::PropertyEnumeration", "Continuity2","Edge2", "Continuity").Continuity2=["C0","G1","G2","G3","G4"]
- obj.addProperty("App::PropertyInteger", "ProfileSamples", "BlendSurface", "Profile Samples")
- obj.addProperty("App::PropertyInteger", "RailSamples", "BlendSurface", "Edge Samples")
- obj.addProperty("App::PropertyBool", "Untwist", "BlendSurface", "Untwist surface")
- obj.addProperty("App::PropertyVectorList", "Points", "BlendSurface", "Points")
- obj.addProperty("App::PropertyVectorList", "ScaleList1", "BlendSurface", "Variable scale 1: list of vectors(parameter, scale1, 0)")
- obj.addProperty("App::PropertyVectorList", "ScaleList2", "BlendSurface", "Variable scale 2: list of vectors(parameter, scale2, 0)")
+ obj.addProperty("App::PropertyLink", "Edge1", "Base", QT_TRANSLATE_NOOP("App::Property", "First edge"))
+ obj.addProperty("App::PropertyLink", "Edge2", "Base", QT_TRANSLATE_NOOP("App::Property", "Second edge"))
+ #obj.addProperty("App::PropertyEnumeration","Blending", "Base", QT_TRANSLATE_NOOP("App::Property", "Blending method")).Blending = ["Average","Blend","Rail1","Rail2"]
+ obj.addProperty("App::PropertyPlacement", "Placement", "Base", QT_TRANSLATE_NOOP("App::Property", "Placement"))
+ obj.addProperty("App::PropertyFloatConstraint", "Scale1", "Edge1", QT_TRANSLATE_NOOP("App::Property", "Scale of blend curve"))
+ obj.addProperty("App::PropertyEnumeration", "Continuity1","Edge1", QT_TRANSLATE_NOOP("App::Property", "Continuity")).Continuity1=["C0","G1","G2","G3","G4"]
+ obj.addProperty("App::PropertyFloatConstraint", "Scale2", "Edge2", QT_TRANSLATE_NOOP("App::Property", "Scale of blend curve"))
+ obj.addProperty("App::PropertyEnumeration", "Continuity2","Edge2", QT_TRANSLATE_NOOP("App::Property", "Continuity")).Continuity2=["C0","G1","G2","G3","G4"]
+ obj.addProperty("App::PropertyInteger", "ProfileSamples", "BlendSurface", QT_TRANSLATE_NOOP("App::Property", "Profile Samples"))
+ obj.addProperty("App::PropertyInteger", "RailSamples", "BlendSurface", QT_TRANSLATE_NOOP("App::Property", "Edge Samples"))
+ obj.addProperty("App::PropertyBool", "Untwist", "BlendSurface", QT_TRANSLATE_NOOP("App::Property", "Untwist surface"))
+ obj.addProperty("App::PropertyVectorList", "Points", "BlendSurface", QT_TRANSLATE_NOOP("App::Property", "Points"))
+ obj.addProperty("App::PropertyVectorList", "ScaleList1", "BlendSurface", QT_TRANSLATE_NOOP("App::Property", "Variable scale 1: list of vectors(parameter, scale1, 0)"))
+ obj.addProperty("App::PropertyVectorList", "ScaleList2", "BlendSurface", QT_TRANSLATE_NOOP("App::Property", "Variable scale 2: list of vectors(parameter, scale2, 0)"))
obj.Continuity1 = "G2"
obj.Continuity2 = "G2"
@@ -191,7 +191,7 @@ def attach(self, vobj):
##vobj.DisplayMode = "Wireframe"
#def updateData(self, fp, prop):
- #FreeCAD.Console.PrintMessage("updateDate : " + str(prop) + "\n")
+ #FreeCAD.Console.PrintMessage(translate("Log", "updateDate : " + str(prop) + "\n"))
#if len(fp.Points) == fp.RailSamples * fp.ProfileSamples :
#self.coord.points = fp.Points
#self.row.vertices = (fp.RailSamples, fp.ProfileSamples)
@@ -205,7 +205,7 @@ def attach(self, vobj):
#def onChanged(self, vp, prop):
#"Here we can do something when a single property got changed"
- #FreeCAD.Console.PrintMessage("Change property: " + str(prop) + "\n")
+ #FreeCAD.Console.PrintMessage(translate("Log", "Change property: " + str(prop) + "\n"))
#def getDisplayModes(self,obj):
#"Return a list of display modes."
@@ -287,7 +287,7 @@ def onDelete(self, feature, subelements): # subelements is a tuple of strings
self.Object.Edge1.ViewObject.show()
self.Object.Edge2.ViewObject.show()
except Exception as err:
- FreeCAD.Console.PrintError("Error in onDelete: {0} \n".format(err))
+ FreeCAD.Console.PrintError(translate("Log", "Error in onDelete: {0} \n")).format(err)
return True
class blendSurfCommand:
@@ -302,7 +302,7 @@ def parseSel(self, selectionObject):
def Activated(self):
s = FreeCADGui.Selection.getSelection()
if s == []:
- FreeCAD.Console.PrintError("Select 2 CurveOnSurface objects.\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select 2 CurveOnSurface objects.\n"))
return
myblSu = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Blend_Surface")
diff --git a/freecad/Curves/blendSurfaceFP_new.py b/freecad/Curves/blendSurfaceFP_new.py
index e430c99..cf1c085 100644
--- a/freecad/Curves/blendSurfaceFP_new.py
+++ b/freecad/Curves/blendSurfaceFP_new.py
@@ -1,12 +1,23 @@
# -*- coding: utf-8 -*-
-__title__ = "BlendSurface"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_BlendSurf2", "BlendSurface")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Create a surface between two edges with some continuity with their support faces"
-__usage__ = """You must select 4 subshapes in the 3D View :
+__doc__ = translate(
+ "Curves_BlendSurf2",
+ "Create a surface between two edges with some continuity with their support faces",
+)
+__usage__ = translate(
+ "Curves_BlendSurf2",
+ """You must select 4 subshapes in the 3D View :
- EDGE1 on FACE1
-- EDGE2 on FACE2"""
+- EDGE2 on FACE2""",
+)
import os
import FreeCAD
@@ -24,21 +35,21 @@ class BlendSurfaceFP2:
"""Proxy of a BlendSurface FeaturePython object"""
def __init__(self, obj):
obj.addProperty("App::PropertyLinkSubList", "Sources",
- "Base", "Edges and support faces")
+ "Base", QT_TRANSLATE_NOOP("App::Property", "Edges and support faces"))
obj.addProperty("App::PropertyInteger", "Samples",
- "Base", "Number of samples to generate surface")
+ "Base", QT_TRANSLATE_NOOP("App::Property", "Number of samples to generate surface"))
obj.addProperty("App::PropertyInteger", "Continuity1",
- "Continuity", "Continuity level with face of edge 1")
+ "Continuity", QT_TRANSLATE_NOOP("App::Property", "Continuity level with face of edge 1"))
obj.addProperty("App::PropertyInteger", "Continuity2",
- "Continuity", "Continuity level with face of edge 2")
+ "Continuity", QT_TRANSLATE_NOOP("App::Property", "Continuity level with face of edge 2"))
obj.addProperty("App::PropertyEnumeration", "AutoScale",
- "Scale", "Compute scales to get regular poles, or minimal curvature")
+ "Scale", QT_TRANSLATE_NOOP("App::Property", "Compute scales to get regular poles, or minimal curvature"))
obj.addProperty("App::PropertyInteger", "ScaleSamples",
- "Scale", "Number of samples for auto scaling")
+ "Scale", QT_TRANSLATE_NOOP("App::Property", "Number of samples for auto scaling"))
obj.addProperty("App::PropertyFloatList", "Scale1",
- "Scale", "Scale values along edge 1")
+ "Scale", QT_TRANSLATE_NOOP("App::Property", "Scale values along edge 1"))
obj.addProperty("App::PropertyFloatList", "Scale2",
- "Scale", "Scale values along edge 2")
+ "Scale", QT_TRANSLATE_NOOP("App::Property", "Scale values along edge 2"))
obj.ScaleSamples = 3
obj.Samples = 20
obj.Continuity1 = 2
@@ -144,7 +155,7 @@ def Activated(self):
if sources:
self.makeFeature(sources)
else:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
def IsActive(self):
if FreeCAD.ActiveDocument:
@@ -153,10 +164,16 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_BlendSurf2", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
if FreeCAD.GuiUp:
- FreeCADGui.addCommand('Curves_BlendSurf2', BlendSurf2Command())
+ FreeCADGui.addCommand("Curves_BlendSurf2", BlendSurf2Command())
diff --git a/freecad/Curves/blend_curve.py b/freecad/Curves/blend_curve.py
index 511cbfa..9a0a273 100755
--- a/freecad/Curves/blend_curve.py
+++ b/freecad/Curves/blend_curve.py
@@ -701,7 +701,7 @@ def get_offset_curve2d(self, dist=0.1):
if len(c) == 3:
cos.append(c[0].toBSpline(c[1], c[2]))
else:
- FreeCAD.Console.PrintError("failed to extract 2D geometry")
+ FreeCAD.Console.PrintError(translate("Log", "failed to extract 2D geometry"))
if e.isPartner(self._edge):
idx = n
diff --git a/freecad/Curves/comp_spring.py b/freecad/Curves/comp_spring.py
index f5bbbcc..a42a180 100644
--- a/freecad/Curves/comp_spring.py
+++ b/freecad/Curves/comp_spring.py
@@ -95,13 +95,13 @@ class CompSpringFP:
def __init__(self, obj):
"""Add the properties"""
- obj.addProperty("App::PropertyFloat", "Length", "CompSpring", "Spring Length").Length = 10.0
- obj.addProperty("App::PropertyInteger", "Turns", "CompSpring", "Number of turns").Turns = 5
- obj.addProperty("App::PropertyFloat", "WireDiameter", "CompSpring", "Diameter of the spring wire").WireDiameter = 0.5
- obj.addProperty("App::PropertyFloat", "Diameter", "CompSpring", "Diameter of the spring").Diameter = 4.0
- obj.addProperty("App::PropertyInteger", "Flatness", "Setting", "Flatness of spring extremities from 0 to 4").Flatness = 0
- obj.addProperty("App::PropertyBool", "WireOutput", "Setting", "Output a wire shape").WireOutput = True
- obj.addProperty("App::PropertyBool", "ReverseHelix", "CompSpring", "Left hand if true").ReverseHelix = False
+ obj.addProperty("App::PropertyFloat", "Length", "CompSpring", QT_TRANSLATE_NOOP("App::Property", "Spring Length")).Length = 10.0
+ obj.addProperty("App::PropertyInteger", "Turns", "CompSpring", QT_TRANSLATE_NOOP("App::Property", "Number of turns")).Turns = 5
+ obj.addProperty("App::PropertyFloat", "WireDiameter", "CompSpring", QT_TRANSLATE_NOOP("App::Property", "Diameter of the spring wire")).WireDiameter = 0.5
+ obj.addProperty("App::PropertyFloat", "Diameter", "CompSpring", QT_TRANSLATE_NOOP("App::Property", "Diameter of the spring")).Diameter = 4.0
+ obj.addProperty("App::PropertyInteger", "Flatness", "Setting", QT_TRANSLATE_NOOP("App::Property", "Flatness of spring extremities from 0 to 4")).Flatness = 0
+ obj.addProperty("App::PropertyBool", "WireOutput", "Setting", QT_TRANSLATE_NOOP("App::Property", "Output a wire shape")).WireOutput = True
+ obj.addProperty("App::PropertyBool", "ReverseHelix", "CompSpring", QT_TRANSLATE_NOOP("App::Property", "Left hand if true")).ReverseHelix = False
obj.Proxy = self
def spring(self, obj):
@@ -185,4 +185,4 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('comp_spring', CompSpringCommand())
+FreeCADGui.addCommand("Curves_CompressionSpring", CompSpringCommand())
diff --git a/freecad/Curves/continuity_check.py b/freecad/Curves/continuity_check.py
index b6e812c..382c2fb 100644
--- a/freecad/Curves/continuity_check.py
+++ b/freecad/Curves/continuity_check.py
@@ -132,13 +132,13 @@ class ContinuityCheckerFP:
def __init__(self, obj):
"""Add the properties"""
obj.addProperty("App::PropertyLinkList", "Sources",
- "Base", "The list of seam edges to check")
+ "Base", QT_TRANSLATE_NOOP("App::Property", "The list of seam edges to check"))
obj.addProperty("App::PropertyInteger", "Samples",
- "Settings", "Number of test samples on edge")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Number of test samples on edge"))
obj.addProperty("App::PropertyInteger", "Lines",
- "Settings", "Number of test lines on each sample")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Number of test lines on each sample"))
obj.addProperty("App::PropertyFloat", "Tolerance",
- "Settings", "Continuity tolerance")
+ "Settings", QT_TRANSLATE_NOOP("App::Property", "Continuity tolerance"))
obj.Proxy = self
def execute(self, obj):
@@ -186,7 +186,7 @@ def makeFeature(self, sel=None):
def Activated(self):
sel = FreeCADGui.Selection.getSelection()
if sel == []:
- FreeCAD.Console.PrintError("Select something first !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select something first !\n"))
else:
self.makeFeature(sel)
diff --git a/freecad/Curves/curveExtend.py b/freecad/Curves/curveExtend.py
index d30bee7..ff1ff76 100644
--- a/freecad/Curves/curveExtend.py
+++ b/freecad/Curves/curveExtend.py
@@ -15,7 +15,7 @@ def getTrimmedCurve(e):
error(f"CurveExtend : Nurbs conversion error\n{exc}\n")
c = e.Curve.toBSpline()
if (not e.FirstParameter == c.FirstParameter) or (not e.LastParameter == c.LastParameter):
- FreeCAD.Console.PrintWarning("Segmenting input curve\n")
+ FreeCAD.Console.PrintWarning(translate("Log", "Segmenting input curve\n"))
c.segment(e.FirstParameter, e.LastParameter)
return c
diff --git a/freecad/Curves/curveExtendFP.py b/freecad/Curves/curveExtendFP.py
index 2a3220f..6ba3807 100644
--- a/freecad/Curves/curveExtendFP.py
+++ b/freecad/Curves/curveExtendFP.py
@@ -1,11 +1,19 @@
# -*- coding: utf-8 -*-
-__title__ = "Curve extend"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_ExtendCurve", "Curve extend")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Extend an edge by a given distance."
-__usage__ = """Select an edge in the 3D View, and activate tool.
-Edge can be extended at each end, by a given distance."""
+__doc__ = translate("Curves_ExtendCurve", "Extend an edge by a given distance.")
+__usage__ = translate(
+ "Curves_ExtendCurve",
+ """Select an edge in the 3D View, and activate tool.
+Edge can be extended at each end, by a given distance.""",
+)
import os
import FreeCAD
@@ -15,22 +23,33 @@
from . import ICONPATH
from . import curveExtend
-TOOL_ICON = os.path.join(ICONPATH, 'extendcurve.svg')
+TOOL_ICON = os.path.join(ICONPATH, "extendcurve.svg")
# debug = _utils.debug
debug = _utils.doNothing
class extend:
"""Extends the selected edge"""
- def __init__(self, obj):
- obj.addProperty("App::PropertyLinkSub", "Edge", "Base", "Input edge to extend")
- obj.addProperty("App::PropertyEnumeration", "Output", "Base", "Output shape").Output = ["SingleEdge", "Wire"]
-
- obj.addProperty("App::PropertyFloat", "LengthStart", "Beginning", "Start Extension Length").LengthStart = 10.0
- obj.addProperty("App::PropertyEnumeration", "TypeStart", "Beginning", "Start Extension type").TypeStart = ["Straight", "G2 curve"]
- obj.addProperty("App::PropertyFloat", "LengthEnd", "End", "End Extension Length").LengthEnd = 10.0
- obj.addProperty("App::PropertyEnumeration", "TypeEnd", "End", "End Extension type").TypeEnd = ["Straight", "G2 curve"]
+ def __init__(self, obj):
+ obj.addProperty("App::PropertyLinkSub", "Edge", "Base", QT_TRANSLATE_NOOP("App::Property", "Input edge to extend"))
+ obj.addProperty(
+ "App::PropertyEnumeration", "Output", "Base", QT_TRANSLATE_NOOP("App::Property", "Output shape")
+ ).Output = ["SingleEdge", "Wire"]
+
+ obj.addProperty(
+ "App::PropertyFloat", "LengthStart", "Beginning", QT_TRANSLATE_NOOP("App::Property", "Start Extension Length")
+ ).LengthStart = 10.0
+ obj.addProperty(
+ "App::PropertyEnumeration", "TypeStart", "Beginning", QT_TRANSLATE_NOOP("App::Property", "Start Extension type")
+ ).TypeStart = ["Straight", "G2 curve"]
+
+ obj.addProperty(
+ "App::PropertyFloat", "LengthEnd", "End", QT_TRANSLATE_NOOP("App::Property", "End Extension Length")
+ ).LengthEnd = 10.0
+ obj.addProperty(
+ "App::PropertyEnumeration", "TypeEnd", "End", QT_TRANSLATE_NOOP("App::Property", "End Extension type")
+ ).TypeEnd = ["Straight", "G2 curve"]
obj.TypeStart = "Straight"
obj.TypeEnd = "Straight"
@@ -96,7 +115,8 @@ def claimChildren(self):
def onDelete(self, feature, subelements):
return True
- if FreeCAD.Version()[0] == '0' and '.'.join(FreeCAD.Version()[1:3]) >= '21.2':
+ if FreeCAD.Version()[0] == "0" and ".".join(FreeCAD.Version()[1:3]) >= "21.2":
+
def dumps(self):
return {"name": self.Object.Name}
@@ -105,6 +125,7 @@ def loads(self, state):
return None
else:
+
def __getstate__(self):
return {"name": self.Object.Name}
@@ -115,10 +136,13 @@ def __setstate__(self, state):
class extendCommand:
"""Extends the selected edge"""
+
def makeExtendFeature(self, source):
if source is not []:
for o in source:
- extCurve = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "ExtendedCurve")
+ extCurve = FreeCAD.ActiveDocument.addObject(
+ "Part::FeaturePython", "ExtendedCurve"
+ )
extend(extCurve)
extCurve.Edge = o
extendVP(extCurve.ViewObject)
@@ -130,7 +154,7 @@ def Activated(self):
edges = []
sel = FreeCADGui.Selection.getSelectionEx()
if sel == []:
- FreeCAD.Console.PrintError("Select the edges to extend first !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select the edges to extend first !\n"))
for selobj in sel:
if selobj.HasSubObjects:
for i in range(len(selobj.SubObjects)):
@@ -147,9 +171,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('extend', extendCommand())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_ExtendCurve", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_ExtendCurve", extendCommand())
diff --git a/freecad/Curves/curveOnSurface.py b/freecad/Curves/curveOnSurface.py
index b7353b6..77b161c 100644
--- a/freecad/Curves/curveOnSurface.py
+++ b/freecad/Curves/curveOnSurface.py
@@ -421,7 +421,7 @@ def get_offset_curve2d(self, dist=0.1):
if len(c) == 3:
cos.append(c[0].toBSpline(c[1], c[2]))
else:
- FreeCAD.Console.PrintError("failed to extract 2D geometry")
+ FreeCAD.Console.PrintError(translate("Log", "failed to extract 2D geometry"))
if e.isPartner(self.edge):
idx = n
@@ -445,8 +445,8 @@ def get_offset_curve2d(self, dist=0.1):
def get_cross_curve(self, off, u=0):
"""returns cross-curve from offsetCurve off to COS at param u"""
if u < self.firstParameter or u > self.lastParameter:
- FreeCAD.Console.PrintError("Curve_on_surface.get_cross_curve : parameter out of range\n")
- FreeCAD.Console.PrintError("{} is not in [{},{}]\n".format(u, self.firstParameter, self.lastParameter))
+ FreeCAD.Console.PrintError(translate("Log", "Curve_on_surface.get_cross_curve : parameter out of range\n"))
+ FreeCAD.Console.PrintError(translate("Log", "{} is not in [{},{}]\n")).format(u, self.firstParameter, self.lastParameter)
if u < self.firstParameter:
u = self.firstParameter
elif u > self.lastParameter:
@@ -458,7 +458,7 @@ def get_cross_curve(self, off, u=0):
ls = Part.Geom2d.Line2dSegment(p1, p2)
sh = ls.toShape(self.face.Surface)
# sh = sh.transformGeometry(self.face.Placement.toMatrix()).Edges[0]
- FreeCAD.Console.PrintMessage(" {} - {}\n".format(self.edge.Curve, str(sh.distToShape(self.edge)[0])))
+ FreeCAD.Console.PrintMessage(translate("Log", " {} - {}\n")).format(self.edge.Curve, str(sh.distToShape(self.edge)[0]))
# d,pts,info = sh.distToShape(self.edge)
# if d > 1e-8:
# bs = sh.Edges[0].Curve.toBSpline()
diff --git a/freecad/Curves/curveOnSurfaceFP.py b/freecad/Curves/curveOnSurfaceFP.py
index 5ebddd1..401e6e5 100644
--- a/freecad/Curves/curveOnSurfaceFP.py
+++ b/freecad/Curves/curveOnSurfaceFP.py
@@ -14,27 +14,89 @@
from freecad.Curves import _utils
from freecad.Curves import ICONPATH
-TOOL_ICON = os.path.join( ICONPATH, 'curveOnSurface.svg')
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+TOOL_ICON = os.path.join(ICONPATH, "curveOnSurface.svg")
debug = _utils.debug
#debug = _utils.doNothing
class cosFP:
"""Creates a parametric curve on surface object."""
def __init__(self, obj):
- ''' Add the properties '''
- obj.addProperty("App::PropertyLinkSub", "InputEdge", "CurveOnSurface", "Input edge")
- obj.addProperty("App::PropertyLinkSub", "Face", "CurveOnSurface", "Support face")
- obj.addProperty("App::PropertyFloat", "Tolerance", "CurveOnSurface", "Tolerance").Tolerance=0.0001
- obj.addProperty("App::PropertyBool", "ReverseTangent", "Orientation", "Reverse tangent").ReverseTangent = False
- obj.addProperty("App::PropertyBool", "ReverseNormal", "Orientation", "Reverse normal").ReverseNormal = False
- obj.addProperty("App::PropertyBool", "ReverseBinormal","Orientation", "Reverse binormal").ReverseBinormal = False
- #obj.addProperty("Part::PropertyPartShape", "Shape", "Base", "Shape")
- obj.addProperty("App::PropertyEnumeration","Output", "CurveOnSurface", "Output type").Output = ["Curve only","Normal face","Binormal face"]
- obj.addProperty("App::PropertyInteger", "Samples", "CurveOnSurface", "Number of samples").Samples=100
- obj.addProperty("App::PropertyDistance", "FaceWidth", "CurveOnSurface", "Width of the output face").FaceWidth='1mm'
- obj.addProperty("App::PropertyBool", "Symmetric", "CurveOnSurface", "Face symmetric across curve").Symmetric = False
- obj.addProperty("App::PropertyBool", "Closed", "CurveOnSurface", "Close the curve").Closed = False
- obj.addProperty("App::PropertyBool", "Reverse", "CurveOnSurface", "Reverse the parametric orientation of the curve").Reverse = False
+ """Add the properties"""
+ obj.addProperty(
+ "App::PropertyLinkSub",
+ "InputEdge",
+ "CurveOnSurface",
+ QT_TRANSLATE_NOOP("App::Property", "Input edge"),
+ )
+ obj.addProperty(
+ "App::PropertyLinkSub",
+ "Face",
+ "CurveOnSurface",
+ QT_TRANSLATE_NOOP("App::Property", "Support face"),
+ )
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Tolerance",
+ "CurveOnSurface",
+ QT_TRANSLATE_NOOP("App::Property", "Tolerance"),
+ ).Tolerance = 0.0001
+ obj.addProperty(
+ "App::PropertyBool",
+ "ReverseTangent",
+ "Orientation",
+ QT_TRANSLATE_NOOP("App::Property", "Reverse tangent"),
+ ).ReverseTangent = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "ReverseNormal",
+ "Orientation",
+ QT_TRANSLATE_NOOP("App::Property", "Reverse normal"),
+ ).ReverseNormal = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "ReverseBinormal",
+ "Orientation",
+ QT_TRANSLATE_NOOP("App::Property", "Reverse binormal"),
+ ).ReverseBinormal = False
+ # obj.addProperty("Part::PropertyPartShape", "Shape", "Base", QT_TRANSLATE_NOOP("App::Property", "Shape"))
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Output",
+ "CurveOnSurface",
+ QT_TRANSLATE_NOOP("App::Property", "Output type"),
+ ).Output = ["Curve only", "Normal face", "Binormal face"]
+ obj.addProperty(
+ "App::PropertyInteger",
+ "Samples",
+ "CurveOnSurface",
+ QT_TRANSLATE_NOOP("App::Property", "Number of samples"),
+ ).Samples = 100
+ obj.addProperty(
+ "App::PropertyDistance",
+ "FaceWidth",
+ "CurveOnSurface",
+ QT_TRANSLATE_NOOP("App::Property", "Width of the output face"),
+ ).FaceWidth = "1mm"
+ obj.addProperty(
+ "App::PropertyBool",
+ "Symmetric",
+ "CurveOnSurface",
+ QT_TRANSLATE_NOOP("App::Property", "Face symmetric across curve"),
+ ).Symmetric = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "Closed",
+ "CurveOnSurface",
+ QT_TRANSLATE_NOOP("App::Property", "Close the curve"),
+ ).Closed = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "Reverse",
+ "CurveOnSurface",
+ QT_TRANSLATE_NOOP("App::Property", "Reverse the parametric orientation of the curve"),
+ ).Reverse = False
obj.Output = "Curve only"
obj.Proxy = self
@@ -104,7 +166,7 @@ def onDelete(self, feature, subelements):
try:
self.Object.InputEdge[0].ViewObject.Visibility=True
except Exception as err:
- FreeCAD.Console.PrintError("Error in onDelete: {0} \n".format(err))
+ FreeCAD.Console.PrintError(translate("Log", "Error in onDelete: {0} \n")).format(err)
return(True)
@@ -116,7 +178,7 @@ def Activated(self):
face = None
sel = FreeCADGui.Selection.getSelectionEx('',0)
if sel == []:
- FreeCAD.Console.PrintError("Select an edge and its supporting face \n")
+ FreeCAD.Console.PrintError(translate("Log", "Select an edge and its supporting face \n"))
for selobj in sel:
for path in selobj.SubElementNames if selobj.SubElementNames else ['']:
shape = selobj.Object.getSubObject(path)
@@ -140,12 +202,18 @@ def Activated(self):
cos.ViewObject.LineColor = (1.0,0.67,0.0)
cos.ViewObject.LineWidth = 3.0
else:
- FreeCAD.Console.PrintError("Select an edge and its supporting face \n")
-
+ FreeCAD.Console.PrintError(
+ translate("Log", "Select an edge and its supporting face \n")
+ )
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': 'CurveOnSurface',
- 'ToolTip': 'Create a curve on surface object'}
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": QT_TRANSLATE_NOOP("Curves_CurveOnSurface", "CurveOnSurface"),
+ "ToolTip": QT_TRANSLATE_NOOP(
+ "Curves_CurveOnSurface", "Create a curve on surface object"
+ ),
+ }
+
-FreeCADGui.addCommand('cos', cosCommand())
+FreeCADGui.addCommand("Curves_CurveOnSurface", cosCommand())
diff --git a/freecad/Curves/curve_to_script.py b/freecad/Curves/curve_to_script.py
index 7cd1286..1b6004e 100644
--- a/freecad/Curves/curve_to_script.py
+++ b/freecad/Curves/curve_to_script.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
__title__ = "BSpline to script"
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Creates a python script to build the selected BSpline or Bezier geometries."
-__usage__ = """Select some Bezier or BSpline curves or surfaces in the 3D View and activate the tool.
-The selected curves or surfaces will be re-created with commands in the python console."""
+__doc__ = translate(
+ "Curves_BsplineToConsole",
+ "Creates a python script to build the selected BSpline or Bezier geometries.",
+)
+__usage__ = translate(
+ "Curves_BsplineToConsole",
+ """Select some Bezier or BSpline curves or surfaces in the 3D View and activate the tool.
+The selected curves or surfaces will be re-created with commands in the python console.""",
+)
import os
import FreeCAD
@@ -84,10 +95,16 @@ def nurbs_to_script(i, c):
class NurbsToConsole:
"Brings the selected BSpline curves to the python console"
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': "BSpline to Console",
- 'Accel': "",
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": QT_TRANSLATE_NOOP("Curves_BsplineToConsole", "BSpline to Console"),
+ "Accel": "",
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_BsplineToConsole", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
def Activated(self):
s = FreeCADGui.Selection.getSelectionEx()
@@ -103,7 +120,7 @@ def Activated(self):
nurbs_to_script(i, geom)
i += 1
if i == 0:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
def IsActive(self):
if FreeCAD.ActiveDocument:
@@ -112,4 +129,4 @@ def IsActive(self):
return False
-FreeCADGui.addCommand('Curves_bspline_to_console', NurbsToConsole())
+FreeCADGui.addCommand("Curves_BsplineToConsole", NurbsToConsole())
diff --git a/freecad/Curves/curves_to_surface.py b/freecad/Curves/curves_to_surface.py
index 6597344..8aa736a 100644
--- a/freecad/Curves/curves_to_surface.py
+++ b/freecad/Curves/curves_to_surface.py
@@ -204,7 +204,7 @@ def orient_surface(surf1, surf2, tol=1e-7):
"""
def match(p1, p2):
return p1.distanceToPoint(p2) < tol
- FreeCAD.Console.PrintMessage("---\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "---\n"))
# surface params O, X, Y
params = ((0.0, 0.0), (1.0, 0.0), (0.0, 1.0))
pts1 = [surf1.value(u, v) for u, v in params]
@@ -213,12 +213,12 @@ def match(p1, p2):
if match(pts1[0], pts2[0]):
if match(pts1[1], pts2[2]):
surf2.exchangeUV()
- FreeCAD.Console.PrintMessage("exchange UV\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "exchange UV\n"))
return surf2
# O match X
elif match(pts1[0], pts2[1]):
# reverse U
- FreeCAD.Console.PrintMessage("reverse U\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "reverse U\n"))
c = surf2.vIso(0.0)
c.reverse()
uknots = c.getKnots()
@@ -239,13 +239,13 @@ def match(p1, p2):
# Y match O
if match(pts1[2], pts2[0]):
nbs.exchangeUV()
- FreeCAD.Console.PrintMessage("exchange UV\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "exchange UV\n"))
surf2 = nbs
return nbs
# O match Y
elif match(pts1[0], pts2[1]):
# reverse V
- FreeCAD.Console.PrintMessage("reverse V\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "reverse V\n"))
c = surf2.uIso(0.0)
c.reverse()
vknots = c.getKnots()
@@ -266,7 +266,7 @@ def match(p1, p2):
# X match O
if match(pts1[2], pts2[0]):
nbs.exchangeUV()
- FreeCAD.Console.PrintMessage("exchange UV\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "exchange UV\n"))
surf2 = nbs
return nbs
else:
@@ -689,10 +689,10 @@ def sort_curves(self, s):
for i in intersect:
print(i)
if abs(intersect[0][0]) > self.tol3d:
- FreeCAD.Console.PrintMessage("Inserting flat profile at 0.0\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Inserting flat profile at 0.0\n"))
intersect.insert(0, (0.0, s.vIso(0.0)))
if abs(intersect[-1][0] - 1.0) > self.tol3d:
- FreeCAD.Console.PrintMessage("Inserting flat profile at 1.0\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Inserting flat profile at 1.0\n"))
intersect.append((1.0, s.vIso(1.0)))
params = [tup[0] for tup in intersect]
curves = [tup[1] for tup in intersect]
diff --git a/freecad/Curves/gordon.py b/freecad/Curves/gordon.py
index 2703083..3e8a132 100644
--- a/freecad/Curves/gordon.py
+++ b/freecad/Curves/gordon.py
@@ -54,15 +54,15 @@ def debug(o):
u = o.uIso(o.getUKnot(1))
debug(u)
except Part.OCCError:
- FreeCAD.Console.PrintError("Failed to compute uIso curve\n")
+ FreeCAD.Console.PrintError(translate("Log", "Failed to compute uIso curve\n"))
try:
v = o.vIso(o.getVKnot(1))
debug(v)
except Part.OCCError:
- FreeCAD.Console.PrintError("Failed to compute vIso curve\n")
+ FreeCAD.Console.PrintError(translate("Log", "Failed to compute vIso curve\n"))
warn("************\n")
else:
- FreeCAD.Console.PrintMessage("{}\n".format(str(o)))
+ FreeCAD.Console.PrintMessage(translate("Log", "{}\n")).format(str(o))
def find(val, array, tol=1e-5):
diff --git a/freecad/Curves/gordonFP.py b/freecad/Curves/gordonFP.py
index 6f18f0a..f85466c 100644
--- a/freecad/Curves/gordonFP.py
+++ b/freecad/Curves/gordonFP.py
@@ -24,25 +24,25 @@ def debug(o):
if not DEBUG:
return
if isinstance(o, Part.BSplineCurve):
- FreeCAD.Console.PrintWarning("\nBSplineCurve\n")
+ FreeCAD.Console.PrintWarning(translate("Log", "\nBSplineCurve\n"))
FreeCAD.Console.PrintWarning("Degree: %d\n" % (o.Degree))
FreeCAD.Console.PrintWarning("NbPoles: %d\n" % (o.NbPoles))
FreeCAD.Console.PrintWarning("Knots: %d (%0.2f - %0.2f)\n" % (o.NbKnots, o.FirstParameter, o.LastParameter))
FreeCAD.Console.PrintWarning("Mults: %s\n" % (o.getMultiplicities()))
FreeCAD.Console.PrintWarning("Periodic: %s\n" % (o.isPeriodic()))
elif isinstance(o, Part.BSplineSurface):
- FreeCAD.Console.PrintWarning("\nBSplineSurface\n************\n")
+ FreeCAD.Console.PrintWarning(translate("Log", "\nBSplineSurface\n************\n"))
try:
u = o.uIso(o.UKnotSequence[0])
debug(u)
except Part.OCCError:
- FreeCAD.Console.PrintError("Failed to compute uIso curve\n")
+ FreeCAD.Console.PrintError(translate("Log", "Failed to compute uIso curve\n"))
try:
v = o.vIso(o.VKnotSequence[0])
debug(v)
except Part.OCCError:
- FreeCAD.Console.PrintError("Failed to compute vIso curve\n")
- FreeCAD.Console.PrintWarning("************\n")
+ FreeCAD.Console.PrintError(translate("Log", "Failed to compute vIso curve\n"))
+ FreeCAD.Console.PrintWarning(translate("Log", "************\n"))
else:
FreeCAD.Console.PrintMessage("%s\n" % o)
@@ -52,14 +52,14 @@ class gordonFP:
def __init__(self, obj):
"""Add the properties"""
- obj.addProperty("App::PropertyLinkList", "Sources", "Gordon", "Curve network")
- obj.addProperty("App::PropertyFloat", "Tol3D", "Gordon", "3D tolerance").Tol3D = 1e-2
- obj.addProperty("App::PropertyFloat", "Tol2D", "Gordon", "Parametric tolerance").Tol2D = 1e-5
- obj.addProperty("App::PropertyInteger", "MaxCtrlPts", "Gordon", "Max Number of control points").MaxCtrlPts = 80
- obj.addProperty("App::PropertyEnumeration", "Output", "Base", "Output type").Output = ["Surface", "Wireframe"]
- obj.addProperty("App::PropertyInteger", "SamplesU", "Wireframe", "Number of samples in U direction").SamplesU = 16
- obj.addProperty("App::PropertyInteger", "SamplesV", "Wireframe", "Number of samples in V direction").SamplesV = 16
- obj.addProperty("App::PropertyBool", "FlipNormal", "Surface", "Flip surface normal").FlipNormal = False
+ obj.addProperty("App::PropertyLinkList", "Sources", "Gordon", QT_TRANSLATE_NOOP("App::Property", "Curve network"))
+ obj.addProperty("App::PropertyFloat", "Tol3D", "Gordon", QT_TRANSLATE_NOOP("App::Property", "3D tolerance")).Tol3D = 1e-2
+ obj.addProperty("App::PropertyFloat", "Tol2D", "Gordon", QT_TRANSLATE_NOOP("App::Property", "Parametric tolerance")).Tol2D = 1e-5
+ obj.addProperty("App::PropertyInteger", "MaxCtrlPts", "Gordon", QT_TRANSLATE_NOOP("App::Property", "Max Number of control points")).MaxCtrlPts = 80
+ obj.addProperty("App::PropertyEnumeration", "Output", "Base", QT_TRANSLATE_NOOP("App::Property", "Output type")).Output = ["Surface", "Wireframe"]
+ obj.addProperty("App::PropertyInteger", "SamplesU", "Wireframe", QT_TRANSLATE_NOOP("App::Property", "Number of samples in U direction")).SamplesU = 16
+ obj.addProperty("App::PropertyInteger", "SamplesV", "Wireframe", QT_TRANSLATE_NOOP("App::Property", "Number of samples in V direction")).SamplesV = 16
+ obj.addProperty("App::PropertyBool", "FlipNormal", "Surface", QT_TRANSLATE_NOOP("App::Property", "Flip surface normal")).FlipNormal = False
obj.Output = "Surface"
obj.setEditorMode("Tol2D", 2)
obj.setEditorMode("SamplesU", 2)
@@ -206,7 +206,7 @@ def makeGordonFeature(self, source):
def Activated(self):
sel = FreeCADGui.Selection.getSelection()
if sel == []:
- FreeCAD.Console.PrintError("Select a curve network !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select a curve network !\n"))
else:
self.makeGordonFeature(sel)
@@ -223,4 +223,4 @@ def GetResources(self):
'ToolTip': 'Creates a surface that skins a network of curves'}
-FreeCADGui.addCommand('gordon', gordonCommand())
+FreeCADGui.addCommand("Curves_GordonSurface", gordonCommand())
diff --git a/freecad/Curves/gordon_profile_FP.py b/freecad/Curves/gordon_profile_FP.py
index b7f0699..b8efd35 100644
--- a/freecad/Curves/gordon_profile_FP.py
+++ b/freecad/Curves/gordon_profile_FP.py
@@ -1,10 +1,17 @@
# -*- coding: utf-8 -*-
-__title__ = "Freehand BSpline"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_EditableSpline", "Freehand BSpline")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Creates an freehand BSpline curve"
-__usage__ = """*** Interpolation curve control keys :
+__doc__ = translate("Curves_EditableSpline", "Creates an freehand BSpline curve")
+__usage__ = translate(
+ "Curves_EditableSpline",
+ """*** Interpolation curve control keys :
a - Select all / Deselect
i - Insert point in selected segments
@@ -13,7 +20,8 @@
s - Snap points on shape / Unsnap
l - Set/unset a linear interpolation
x,y,z - Axis constraints during grab
- q - Apply changes and quit editing"""
+ q - Apply changes and quit editing""",
+)
import os
import FreeCAD
@@ -47,15 +55,15 @@ class GordonProfileFP:
"""Creates an editable interpolation curve"""
def __init__(self, obj, s, d, t):
"""Add the properties"""
- obj.addProperty("App::PropertyLinkSubList", "Support", "Profile", "Constraint shapes").Support = s
- obj.addProperty("App::PropertyFloatConstraint", "Parametrization", "Profile", "Parametrization factor")
- obj.addProperty("App::PropertyFloat", "Tolerance", "Profile", "Tolerance").Tolerance = 1e-7
- obj.addProperty("App::PropertyBool", "Periodic", "Profile", "Periodic curve").Periodic = False
- obj.addProperty("App::PropertyVectorList", "Data", "Profile", "Data list").Data = d
- obj.addProperty("App::PropertyVectorList", "Tangents", "Profile", "Tangents list")
- obj.addProperty("App::PropertyBoolList", "Flags", "Profile", "Tangent flags")
- obj.addProperty("App::PropertyIntegerList", "DataType", "Profile", "Types of interpolated points").DataType = t
- obj.addProperty("App::PropertyBoolList", "LinearSegments", "Profile", "Linear segment flags")
+ obj.addProperty("App::PropertyLinkSubList", "Support", "Profile", QT_TRANSLATE_NOOP("App::Property", "Constraint shapes")).Support = s
+ obj.addProperty("App::PropertyFloatConstraint", "Parametrization", "Profile", QT_TRANSLATE_NOOP("App::Property", "Parametrization factor"))
+ obj.addProperty("App::PropertyFloat", "Tolerance", "Profile", QT_TRANSLATE_NOOP("App::Property", "Tolerance")).Tolerance = 1e-7
+ obj.addProperty("App::PropertyBool", "Periodic", "Profile", QT_TRANSLATE_NOOP("App::Property", "Periodic curve")).Periodic = False
+ obj.addProperty("App::PropertyVectorList", "Data", "Profile", QT_TRANSLATE_NOOP("App::Property", "Data list")).Data = d
+ obj.addProperty("App::PropertyVectorList", "Tangents", "Profile", QT_TRANSLATE_NOOP("App::Property", "Tangents list"))
+ obj.addProperty("App::PropertyBoolList", "Flags", "Profile", QT_TRANSLATE_NOOP("App::Property", "Tangent flags"))
+ obj.addProperty("App::PropertyIntegerList", "DataType", "Profile", QT_TRANSLATE_NOOP("App::Property", "Types of interpolated points")).DataType = t
+ obj.addProperty("App::PropertyBoolList", "LinearSegments", "Profile", QT_TRANSLATE_NOOP("App::Property", "Linear segment flags"))
obj.Parametrization = (1.0, 0.0, 1.0, 0.05)
obj.Proxy = self
@@ -84,7 +92,7 @@ def get_points(self, fp, stretch=True):
touched = False
shapes = self.get_shapes(fp)
if not len(fp.Data) == len(fp.DataType):
- FreeCAD.Console.PrintError("Gordon Profile : Data and DataType mismatch\n")
+ FreeCAD.Console.PrintError(translate("Log", "Gordon Profile : Data and DataType mismatch\n"))
return(None)
pts = list()
shape_idx = 0
@@ -136,11 +144,11 @@ def execute(self, obj):
except AttributeError:
pass
except:
- FreeCAD.Console.PrintWarning("execute is disabled during editing\n")
+ FreeCAD.Console.PrintWarning(translate("Log", "execute is disabled during editing\n"))
pts = self.get_points(obj)
if pts:
if len(pts) < 2:
- FreeCAD.Console.PrintError("{} : Not enough points\n".format(obj.Label))
+ FreeCAD.Console.PrintError(translate("Log", "{} : Not enough points\n")).format(obj.Label)
return False
else:
obj.Data = pts
@@ -352,9 +360,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('gordon_profile', GordonProfileCommand())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_EditableSpline", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_EditableSpline", GordonProfileCommand())
diff --git a/freecad/Curves/graphics.py b/freecad/Curves/graphics.py
index 8f3e212..3737aef 100644
--- a/freecad/Curves/graphics.py
+++ b/freecad/Curves/graphics.py
@@ -443,7 +443,7 @@ def dragCB(self, attr, event_callback, force=False):
elif event.getState() == coin.SoMouseButtonEvent.DOWN:
s = "down"
# import FreeCAD
- # FreeCAD.Console.PrintMessage("{} {}\n".format(b,s))
+ # FreeCAD.Console.PrintMessage(translate("Log", "{} {}\n")).format(b,s)
if ((type(event) == coin.SoMouseButtonEvent and
event.getState() == coin.SoMouseButtonEvent.UP
and event.getButton() == coin.SoMouseButtonEvent.BUTTON1) or
diff --git a/freecad/Curves/grid.py b/freecad/Curves/grid.py
index 0249819..30bf26e 100644
--- a/freecad/Curves/grid.py
+++ b/freecad/Curves/grid.py
@@ -303,7 +303,7 @@ def buildGrid(self):
class gridObject:
def __init__(self, obj):
obj.Proxy = self
- obj.addProperty("App::PropertyPlacement", "Placement", "Base", "Placement")
+ obj.addProperty("App::PropertyPlacement", "Placement", "Base", QT_TRANSLATE_NOOP("App::Property", "Placement"))
def execute(self, obj):
return()
def onChanged(self, fp, prop):
@@ -317,15 +317,15 @@ def onChanged(self, fp, prop):
class gridVP:
def __init__(self, obj ):
- obj.addProperty("App::PropertyDistance", "Total", "Size", "Size of a grid quadrant").Total = '100mm'
- obj.addProperty("App::PropertyDistance", "Subdivision", "Size", "Size of subdivisions").Subdivision = '10mm'
- obj.addProperty("App::PropertyFloat", "XY_Attenuation", "View", "XY plane attenuation").XY_Attenuation = 2.0
- obj.addProperty("App::PropertyFloat", "XZ_Attenuation", "View", "XZ plane attenuation").XZ_Attenuation = 50.0
- obj.addProperty("App::PropertyFloat", "YZ_Attenuation", "View", "YZ plane attenuation").YZ_Attenuation = 50.0
- obj.addProperty("App::PropertyFloat", "XY_Visibility", "View", "XY plane max visibility").XY_Visibility = 1.0
- obj.addProperty("App::PropertyFloat", "XZ_Visibility", "View", "XZ plane max visibility").XZ_Visibility = 0.5
- obj.addProperty("App::PropertyFloat", "YZ_Visibility", "View", "YZ plane max visibility").YZ_Visibility = 0.5
- obj.addProperty("App::PropertyColor", "GridColor", "Color", "Grid Color").GridColor = (0.5,0.5,0.5)
+ obj.addProperty("App::PropertyDistance", "Total", "Size", QT_TRANSLATE_NOOP("App::Property", "Size of a grid quadrant")).Total = '100mm'
+ obj.addProperty("App::PropertyDistance", "Subdivision", "Size", QT_TRANSLATE_NOOP("App::Property", "Size of subdivisions")).Subdivision = '10mm'
+ obj.addProperty("App::PropertyFloat", "XY_Attenuation", "View", QT_TRANSLATE_NOOP("App::Property", "XY plane attenuation")).XY_Attenuation = 2.0
+ obj.addProperty("App::PropertyFloat", "XZ_Attenuation", "View", QT_TRANSLATE_NOOP("App::Property", "XZ plane attenuation")).XZ_Attenuation = 50.0
+ obj.addProperty("App::PropertyFloat", "YZ_Attenuation", "View", QT_TRANSLATE_NOOP("App::Property", "YZ plane attenuation")).YZ_Attenuation = 50.0
+ obj.addProperty("App::PropertyFloat", "XY_Visibility", "View", QT_TRANSLATE_NOOP("App::Property", "XY plane max visibility")).XY_Visibility = 1.0
+ obj.addProperty("App::PropertyFloat", "XZ_Visibility", "View", QT_TRANSLATE_NOOP("App::Property", "XZ plane max visibility")).XZ_Visibility = 0.5
+ obj.addProperty("App::PropertyFloat", "YZ_Visibility", "View", QT_TRANSLATE_NOOP("App::Property", "YZ plane max visibility")).YZ_Visibility = 0.5
+ obj.addProperty("App::PropertyColor", "GridColor", "Color", QT_TRANSLATE_NOOP("App::Property", "Grid Color")).GridColor = (0.5,0.5,0.5)
obj.Proxy = self
def attach(self, obj):
diff --git a/freecad/Curves/init_gui.py b/freecad/Curves/init_gui.py
index 8d2686f..b657481 100644
--- a/freecad/Curves/init_gui.py
+++ b/freecad/Curves/init_gui.py
@@ -1,13 +1,21 @@
import os
+
import FreeCADGui as Gui
import FreeCAD as App
-from . import ICONPATH
+from . import ICONPATH, TRANSLATIONPATH
+
+translate = App.Qt.translate
+QT_TRANSLATE_NOOP = App.Qt.QT_TRANSLATE_NOOP
+
+Gui.addLanguagePath(TRANSLATIONPATH)
+Gui.updateLocale()
class CurvesWorkbench(Gui.Workbench):
"""FreeCAD workbench that offers a collection of tools mainly related to Nurbs curves and surfaces."""
- MenuText = "Curves"
- ToolTip = "a workbench dedicated to curves and surfaces"
+
+ MenuText = translate("Workbench", "Curves")
+ ToolTip = translate("Workbench", "a workbench dedicated to curves and surfaces")
Icon = os.path.join(ICONPATH, "blendSurf.svg")
toolbox = []
@@ -69,25 +77,60 @@ def Initialize(self):
# from . import HelicalSweepFP
# import sectionSketch
- curvelist = ["Curves_line", "gordon_profile", "mixed_curve", "extend", "join", "split",
- "Discretize", "Approximate", "Interpolate", "ParametricBlendCurve",
- "ParametricComb", "cos"]
-
- surflist = ["ZebraTool", "Trim", "IsoCurve", "SoS", "sw2r", "profileSupportCmd",
- "profile", "pipeshell", "gordon", "segment_surface", "comp_spring",
- "ReflectLines", "MultiLoft", "Curves_BlendSurf2", "Curves_BlendSolid",
- "Curves_FlattenFace", "Curves_RotationSweep", 'Curves_SurfaceAnalysis',
- 'Curves_DraftAnalysis', "Curve_TruncateExtendCmd"]
+ curvelist = [
+ "Curves_Line",
+ "Curves_EditableSpline",
+ "Curves_MixedCurve",
+ "Curves_ExtendCurve",
+ "Curves_JoinCurve",
+ "Curves_SplitCurve",
+ "Curves_Discretize",
+ "Curves_Approximate",
+ "Curves_Interpolate",
+ "Curves_ParametricBlendCurve",
+ "Curves_ParametricComb",
+ "Curves_CurveOnSurface",
+ ]
+
+ surflist = [
+ "Curves_ZebraTool",
+ "Curves_Trim",
+ "Curves_IsoCurve",
+ "Curves_SketchOnSurface",
+ "Curves_SweepToRails",
+ "Curves_ProfileSupportPlane",
+ "Curves_PipeshellProfile",
+ "Curves_Pipeshell",
+ "Curves_GordonSurface",
+ "Curves_SegmentSurface",
+ "Curves_CompressionSpring",
+ "Curves_ReflectLines",
+ "Curves_MultiLoft",
+ "Curves_BlendSurf2",
+ "Curves_BlendSolid",
+ "Curves_FlattenFace",
+ "Curves_RotationSweep",
+ "Curves_SurfaceAnalysis",
+ "Curves_DraftAnalysis",
+ "Curves_TruncateExtendCmd",
+ ]
# , "Curves_ProfileSupport", "Curves_Sweep2Rails"]
- misclist = ["GeomInfo", "extract", "solid", "pasteSVG", "to_console", "Curves_adjacent_faces",
- "Curves_bspline_to_console"]
-
- self.appendToolbar("Curves", curvelist)
- self.appendToolbar("Surfaces", surflist)
- self.appendToolbar("Misc.", misclist)
- self.appendMenu("Curves", curvelist)
- self.appendMenu("Surfaces", surflist)
- self.appendMenu("Misc.", misclist)
+ misclist = [
+ "Curves_GeometryInfo",
+ "Curves_ExtractSubshape",
+ "Curves_ParametricSolid",
+ "Curves_PasteSVG",
+ "Curves_ObjectsToConsole",
+ "Curves_AdjacentFaces",
+ "Curves_BsplineToConsole",
+ ]
+
+ self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Curves"), curvelist)
+ self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Surfaces"), surflist)
+ self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Misc."), misclist)
+ self.appendMenu(QT_TRANSLATE_NOOP("Workbench", "Curves"), curvelist)
+ self.appendMenu(QT_TRANSLATE_NOOP("Workbench", "Surfaces"), surflist)
+ self.appendMenu(QT_TRANSLATE_NOOP("Workbench", "Misc."), misclist)
def Activated(self):
"""This function is executed when the workbench is activated"""
@@ -136,11 +179,14 @@ def ContextMenu(self, recipient):
"""This is executed whenever the user right-clicks on screen.
recipient" will be either 'view' or 'tree'"""
if recipient == "View":
- contextlist = ["Curves_adjacent_faces", "Curves_bspline_to_console"] # list of commands
- self.appendContextMenu("Curves", contextlist)
+ contextlist = [
+ "Curves_AdjacentFaces",
+ "Curves_BsplineToConsole",
+ ] # list of commands
+ self.appendContextMenu(QT_TRANSLATE_NOOP("Workbench", "Curves"), contextlist)
elif recipient == "Tree":
contextlist = [] # list of commands
- self.appendContextMenu("Curves", contextlist)
+ self.appendContextMenu(QT_TRANSLATE_NOOP("Workbench", "Curves"), contextlist)
def GetClassName(self):
"""This function is mandatory if this is a full python workbench"""
diff --git a/freecad/Curves/interpolate.py b/freecad/Curves/interpolate.py
index c9e8f7f..c432c43 100644
--- a/freecad/Curves/interpolate.py
+++ b/freecad/Curves/interpolate.py
@@ -1,12 +1,16 @@
# -*- coding: utf-8 -*-
-__title__ = "Interpolate"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_Interpolate", "Interpolate")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Interpolate a set of points."
+__doc__ = QT_TRANSLATE_NOOP("Curves_Interpolate", "Interpolate a set of points.")
import os
-import FreeCAD
import FreeCADGui
import Part
from freecad.Curves import _utils
@@ -57,21 +61,96 @@ class Interpolate:
def __init__(self, obj, source):
''' Add the properties '''
debug("\nInterpolate class Init\n")
- obj.addProperty("App::PropertyLink", "Source", "General", "Source object that provides points to interpolate")
- obj.addProperty("App::PropertyLinkSubList", "PointList", "General", "Point list to interpolate")
- obj.addProperty("App::PropertyBool", "Periodic", "General", "Set the curve closed").Periodic = False
- obj.addProperty("App::PropertyFloat", "Tolerance", "General", "Interpolation tolerance").Tolerance = 1e-7
- obj.addProperty("App::PropertyBool", "CustomTangents", "General", "User specified tangents").CustomTangents = False
- obj.addProperty("App::PropertyBool", "DetectAligned", "General", "interpolate 3 aligned points with a line").DetectAligned = False
- obj.addProperty("App::PropertyBool", "Polygonal", "General", "interpolate with a degree 1 polygonal curve").Polygonal = False
- obj.addProperty("App::PropertyBool", "WireOutput", "Parameters", "outputs a wire or a single edge").WireOutput = False
- obj.addProperty("App::PropertyFloatList", "Parameters", "Parameters", "Parameters of interpolated points")
- obj.addProperty("App::PropertyEnumeration", "Parametrization","Parameters", "Parametrization type")
- obj.addProperty("App::PropertyVectorList", "Tangents", "General", "Tangents at interpolated points")
- obj.addProperty("App::PropertyBoolList", "TangentFlags", "General", "Activation flag of tangents")
- obj.addProperty("App::PropertyLinkSub", "FaceSupport", "Spiral", "Face support of the spiral")
- obj.addProperty("App::PropertyInteger", "UTurns", "Spiral", "Nb of turns between 2 points, in U direction").UTurns = 0
- obj.addProperty("App::PropertyInteger", "VTurns", "Spiral", "Nb of turns between 2 points, in V direction").VTurns = 0
+ obj.addProperty(
+ "App::PropertyLink",
+ "Source",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Source object that provides points to interpolate"),
+ )
+ obj.addProperty(
+ "App::PropertyLinkSubList",
+ "PointList",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Point list to interpolate"),
+ )
+ obj.addProperty(
+ "App::PropertyBool",
+ "Periodic",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Set the curve closed"),
+ ).Periodic = False
+ obj.addProperty(
+ "App::PropertyFloat",
+ "Tolerance",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Interpolation tolerance"),
+ ).Tolerance = 1e-7
+ obj.addProperty(
+ "App::PropertyBool",
+ "CustomTangents",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "User specified tangents"),
+ ).CustomTangents = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "DetectAligned",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "interpolate 3 aligned points with a line"),
+ ).DetectAligned = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "Polygonal",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "interpolate with a degree 1 polygonal curve"),
+ ).Polygonal = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "WireOutput",
+ "Parameters",
+ QT_TRANSLATE_NOOP("App::Property", "outputs a wire or a single edge"),
+ ).WireOutput = False
+ obj.addProperty(
+ "App::PropertyFloatList",
+ "Parameters",
+ "Parameters",
+ QT_TRANSLATE_NOOP("App::Property", "Parameters of interpolated points"),
+ )
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Parametrization",
+ "Parameters",
+ QT_TRANSLATE_NOOP("App::Property", "Parametrization type"),
+ )
+ obj.addProperty(
+ "App::PropertyVectorList",
+ "Tangents",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Tangents at interpolated points"),
+ )
+ obj.addProperty(
+ "App::PropertyBoolList",
+ "TangentFlags",
+ "General",
+ QT_TRANSLATE_NOOP("App::Property", "Activation flag of tangents"),
+ )
+ obj.addProperty(
+ "App::PropertyLinkSub",
+ "FaceSupport",
+ "Spiral",
+ QT_TRANSLATE_NOOP("App::Property", "Face support of the spiral"),
+ )
+ obj.addProperty(
+ "App::PropertyInteger",
+ "UTurns",
+ "Spiral",
+ QT_TRANSLATE_NOOP("App::Property", "Nb of turns between 2 points, in U direction"),
+ ).UTurns = 0
+ obj.addProperty(
+ "App::PropertyInteger",
+ "VTurns",
+ "Spiral",
+ QT_TRANSLATE_NOOP("App::Property", "Nb of turns between 2 points, in V direction"),
+ ).VTurns = 0
obj.Parametrization = ["ChordLength", "Centripetal", "Uniform", "Custom"]
obj.Proxy = self
if isinstance(source, (list, tuple)):
@@ -320,7 +399,7 @@ def __setstate__(self, state):
# try:
# self.Object.PointObject.ViewObject.Visibility=True
# except Exception as err:
- # FreeCAD.Console.PrintError("Error in onDelete: {0} \n".format(err))
+ # FreeCAD.Console.PrintError(translate("Log", "Error in onDelete: {0} \n")).format(err)
# return True
@@ -329,17 +408,21 @@ def parseSel(self, selectionObject):
verts = list()
for obj in selectionObject:
if obj.HasSubObjects:
- FreeCAD.Console.PrintMessage("object has subobjects {}\n".format(obj.SubElementNames))
+ FreeCAD.Console.PrintMessage(translate("Log", "object has subobjects {}\n")).format(
+ obj.SubElementNames
+ )
for n in obj.SubElementNames:
if 'Vertex' in n:
verts.append((obj.Object, [n]))
else:
- # FreeCAD.Console.PrintMessage("object has no subobjects\n")
+ # FreeCAD.Console.PrintMessage(translate("Log", "object has no subobjects\n"))
verts = obj.Object
if verts:
return verts
else:
- FreeCAD.Console.PrintMessage("\nPlease select an object that has at least 2 vertexes\n")
+ FreeCAD.Console.PrintMessage(
+ translate("Log", "\nPlease select an object that has at least 2 vertexes\n")
+ )
return None
def Activated(self):
@@ -364,4 +447,4 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('Interpolate', interpolate())
+FreeCADGui.addCommand("Curves_Interpolate", interpolate())
diff --git a/freecad/Curves/isocurves.py b/freecad/Curves/isocurves.py
index af9813c..1f46b2e 100644
--- a/freecad/Curves/isocurves.py
+++ b/freecad/Curves/isocurves.py
@@ -53,16 +53,16 @@ def __init__(self, face, direc='U', param=0):
self.direction = 'U'
self.parameter = 0
if not isinstance(face, Part.Face):
- FreeCAD.Console.PrintMessage("Error. Not a face")
+ FreeCAD.Console.PrintMessage(translate("Log", "Error. Not a face"))
else:
self.bounds = face.ParameterRange
self.face = face
if direc not in 'UV':
- FreeCAD.Console.PrintMessage("Direction error")
+ FreeCAD.Console.PrintMessage(translate("Log", "Direction error"))
else:
self.direction = direc
if not isinstance(param, (float, int)):
- FreeCAD.Console.PrintMessage("Parameter error")
+ FreeCAD.Console.PrintMessage(translate("Log", "Parameter error"))
else:
self.parameter = param
@@ -105,7 +105,7 @@ def toShape(self):
sortedPts = sorted(pts, key=lambda v: v.y)
prange = [l2d.parameter(sortedPts[0]), l2d.parameter(sortedPts[-1])]
else:
- FreeCAD.Console.PrintMessage("No intersection points\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "No intersection points\n"))
elif self.direction == 'V':
self.curve = self.face.Surface.vIso(self.parameter)
v1 = Base.Vector2d(self.bounds[0] - ext, self.parameter)
@@ -116,14 +116,14 @@ def toShape(self):
sortedPts = sorted(pts, key=lambda v: v.x)
prange = [l2d.parameter(sortedPts[0]), l2d.parameter(sortedPts[-1])]
else:
- FreeCAD.Console.PrintMessage("No intersection points\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "No intersection points\n"))
e = None
if (prange[1] - prange[0]) > 1e-9:
e = l2d.toShape(self.face, prange[0], prange[1])
if isinstance(e, Part.Edge):
return e
# else:
- # FreeCAD.Console.PrintMessage("Failed to create isoCurve shape\n")
+ # FreeCAD.Console.PrintMessage(translate("Log", "Failed to create isoCurve shape\n"))
# return None
@@ -137,7 +137,7 @@ def __init__(self, face, numu=0, numv=0):
self.uiso = []
self.viso = []
if not isinstance(face, Part.Face):
- FreeCAD.Console.PrintMessage("Error. Not a face")
+ FreeCAD.Console.PrintMessage(translate("Log", "Error. Not a face"))
else:
self.bounds = face.ParameterRange
self.face = face
diff --git a/freecad/Curves/lineFP.py b/freecad/Curves/lineFP.py
index c2f972f..2c070fd 100644
--- a/freecad/Curves/lineFP.py
+++ b/freecad/Curves/lineFP.py
@@ -1,10 +1,14 @@
# -*- coding: utf-8 -*-
-__title__ = "Parametric line"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+__title__ = QT_TRANSLATE_NOOP("Curves_Line", "Parametric line")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Parametric line between two vertexes."
-__usage__ = """Select 2 vertexes in the 3D View and activate the tool."""
+__doc__ = translate("Curves_Line", "Parametric line between two vertexes.")
+__usage__ = translate("Curves_Line", "Select 2 vertexes in the 3D View and activate the tool.")
import os
import FreeCAD
@@ -20,8 +24,8 @@ class line:
"""Creates a parametric line between two vertexes"""
def __init__(self, obj):
"""Add the properties"""
- obj.addProperty("App::PropertyLinkSub", "Vertex1", "Line", "First Vertex")
- obj.addProperty("App::PropertyLinkSub", "Vertex2", "Line", "Second Vertex")
+ obj.addProperty("App::PropertyLinkSub", "Vertex1", "Line", QT_TRANSLATE_NOOP("App::Property", "First Vertex"))
+ obj.addProperty("App::PropertyLinkSub", "Vertex2", "Line", QT_TRANSLATE_NOOP("App::Property", "Second Vertex"))
obj.Proxy = self
def execute(self, obj):
@@ -31,7 +35,7 @@ def execute(self, obj):
ls = Part.LineSegment(v1.Point, v2.Point)
obj.Shape = ls.toShape()
else:
- FreeCAD.Console.PrintError("{} broken !\n".format(obj.Label))
+ FreeCAD.Console.PrintError(translate("Log", "{} broken !\n")).format(obj.Label)
class lineVP:
@@ -82,7 +86,7 @@ def Activated(self):
if len(verts) == 2:
self.makeLineFeature(verts)
else:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
def IsActive(self):
if FreeCAD.ActiveDocument:
@@ -91,9 +95,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('Curves_line', lineCommand())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_Line", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_Line", lineCommand())
diff --git a/freecad/Curves/map_on_face.py b/freecad/Curves/map_on_face.py
index 5a0841a..6c5b854 100644
--- a/freecad/Curves/map_on_face.py
+++ b/freecad/Curves/map_on_face.py
@@ -429,10 +429,10 @@ def get_pcurve(self, edge):
if len(proj.Edges) == 0:
raise RuntimeError("Failed to get pcurve")
if len(proj.Edges) > 1:
- FreeCAD.Console.PrintWarning("Projection: several pcurves")
+ FreeCAD.Console.PrintWarning(translate("Log", "Projection: several pcurves"))
cos = self.quad.curveOnSurface(proj.Edge1)
if edge.isClosed() and not cos[0].isClosed():
- FreeCAD.Console.PrintWarning("pcurve should be closed")
+ FreeCAD.Console.PrintWarning(translate("Log", "pcurve should be closed"))
diff --git a/freecad/Curves/mixed_curve.py b/freecad/Curves/mixed_curve.py
index 912ef9a..bd2b6f7 100644
--- a/freecad/Curves/mixed_curve.py
+++ b/freecad/Curves/mixed_curve.py
@@ -1,12 +1,22 @@
# -*- coding: utf-8 -*-
-__title__ = "Mixed curve"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_MixedCurve", "Mixed curve")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Builds a 3D curve as the intersection of 2 projected curves."
-__usage__ = """Select two objects or shapes, and activate tool.
+__doc__ = translate(
+ "Curves_MixedCurve", "Builds a 3D curve as the intersection of 2 projected curves."
+)
+__usage__ = translate(
+ "Curves_MixedCurve",
+ """Select two objects or shapes, and activate tool.
The camera direction is saved during each shape selection, and will be used as projection direction.
-Set these directions to (0,0,0) to use the placement of each shape as projection direction."""
+Set these directions to (0,0,0) to use the placement of each shape as projection direction.""",
+)
import os
import FreeCAD
@@ -72,16 +82,52 @@ def shape(self):
class MixedCurveFP:
"""Builds a 3D curve as the intersection of 2 projected curves."""
def __init__(self, obj, s1, s2, d1, d2):
- obj.addProperty("App::PropertyLink", "Shape1", "Mixed Curve", "First shape").Shape1 = s1
- obj.addProperty("App::PropertyLink", "Shape2", "Mixed Curve", "Second shape").Shape2 = s2
- obj.addProperty("App::PropertyVector", "Direction1", "Mixed Curve",
- "Projection direction of the first shape.\nIf vector is null, shape's placement is used.").Direction1 = d1
- obj.addProperty("App::PropertyVector", "Direction2", "Mixed Curve",
- "Projection direction of the second shape.\nIf vector is null, shape's placement is used.").Direction2 = d2
- obj.addProperty("App::PropertyBool", "FillFace1", "Mixed Curve",
- "Build ruled surfaces between Shape1 and resulting Mixed-Curve").FillFace1 = False
- obj.addProperty("App::PropertyBool", "FillFace2", "Mixed Curve",
- "Build ruled surfaces between Shape2 and resulting Mixed-Curve").FillFace2 = False
+ obj.addProperty(
+ "App::PropertyLink",
+ "Shape1",
+ "Mixed Curve",
+ QT_TRANSLATE_NOOP("App::Property", "First shape"),
+ ).Shape1 = s1
+ obj.addProperty(
+ "App::PropertyLink",
+ "Shape2",
+ "Mixed Curve",
+ QT_TRANSLATE_NOOP("App::Property", "Second shape"),
+ ).Shape2 = s2
+ obj.addProperty(
+ "App::PropertyVector",
+ "Direction1",
+ "Mixed Curve",
+ QT_TRANSLATE_NOOP(
+ "App::Property",
+ "Projection direction of the first shape.\nIf vector is null, shape's placement is used.",
+ ),
+ ).Direction1 = d1
+ obj.addProperty(
+ "App::PropertyVector",
+ "Direction2",
+ "Mixed Curve",
+ QT_TRANSLATE_NOOP(
+ "App::Property",
+ "Projection direction of the second shape.\nIf vector is null, shape's placement is used.",
+ ),
+ ).Direction2 = d2
+ obj.addProperty(
+ "App::PropertyBool",
+ "FillFace1",
+ "Mixed Curve",
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Build ruled surfaces between Shape1 and resulting Mixed-Curve"
+ ),
+ ).FillFace1 = False
+ obj.addProperty(
+ "App::PropertyBool",
+ "FillFace2",
+ "Mixed Curve",
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Build ruled surfaces between Shape2 and resulting Mixed-Curve"
+ ),
+ ).FillFace2 = False
obj.Proxy = self
def execute(self, obj):
@@ -173,7 +219,7 @@ def Activated(self):
except AttributeError:
sel = FreeCADGui.Selection.getSelectionEx()
if not len(sel) == 2:
- FreeCAD.Console.PrintError("Select 2 objects !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select 2 objects !\n"))
return
for selobj in sel:
selobj.Object.ViewObject.Visibility = False
@@ -189,9 +235,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': 'Mixed curve',
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('mixed_curve', MixedCurveCmd())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": "Mixed curve",
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_MixedCurve", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_MixedCurve", MixedCurveCmd())
diff --git a/freecad/Curves/multiLoftFP.py b/freecad/Curves/multiLoftFP.py
index 6e4f933..7bd30f8 100644
--- a/freecad/Curves/multiLoftFP.py
+++ b/freecad/Curves/multiLoftFP.py
@@ -21,10 +21,10 @@ class MultiLoftFP:
"""Creates a MultiLoft"""
def __init__(self, obj):
"""Add the properties"""
- obj.addProperty("App::PropertyLinkList", "Sources", "Multiloft", "Objects to loft")
- obj.addProperty("App::PropertyBool", "Ruled", "Multiloft", "Ruled Loft").Ruled = False
- obj.addProperty("App::PropertyBool", "Closed", "Multiloft", "Close loft").Closed = False
- obj.addProperty("App::PropertyInteger", "MaxDegree", "Multiloft", "Max Bspline degree").MaxDegree = 5
+ obj.addProperty("App::PropertyLinkList", "Sources", "Multiloft", QT_TRANSLATE_NOOP("App::Property", "Objects to loft"))
+ obj.addProperty("App::PropertyBool", "Ruled", "Multiloft", QT_TRANSLATE_NOOP("App::Property", "Ruled Loft")).Ruled = False
+ obj.addProperty("App::PropertyBool", "Closed", "Multiloft", QT_TRANSLATE_NOOP("App::Property", "Close loft")).Closed = False
+ obj.addProperty("App::PropertyInteger", "MaxDegree", "Multiloft", QT_TRANSLATE_NOOP("App::Property", "Max Bspline degree")).MaxDegree = 5
obj.Proxy = self
def execute(self, obj):
@@ -113,7 +113,7 @@ def makeFeature(self, sel):
def Activated(self):
sel = FreeCADGui.Selection.getSelection()
if sel == []:
- FreeCAD.Console.PrintError("Select something first !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select something first !\n"))
else:
self.makeFeature(sel)
@@ -129,4 +129,4 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('MultiLoft', MultiLoftCommand())
+FreeCADGui.addCommand("Curves_MultiLoft", MultiLoftCommand())
diff --git a/freecad/Curves/nurbs_surface_match.py b/freecad/Curves/nurbs_surface_match.py
index e978bee..e39bf16 100644
--- a/freecad/Curves/nurbs_surface_match.py
+++ b/freecad/Curves/nurbs_surface_match.py
@@ -6,7 +6,7 @@
def debug(string):
if DEBUG:
FreeCAD.Console.PrintMessage(string)
- FreeCAD.Console.PrintMessage("\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "\n"))
# ****** match degrees ******
@@ -34,7 +34,7 @@ def matchVDegree(s1,s2):
def matchURange(s1,s2):
'''make the UKnotSequence of surface s1 match the UKnotSequence of surface s2'''
if not s1.UDegree == s2.UDegree:
- FreeCAD.Console.PrintError("U degree mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "U degree mismatch error\n"))
return(False)
if s1.bounds()[0:2] == s2.bounds()[0:2]:
debug("U parameter ranges already matching")
@@ -53,7 +53,7 @@ def matchURange(s1,s2):
def matchVRange(s1,s2):
'''make the VKnotSequence of surface s1 match the VKnotSequence of surface s2'''
if not s1.VDegree == s2.VDegree:
- FreeCAD.Console.PrintError("V degree mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "V degree mismatch error\n"))
return(False)
if s1.bounds()[2::] == s2.bounds()[2::]:
debug("V parameter ranges already matching")
@@ -84,10 +84,10 @@ def getIndex(k,ks):
def matchUknots(s1,s2,tol=0.000001):
'''insert knots to make surfaces s1 and s2 have the same U knots sequences'''
if not s1.UDegree == s2.UDegree:
- FreeCAD.Console.PrintError("U degree mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "U degree mismatch error\n"))
return(False)
if not s1.bounds()[0:2] == s2.bounds()[0:2]:
- FreeCAD.Console.PrintError("U parameter ranges mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "U parameter ranges mismatch error\n"))
return(False)
k1 = s1.getUKnots()
k2 = s2.getUKnots()
@@ -107,10 +107,10 @@ def matchUknots(s1,s2,tol=0.000001):
def matchVknots(s1,s2,tol=0.000001):
'''insert knots to make surfaces s1 and s2 have the same V knots sequences'''
if not s1.VDegree == s2.VDegree:
- FreeCAD.Console.PrintError("V degree mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "V degree mismatch error\n"))
return(False)
if not s1.bounds()[2::] == s2.bounds()[2::]:
- FreeCAD.Console.PrintError("V parameter ranges mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "V parameter ranges mismatch error\n"))
return(False)
k1 = s1.getVKnots()
k2 = s2.getVKnots()
@@ -132,13 +132,13 @@ def matchVknots(s1,s2,tol=0.000001):
def matchUMults(s1,s2):
'''insert knots to make surfaces s1 and s2 have the same U knot multiplicities'''
if not s1.UDegree == s2.UDegree:
- FreeCAD.Console.PrintError("U degree mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "U degree mismatch error\n"))
return(False)
if not s1.bounds()[0:2] == s2.bounds()[0:2]:
- FreeCAD.Console.PrintError("U parameter ranges mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "U parameter ranges mismatch error\n"))
return(False)
if not s1.getUKnots() == s2.getUKnots():
- FreeCAD.Console.PrintError("U KnotSequence mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "U KnotSequence mismatch error\n"))
return(False)
m1 = s1.getUMultiplicities()
m2 = s2.getUMultiplicities()
@@ -152,13 +152,13 @@ def matchUMults(s1,s2):
def matchVMults(s1,s2):
'''insert knots to make surfaces s1 and s2 have the same V knot multiplicities'''
if not s1.VDegree == s2.VDegree:
- FreeCAD.Console.PrintError("V degree mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "V degree mismatch error\n"))
return(False)
if not s1.bounds()[2::] == s2.bounds()[2::]:
- FreeCAD.Console.PrintError("V parameter ranges mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "V parameter ranges mismatch error\n"))
return(False)
if not s1.getVKnots() == s2.getVKnots():
- FreeCAD.Console.PrintError("V KnotSequence mismatch error\n")
+ FreeCAD.Console.PrintError(translate("Log", "V KnotSequence mismatch error\n"))
return(False)
m1 = s1.getVMultiplicities()
m2 = s2.getVMultiplicities()
diff --git a/freecad/Curves/nurbs_tools.py b/freecad/Curves/nurbs_tools.py
index bb20e83..fa8979e 100644
--- a/freecad/Curves/nurbs_tools.py
+++ b/freecad/Curves/nurbs_tools.py
@@ -765,7 +765,7 @@ def __init__(self, shape):
path = shape.approximate(1e-8, 1e-3, 99, 5) # &tol2d, &tol3d, &maxseg, &maxdeg
self.path = path.toShape()
else:
- FreeCAD.Console.PrintError("EdgeInterpolator input must be edge or wire")
+ FreeCAD.Console.PrintError(translate("Log", "EdgeInterpolator input must be edge or wire"))
raise ValueError
def add_data(self, p, dat):
@@ -777,7 +777,7 @@ def add_data(self, p, dat):
if isinstance(dat, type(self.data[0][1])):
self.data.append((p, dat))
else:
- FreeCAD.Console.PrintError("Bad type of data")
+ FreeCAD.Console.PrintError(translate("Log", "Bad type of data"))
def add_mult_data(self, dat):
"""add multiple data values"""
@@ -785,7 +785,7 @@ def add_mult_data(self, dat):
for d in dat:
self.add_data(d[0], d[1])
else:
- FreeCAD.Console.PrintError("Argument must be list or tuple")
+ FreeCAD.Console.PrintError(translate("Log", "Argument must be list or tuple"))
def get_point(self, val):
v = FreeCAD.Vector(0, 0, 0)
diff --git a/freecad/Curves/parametricSolid.py b/freecad/Curves/parametricSolid.py
index ba7014f..e31bfd1 100644
--- a/freecad/Curves/parametricSolid.py
+++ b/freecad/Curves/parametricSolid.py
@@ -1,17 +1,24 @@
# -*- coding: utf-8 -*-
-__title__ = "Parametric solid"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_ParametricSolid", "Parametric solid")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Make a parametric solid from selected faces."
-__usage__ = """Select some faces in the 3D View, or select objects in the Tree View.
+__doc__ = translate("Curves_ParametricSolid", "Make a parametric solid from selected faces.")
+__usage__ = translate(
+ "Curves_ParametricSolid",
+ """Select some faces in the 3D View, or select objects in the Tree View.
Activate tool.
It will try to build a solid from selected faces.
If not possible, it falls back to a shell, then to a compound.
-The ShapeStatus property (and the color of the icon) give the type of shape."""
+The ShapeStatus property (and the color of the icon) give the type of shape.""",
+)
import os
-import FreeCAD
import FreeCADGui
import Part
import tempfile
@@ -58,18 +65,27 @@ def get_svg(shape_type):
class solid:
"""Make a parametric solid from selected faces"""
def __init__(self, obj):
- obj.addProperty("App::PropertyLinkSubList",
- "Faces",
- "Solid",
- "List of faces to build the solid")
- obj.addProperty("App::PropertyString",
- "ShapeStatus",
- "Solid",
- "Status of the created shape")
- obj.addProperty("App::PropertyBool",
- "ShowOpenEdges",
- "Debug",
- "If the output shape in not a solid, this will output the open edges")
+ obj.addProperty(
+ "App::PropertyLinkSubList",
+ "Faces",
+ "Solid",
+ QT_TRANSLATE_NOOP("App::Property", "List of faces to build the solid"),
+ )
+ obj.addProperty(
+ "App::PropertyString",
+ "ShapeStatus",
+ "Solid",
+ QT_TRANSLATE_NOOP("App::Property", "Status of the created shape"),
+ )
+ obj.addProperty(
+ "App::PropertyBool",
+ "ShowOpenEdges",
+ "Debug",
+ QT_TRANSLATE_NOOP(
+ "App::Property",
+ "If the output shape in not a solid, this will output the open edges",
+ ),
+ )
obj.ShapeStatus = ""
obj.setEditorMode("ShapeStatus", 1)
obj.Proxy = self
@@ -165,7 +181,7 @@ def Activated(self):
faces = []
sel = FreeCADGui.Selection.getSelectionEx('', 0)
if sel == []:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
for selobj in sel:
if selobj.HasSubObjects:
for i in range(len(selobj.SubObjects)):
@@ -186,9 +202,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('solid', solidCommand())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_ParametricSolid", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_ParametricSolid", solidCommand())
diff --git a/freecad/Curves/pasteSVG.py b/freecad/Curves/pasteSVG.py
index f47d254..3b0822e 100644
--- a/freecad/Curves/pasteSVG.py
+++ b/freecad/Curves/pasteSVG.py
@@ -1,12 +1,20 @@
# -*- coding: utf-8 -*-
-__title__ = "Paste SVG"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_PasteSVG", "Paste SVG")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Paste the SVG content of the clipboard"
-__usage__ = """When working in parallel with FreeCAD and a SVG editor (Inkscape),
+__doc__ = translate("Curves_PasteSVG", "Paste the SVG content of the clipboard")
+__usage__ = translate(
+ "Curves_PasteSVG",
+ """When working in parallel with FreeCAD and a SVG editor (Inkscape),
copy (CTRL-C) an object in the SVG editor, switch to FreeCAD and activate tool.
-This will import the SVG content of the clipboard into the active FreeCAD document."""
+This will import the SVG content of the clipboard into the active FreeCAD document.""",
+)
import xml.sax
import importSVG
@@ -34,7 +42,7 @@ def Activated(self):
doc.recompute()
FreeCADGui.SendMsgToActiveView("ViewFit")
else:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
def IsActive(self):
cb = QtGui.QApplication.clipboard()
@@ -43,9 +51,13 @@ def IsActive(self):
return True
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__, translate("Curves_PasteSVG", "Usage"), " ".join(__usage__.splitlines())
+ ),
+ }
-FreeCADGui.addCommand('pasteSVG', pasteSVG())
+FreeCADGui.addCommand("Curves_PasteSVG", pasteSVG())
diff --git a/freecad/Curves/pipeshellFP.py b/freecad/Curves/pipeshellFP.py
index cd6fb35..314ba8b 100644
--- a/freecad/Curves/pipeshellFP.py
+++ b/freecad/Curves/pipeshellFP.py
@@ -19,7 +19,7 @@
def debug(string):
if DEBUG:
FreeCAD.Console.PrintMessage(string)
- FreeCAD.Console.PrintMessage("\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "\n"))
class pipeShell:
@@ -27,24 +27,24 @@ class pipeShell:
def __init__(self, obj):
''' Add the properties '''
- obj.addProperty("App::PropertyLinkSubList", "Spine", "Main", "Sweep path")
- obj.addProperty("App::PropertyLinkList", "Profiles", "Main", "Profiles that are swept along spine")
- obj.addProperty("App::PropertyLink", "Support", "Mode", "Shape of the ShapeSupport mode")
- obj.addProperty("App::PropertyLink", "Auxiliary", "Mode", "Auxiliary spine")
- obj.addProperty("App::PropertyEnumeration", "Mode", "Main", "PipeShell mode").Mode = ["Frenet", "DiscreteTrihedron", "FixedTrihedron", "Binormal", "ShapeSupport", "AuxiliarySpine"]
- obj.addProperty("App::PropertyEnumeration", "Output", "Main", "Output shape").Output = ["Sections", "Lofted sections", "Surface"]
- obj.addProperty("App::PropertyBool", "Solid", "Settings", "Make solid object").Solid = False
- obj.addProperty("App::PropertyInteger", "MaxDegree", "Settings", "Maximum degree of the generated surface").MaxDegree = 5
- obj.addProperty("App::PropertyInteger", "MaxSegments", "Settings", "Maximum number of segments of the generated surface").MaxSegments = 999
- obj.addProperty("App::PropertyInteger", "Samples", "Settings", "Number of samples for preview").Samples = 100
- obj.addProperty("App::PropertyFloat", "Tol3d", "Settings", "Tolerance 3D").Tol3d = 1.0e-4
- obj.addProperty("App::PropertyFloat", "TolBound", "Settings", "Tolerance boundary").TolBound = 1.0e-4
- obj.addProperty("App::PropertyFloat", "TolAng", "Settings", "Tolerance angular").TolAng = 1.0e-2
- obj.addProperty("App::PropertyVector", "Direction", "Mode", "Direction of the Binormal and FixedTrihedron modes")
- obj.addProperty("App::PropertyVector", "Location", "Mode", "Location of the FixedTrihedron mode")
- obj.addProperty("App::PropertyBool", "Corrected", "Mode", "Corrected Frenet").Corrected = False
- obj.addProperty("App::PropertyBool", "EquiCurvi", "Mode", "Curvilinear equivalence").EquiCurvi = False
- obj.addProperty("App::PropertyEnumeration", "Contact", "Mode", "Type of contact to auxiliary spine").Contact = ["NoContact", "Contact", "ContactOnBorder"]
+ obj.addProperty("App::PropertyLinkSubList", "Spine", "Main", QT_TRANSLATE_NOOP("App::Property", "Sweep path"))
+ obj.addProperty("App::PropertyLinkList", "Profiles", "Main", QT_TRANSLATE_NOOP("App::Property", "Profiles that are swept along spine"))
+ obj.addProperty("App::PropertyLink", "Support", "Mode", QT_TRANSLATE_NOOP("App::Property", "Shape of the ShapeSupport mode"))
+ obj.addProperty("App::PropertyLink", "Auxiliary", "Mode", QT_TRANSLATE_NOOP("App::Property", "Auxiliary spine"))
+ obj.addProperty("App::PropertyEnumeration", "Mode", "Main", QT_TRANSLATE_NOOP("App::Property", "PipeShell mode")).Mode = ["Frenet", "DiscreteTrihedron", "FixedTrihedron", "Binormal", "ShapeSupport", "AuxiliarySpine"]
+ obj.addProperty("App::PropertyEnumeration", "Output", "Main", QT_TRANSLATE_NOOP("App::Property", "Output shape")).Output = ["Sections", "Lofted sections", "Surface"]
+ obj.addProperty("App::PropertyBool", "Solid", "Settings", QT_TRANSLATE_NOOP("App::Property", "Make solid object")).Solid = False
+ obj.addProperty("App::PropertyInteger", "MaxDegree", "Settings", QT_TRANSLATE_NOOP("App::Property", "Maximum degree of the generated surface")).MaxDegree = 5
+ obj.addProperty("App::PropertyInteger", "MaxSegments", "Settings", QT_TRANSLATE_NOOP("App::Property", "Maximum number of segments of the generated surface")).MaxSegments = 999
+ obj.addProperty("App::PropertyInteger", "Samples", "Settings", QT_TRANSLATE_NOOP("App::Property", "Number of samples for preview")).Samples = 100
+ obj.addProperty("App::PropertyFloat", "Tol3d", "Settings", QT_TRANSLATE_NOOP("App::Property", "Tolerance 3D")).Tol3d = 1.0e-4
+ obj.addProperty("App::PropertyFloat", "TolBound", "Settings", QT_TRANSLATE_NOOP("App::Property", "Tolerance boundary")).TolBound = 1.0e-4
+ obj.addProperty("App::PropertyFloat", "TolAng", "Settings", QT_TRANSLATE_NOOP("App::Property", "Tolerance angular")).TolAng = 1.0e-2
+ obj.addProperty("App::PropertyVector", "Direction", "Mode", QT_TRANSLATE_NOOP("App::Property", "Direction of the Binormal and FixedTrihedron modes"))
+ obj.addProperty("App::PropertyVector", "Location", "Mode", QT_TRANSLATE_NOOP("App::Property", "Location of the FixedTrihedron mode"))
+ obj.addProperty("App::PropertyBool", "Corrected", "Mode", QT_TRANSLATE_NOOP("App::Property", "Corrected Frenet")).Corrected = False
+ obj.addProperty("App::PropertyBool", "EquiCurvi", "Mode", QT_TRANSLATE_NOOP("App::Property", "Curvilinear equivalence")).EquiCurvi = False
+ obj.addProperty("App::PropertyEnumeration", "Contact", "Mode", QT_TRANSLATE_NOOP("App::Property", "Type of contact to auxiliary spine")).Contact = ["NoContact", "Contact", "ContactOnBorder"]
obj.Mode = "DiscreteTrihedron"
obj.Contact = "NoContact"
obj.Output = "Sections"
@@ -166,7 +166,7 @@ def onChanged(self, fp, prop):
fp.TolAng = 1000
if prop == "Contact":
if fp.Contact == "ContactOnBorder":
- FreeCAD.Console.PrintError("\nSorry, ContactOnBorder option is currently broken in OCCT.\n")
+ FreeCAD.Console.PrintError(translate("Log", "\nSorry, ContactOnBorder option is currently broken in OCCT.\n"))
fp.Contact = "Contact"
def add(self, ps, p):
@@ -209,11 +209,11 @@ def execute(self, obj):
if not direction:
direction = FreeCAD.Vector(0, 0, 1)
obj.Direction = direction
- FreeCAD.Console.PrintError("\nWrong direction, defaulting to +Z\n")
+ FreeCAD.Console.PrintError(translate("Log", "\nWrong direction, defaulting to +Z\n"))
elif direction.Length < 1e-7:
direction = FreeCAD.Vector(0, 0, 1)
obj.Direction = direction
- FreeCAD.Console.PrintError("\nDirection has null length, defaulting to +Z\n")
+ FreeCAD.Console.PrintError(translate("Log", "\nDirection has null length, defaulting to +Z\n"))
if mode == "Binormal":
debug("Binormal mode (%r)" % direction)
ps.setBiNormalMode(direction)
@@ -240,7 +240,7 @@ def execute(self, obj):
debug("AuxiliarySpine mode (%r %s)" % (curv, cont))
ps.setAuxiliarySpine(w, curv, n)
else:
- FreeCAD.Console.PrintError("\nPlease set a valid Auxiliary Spine Object\n")
+ FreeCAD.Console.PrintError(translate("Log", "\nPlease set a valid Auxiliary Spine Object\n"))
elif mode == "ShapeSupport":
sup = self.getprop(obj, "Support")
sh = None
@@ -250,7 +250,7 @@ def execute(self, obj):
debug("ShapeSupport mode")
ps.setSpineSupport(sh)
else:
- FreeCAD.Console.PrintError("\nPlease set a valid Spine support Object\n")
+ FreeCAD.Console.PrintError(translate("Log", "\nPlease set a valid Spine support Object\n"))
for p in profs:
self.add(ps, p)
@@ -272,7 +272,7 @@ def execute(self, obj):
c = Part.Compound(shapes + rails)
obj.Shape = c
else:
- FreeCAD.Console.PrintError("\nFailed to create shape\n")
+ FreeCAD.Console.PrintError(translate("Log", "\nFailed to create shape\n"))
def getCode(self, cont):
if cont == "Contact":
@@ -373,7 +373,7 @@ def Activated(self):
# path.ViewObject.LineColor = (1.0,0.3,0.0)
self.makePipeShellFeature(path, profs)
else:
- FreeCAD.Console.PrintError("\nYou must select:\n- in the 3D view, the edges that build the sweep path\n- in the Tree view, one or more 'pipeshellProfile' objects\n")
+ FreeCAD.Console.PrintError(translate("Log", "\nYou must select:\n- in the 3D view, the edges that build the sweep path\n- in the Tree view, one or more 'pipeshellProfile' objects\n"))
def IsActive(self):
if FreeCAD.ActiveDocument:
@@ -387,4 +387,4 @@ def GetResources(self):
'ToolTip': __doc__}
-FreeCADGui.addCommand('pipeshell', pipeShellCommand())
+FreeCADGui.addCommand("Curves_Pipeshell", pipeShellCommand())
diff --git a/freecad/Curves/pipeshellProfileFP.py b/freecad/Curves/pipeshellProfileFP.py
index 6d24171..892e4a6 100644
--- a/freecad/Curves/pipeshellProfileFP.py
+++ b/freecad/Curves/pipeshellProfileFP.py
@@ -18,20 +18,20 @@
def debug(string):
if DEBUG:
FreeCAD.Console.PrintMessage(string)
- FreeCAD.Console.PrintMessage("\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "\n"))
class profile:
"Profile object for PipeShell"
def __init__(self, obj, source):
''' Add the properties '''
if isinstance(source,(list,tuple)):
- obj.addProperty("App::PropertyLinkSubList", "Profile", "Profile", "SubShapes of the profile")
+ obj.addProperty("App::PropertyLinkSubList", "Profile", "Profile", QT_TRANSLATE_NOOP("App::Property", "SubShapes of the profile"))
else:
- obj.addProperty("App::PropertyLink", "Profile", "Profile", "source object of the profile")
+ obj.addProperty("App::PropertyLink", "Profile", "Profile", QT_TRANSLATE_NOOP("App::Property", "source object of the profile"))
obj.Profile = source
- obj.addProperty("App::PropertyLinkSub", "Location", "Profile", "Vertex location on spine")
- obj.addProperty("App::PropertyBool", "Contact", "Profile", "Translate profile to contact spine").Contact = False
- obj.addProperty("App::PropertyBool", "Correction", "Profile", "Rotate profile to be orthogonal to spine").Correction = False
+ obj.addProperty("App::PropertyLinkSub", "Location", "Profile", QT_TRANSLATE_NOOP("App::Property", "Vertex location on spine"))
+ obj.addProperty("App::PropertyBool", "Contact", "Profile", QT_TRANSLATE_NOOP("App::Property", "Translate profile to contact spine")).Contact = False
+ obj.addProperty("App::PropertyBool", "Correction", "Profile", QT_TRANSLATE_NOOP("App::Property", "Rotate profile to be orthogonal to spine")).Correction = False
obj.Proxy = self
def getEdgeList(self, obj, prop):
@@ -81,9 +81,9 @@ def execute(self, obj):
if w:
obj.Shape = w
else:
- FreeCAD.Console.PrintError("\nFailed to build wire\n")
+ FreeCAD.Console.PrintError(translate("Log", "\nFailed to build wire\n"))
else:
- FreeCAD.Console.PrintError("\nFailed to extract edges\n")
+ FreeCAD.Console.PrintError(translate("Log", "\nFailed to extract edges\n"))
class profileVP:
def __init__(self,vobj):
@@ -144,7 +144,7 @@ def Activated(self):
source = None
sel = FreeCADGui.Selection.getSelectionEx()
if sel == []:
- FreeCAD.Console.PrintError("Select at least 1 edge !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select at least 1 edge !\n"))
for selobj in sel:
if selobj.HasSubObjects:
for i in range(len(selobj.SubObjects)):
@@ -174,4 +174,4 @@ def GetResources(self):
'MenuText': __title__,
'ToolTip': __doc__}
-FreeCADGui.addCommand('profile', profileCommand())
+FreeCADGui.addCommand("Curves_PipeshellProfile", profileCommand())
diff --git a/freecad/Curves/profile_editor.py b/freecad/Curves/profile_editor.py
index 7accf83..83ee93a 100644
--- a/freecad/Curves/profile_editor.py
+++ b/freecad/Curves/profile_editor.py
@@ -5,7 +5,7 @@
from freecad.Curves import _utils
from freecad.Curves import graphics
# from graphics import COLORS
-# FreeCAD.Console.PrintMessage("Using local Pivy.graphics library\n")
+# FreeCAD.Console.PrintMessage(translate("Log", "Using local Pivy.graphics library\n"))
def parameterization(points, a, closed):
@@ -240,7 +240,7 @@ def __init__(self, points=[], fp=None):
elif isinstance(p, (MarkerOnShape, ConnectionMarker)):
self.points.append(p)
else:
- FreeCAD.Console.PrintError("InterpoCurveEditor : bad input")
+ FreeCAD.Console.PrintError(translate("Log", "InterpoCurveEditor : bad input"))
# Setup coin objects
if self.fp:
self.guidoc = self.fp.ViewObject.Document
@@ -363,7 +363,7 @@ def controlCB(self, attr, event_callback):
for i in range(len(self.root.selected_objects)):
if isinstance(self.root.selected_objects[i], MarkerOnShape):
self.root.selected_objects[i].sublink = tup
- FreeCAD.Console.PrintMessage("Snapped to {}\n".format(str(self.root.selected_objects[i].sublink)))
+ FreeCAD.Console.PrintMessage(translate("Log", "Snapped to {}\n")).format(str(self.root.selected_objects[i].sublink))
self.root.selected_objects[i].drag_start()
self.root.selected_objects[i].drag((0, 0, 0.))
self.root.selected_objects[i].drag_release()
@@ -371,7 +371,7 @@ def controlCB(self, attr, event_callback):
elif event.getKey() == ord("l"):
self.toggle_linear()
elif (event.getKey() == 65535) or (event.getKey() == 65288): # Suppr or Backspace
- # FreeCAD.Console.PrintMessage("Some objects have been deleted\n")
+ # FreeCAD.Console.PrintMessage(translate("Log", "Some objects have been deleted\n"))
pts = list()
for o in self.root.dynamic_objects:
if isinstance(o, MarkerOnShape):
@@ -433,9 +433,9 @@ def set_planar(self):
pl = Part.Plane(p0, p1, p1 + view_dir)
for o in markers:
if isinstance(o.snap_shape, Part.Vertex):
- FreeCAD.Console.PrintMessage("Snapped to Vertex\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Snapped to Vertex\n"))
elif isinstance(o.snap_shape, Part.Edge):
- FreeCAD.Console.PrintMessage("Snapped to Edge\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Snapped to Edge\n"))
c = o.snap_shape.Curve
pts = pl.intersect(c)[0]
new_pts = list()
@@ -451,7 +451,7 @@ def set_planar(self):
new_pts.append(new)
o.points = new_pts
elif isinstance(o.snap_shape, Part.Face):
- FreeCAD.Console.PrintMessage("Snapped to Face\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Snapped to Face\n"))
s = o.snap_shape.Surface
cvs = pl.intersect(s)
new_pts = list()
@@ -468,7 +468,7 @@ def set_planar(self):
new_pts.append(new)
o.points = new_pts
else:
- FreeCAD.Console.PrintMessage("Not snapped\n")
+ FreeCAD.Console.PrintMessage(translate("Log", "Not snapped\n"))
new_pts = list()
for ip in o.points:
iv = FreeCAD.Vector(ip[0], ip[1], ip[2])
@@ -489,7 +489,7 @@ def subdivide(self):
pts.append(o.markers[0])
if o in self.root.selected_objects:
idx = self.lines.index(o)
- FreeCAD.Console.PrintMessage("Subdividing line #{}\n".format(idx))
+ FreeCAD.Console.PrintMessage(translate("Log", "Subdividing line #{}\n")).format(idx)
p1 = o.markers[0].points[0]
p2 = o.markers[1].points[0]
par1 = self.curve.parameter(FreeCAD.Vector(p1))
diff --git a/freecad/Curves/property_editor.py b/freecad/Curves/property_editor.py
index 6c18048..eb9ca09 100644
--- a/freecad/Curves/property_editor.py
+++ b/freecad/Curves/property_editor.py
@@ -69,7 +69,7 @@ def add_layout(self,name):
self.widget.layout.addLayout(g)
return(g)
else:
- FreeCAD.Console.PrintError("VPEditor has no widget !\n")
+ FreeCAD.Console.PrintError(translate("Log", "VPEditor has no widget !\n"))
def add_propeditor(self,editor,group):
"""add a property editor widget"""
group.addWidget(editor)
@@ -105,14 +105,14 @@ def reject(self):
self.quit()
@Slot()
def quit(self):
- FreeCAD.Console.PrintMessage("VPEditor.Quit() \n")
+ FreeCAD.Console.PrintMessage(translate("Log", "VPEditor.Quit() \n"))
self.widget.close()
try:
self.comboview.removeTab(self.tabIndex)
self.comboview.setCurrentIndex(0)
FreeCADGui.ActiveDocument.resetEdit()
except:
- FreeCAD.Console.PrintError("Failed to remove from ComboView\n")
+ FreeCAD.Console.PrintError(translate("Log", "Failed to remove from ComboView\n"))
class VectorListWidget(QTableWidget):
def __init__(self, fp=None, prop=None, parent=None):
diff --git a/freecad/Curves/resources/translations/Curves.ts b/freecad/Curves/resources/translations/Curves.ts
new file mode 100644
index 0000000..89ad826
--- /dev/null
+++ b/freecad/Curves/resources/translations/Curves.ts
@@ -0,0 +1,3000 @@
+
+
+
+
+ App::Property
+
+
+
+ Edge
+
+
+
+
+ Tool target
+
+
+
+
+ Discretization Method
+
+
+
+
+ Number of edge points
+
+
+
+
+ Distance between edge points
+
+
+
+
+ Distance for deflection Algorithm
+
+
+
+
+ Angular value for Angular-Curvature Algorithm
+
+
+
+
+ Curvature value for Angular-Curvature Algorithm
+
+
+
+
+ Minimum Number of points
+
+
+
+
+ Start parameter
+
+
+
+
+ End parameter
+
+
+
+
+
+
+ Points
+
+
+
+
+
+ Normalized parameters list
+
+
+
+
+ Object on which the analysis is performed
+
+
+
+
+ Anaysis direction
+
+
+
+
+ Positive draft angle
+
+
+
+
+ Negative draft angle
+
+
+
+
+ Positive draft tolerance
+
+
+
+
+ Negative draft tolerance
+
+
+
+
+ Color of the positive in-draft area
+
+
+
+
+ Color of the positive tolerance area
+
+
+
+
+ Color of the positive out-of-draft area
+
+
+
+
+ Color of the negative in-draft area
+
+
+
+
+ Color of the negative tolerance area
+
+
+
+
+ Color of the negative out-of-draft area
+
+
+
+
+
+ Amount of shading on the analysis overlay
+
+
+
+
+
+
+ Input face
+
+
+
+
+ Size of the map in the U direction
+
+
+
+
+ Size of the map in the V direction
+
+
+
+
+ Add the bounding box of the face
+
+
+
+
+ The conical face to flatten
+
+
+
+
+ Unroll the face in place
+
+
+
+
+ Size of the underlying surface
+
+
+
+
+ SourceObjects
+
+
+
+
+ SourceShapes
+
+
+
+
+ Number of orthogonal samples
+
+
+
+
+ Smoothing factor on curve start
+
+
+
+
+ Smoothing factor on curve end
+
+
+
+
+ Projection method (1,2,3,4)
+
+
+
+
+
+ 3D tolerance
+
+
+
+
+
+ Parametric tolerance
+
+
+
+
+
+ Number of turns
+
+
+
+
+ Thread lead (-1 for auto)
+
+
+
+
+ Allow rational bsplines
+
+
+
+
+ Create a solid shape
+
+
+
+
+ IsoCurve parameter
+
+
+
+
+ Number of IsoCurve in U direction
+
+
+
+
+ Number of IsoCurve in V direction
+
+
+
+
+ Number of IsoCurve
+
+
+
+
+ Curve Orientation
+
+
+
+
+ List of edges to join
+
+
+
+
+ Join all the edges of this base object
+
+
+
+
+
+
+ Tolerance
+
+
+
+
+ Break on sharp corners
+
+
+
+
+ Force connection of edges
+
+
+
+
+ Force closed curve
+
+
+
+
+ Reverse the output curve
+
+
+
+
+ Set the start point of closed curve
+
+
+
+
+
+ Source object
+
+
+
+
+ Direction Vector
+
+
+
+
+ Number of samples around object
+
+
+
+
+ Edge 1
+
+
+
+
+ Edge 2
+
+
+
+
+ Location on first edge
+
+
+
+
+
+ Reverse Edge
+
+
+
+
+
+
+
+ Scale of blend curve
+
+
+
+
+
+
+
+ Continuity
+
+
+
+
+ Location on second edge
+
+
+
+
+ Poles of the Bezier curve
+
+
+
+
+
+
+ Output type
+
+
+
+
+ Compute scales to get minimal curvature along curve
+
+
+
+
+ Scale (%). 0 for AutoScale
+
+
+
+
+
+
+ Number of samples
+
+
+
+
+ Number of surface samples
+
+
+
+
+ Surface Comb Orientation
+
+
+
+
+ CombPoints
+
+
+
+
+ Shape of comb plot
+
+
+
+
+ Color of the curvature curve
+
+
+
+
+ Color of the curvature comb
+
+
+
+
+ List of constraint objects
+
+
+
+
+ Plate degree
+
+
+
+
+ Number of iterations
+
+
+
+
+ 2D Tolerance
+
+
+
+
+ 3D Tolerance
+
+
+
+
+ Angular Tolerance
+
+
+
+
+ Curvature Tolerance
+
+
+
+
+ Anisotropie
+
+
+
+
+ Max degree of Bspline approximation
+
+
+
+
+ Max Number of surface segments
+
+
+
+
+ Max Distance to plate surface
+
+
+
+
+ 3D Tolerance of Bspline approximation
+
+
+
+
+ Criterion Order
+
+
+
+
+ Desired continuity of the surface
+
+
+
+
+ Enlarge Coefficient
+
+
+
+
+ First support edge
+
+
+
+
+ Second support edge
+
+
+
+
+ Parameter on first edge
+
+
+
+
+ Parameter on second edge
+
+
+
+
+ Main axis of the sketch
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tooltip
+
+
+
+
+ Individual faces
+
+
+
+
+ View position
+
+
+
+
+ View direction
+
+
+
+
+ Up direction
+
+
+
+
+ Remove duplicate edges
+
+
+
+
+ Number of edge samples
+
+
+
+
+ CleaningTolerance for duplicate detection
+
+
+
+
+ Isoparametric lines
+
+
+
+
+ Outline silhouette lines
+
+
+
+
+ smooth edge of G1-continuity between two surfaces
+
+
+
+
+ sewn edge of CN-continuity on one surface
+
+
+
+
+ sharp edge (of C0-continuity)
+
+
+
+
+ Generate the visible lines, or the hidden lines
+
+
+
+
+ Output on-shape 3D lines
+
+
+
+
+ Track camera movements
+
+
+
+
+ The list of profiles to sweep
+
+
+
+
+ The sweep path
+
+
+
+
+ Face support of the sweep path
+
+
+
+
+ Trim the sweep shape
+
+
+
+
+ Add profiles to the sweep shape
+
+
+
+
+ Number of extra profiles
+
+
+
+
+ Build a smooth top with extra profiles
+
+
+
+
+ Input Sketch
+
+
+
+
+ Additional objects that will be mapped on surface
+
+
+
+
+ Make faces from closed wires
+
+
+
+
+ Add extrusion faces
+
+
+
+
+ Offset distance of mapped sketch
+
+
+
+
+ Extrusion thickness
+
+
+
+
+ Reverse U direction
+
+
+
+
+ Reverse V direction
+
+
+
+
+ Swap U and V directions
+
+
+
+
+ include construction geometry in sketch bounds
+
+
+
+
+ Analysis Direction
+
+
+
+
+ Analysis Mode
+
+
+
+
+ Fix analysis direction to global coordinate system
+
+
+
+
+ Number of stripes (Zebra, Rainbow)
+
+
+
+
+ Relative width of stripes (Zebra)
+
+
+
+
+ First color (Zebra, Rainbow, Isophote)
+
+
+
+
+ Second color (Zebra, Rainbow, Isophote)
+
+
+
+
+ Start angle of the rainbow
+
+
+
+
+ End angle of the rainbow
+
+
+
+
+ Angles of isophote curves
+
+
+
+
+ Angular tolerance of isophote curves
+
+
+
+
+ Birail object
+
+
+
+
+ List of profiles
+
+
+
+
+ Blending method
+
+
+
+
+ Parametrization of interpolating curves
+
+
+
+
+
+
+ Profile Samples
+
+
+
+
+ Extend to rail limits
+
+
+
+
+ Shape
+
+
+
+
+ Picked point in parametric space of the face (u,v,0)
+
+
+
+
+ Trimming curve
+
+
+
+
+ Trimming Vector
+
+
+
+
+ Trimming direction
+
+
+
+
+ The object that will be truncated or extended
+
+
+
+
+ The planar object that cuts the Source object
+
+
+
+
+ The distance to truncate (if negative) or extend (if positive)
+
+
+
+
+ Refine shape (clean up redundant edges)
+
+
+
+
+ Reverse cutter plane normal
+
+
+
+
+ Object containing the points to approximate
+
+
+
+
+ Clamp endpoints
+
+
+
+
+ Force a closed curve
+
+
+
+
+
+ Minimum degree of the curve
+
+
+
+
+
+ Maximum degree of the curve
+
+
+
+
+
+ Approximation tolerance
+
+
+
+
+
+ Desired continuity of the curve
+
+
+
+
+ Approximation method
+
+
+
+
+
+
+ Parametrization type
+
+
+
+
+ Weight of curve length for smoothing algorithm
+
+
+
+
+ Weight of curve curvature for smoothing algorithm
+
+
+
+
+ Weight of curve torsion for smoothing algorithm
+
+
+
+
+ Index of first point
+
+
+
+
+ Index of last point (-1 to ignore)
+
+
+
+
+ For closed curves, allows to choose the location of the join point
+
+
+
+
+ Use approximation
+
+
+
+
+ Proxy object of the approximation extension
+
+
+
+
+ Faces to join
+
+
+
+
+ Number of samples to generate each surface
+
+
+
+
+ Fuse the 3 solids together
+
+
+
+
+ Continuity order G... with shape 1
+
+
+
+
+ Continuity order G... with shape 2
+
+
+
+
+
+ Compute scales to get regular poles, or minimal curvature
+
+
+
+
+
+ Number of samples for auto scaling
+
+
+
+
+ Scale values along face 1
+
+
+
+
+ Scale values along face 2
+
+
+
+
+
+ Status of the created shape
+
+
+
+
+ First edge
+
+
+
+
+ Second edge
+
+
+
+
+
+ Placement
+
+
+
+
+ Edge Samples
+
+
+
+
+ Untwist surface
+
+
+
+
+ Variable scale 1: list of vectors(parameter, scale1, 0)
+
+
+
+
+ Variable scale 2: list of vectors(parameter, scale2, 0)
+
+
+
+
+ Edges and support faces
+
+
+
+
+ Number of samples to generate surface
+
+
+
+
+ Continuity level with face of edge 1
+
+
+
+
+ Continuity level with face of edge 2
+
+
+
+
+ Scale values along edge 1
+
+
+
+
+ Scale values along edge 2
+
+
+
+
+ Spring Length
+
+
+
+
+ Diameter of the spring wire
+
+
+
+
+ Diameter of the spring
+
+
+
+
+ Flatness of spring extremities from 0 to 4
+
+
+
+
+ Output a wire shape
+
+
+
+
+ Left hand if true
+
+
+
+
+ The list of seam edges to check
+
+
+
+
+ Number of test samples on edge
+
+
+
+
+ Number of test lines on each sample
+
+
+
+
+ Continuity tolerance
+
+
+
+
+ Input edge to extend
+
+
+
+
+
+ Output shape
+
+
+
+
+ Start Extension Length
+
+
+
+
+ Start Extension type
+
+
+
+
+ End Extension Length
+
+
+
+
+ End Extension type
+
+
+
+
+ Input edge
+
+
+
+
+ Support face
+
+
+
+
+ Reverse tangent
+
+
+
+
+ Reverse normal
+
+
+
+
+ Reverse binormal
+
+
+
+
+ Width of the output face
+
+
+
+
+ Face symmetric across curve
+
+
+
+
+ Close the curve
+
+
+
+
+ Reverse the parametric orientation of the curve
+
+
+
+
+ Curve network
+
+
+
+
+ Max Number of control points
+
+
+
+
+ Number of samples in U direction
+
+
+
+
+ Number of samples in V direction
+
+
+
+
+ Flip surface normal
+
+
+
+
+ Constraint shapes
+
+
+
+
+ Parametrization factor
+
+
+
+
+ Periodic curve
+
+
+
+
+ Data list
+
+
+
+
+ Tangents list
+
+
+
+
+ Tangent flags
+
+
+
+
+ Types of interpolated points
+
+
+
+
+ Linear segment flags
+
+
+
+
+ Size of a grid quadrant
+
+
+
+
+ Size of subdivisions
+
+
+
+
+ XY plane attenuation
+
+
+
+
+ XZ plane attenuation
+
+
+
+
+ YZ plane attenuation
+
+
+
+
+ XY plane max visibility
+
+
+
+
+ XZ plane max visibility
+
+
+
+
+ YZ plane max visibility
+
+
+
+
+ Grid Color
+
+
+
+
+ Source object that provides points to interpolate
+
+
+
+
+ Point list to interpolate
+
+
+
+
+ Set the curve closed
+
+
+
+
+ Interpolation tolerance
+
+
+
+
+ User specified tangents
+
+
+
+
+ interpolate 3 aligned points with a line
+
+
+
+
+ interpolate with a degree 1 polygonal curve
+
+
+
+
+ outputs a wire or a single edge
+
+
+
+
+ Parameters of interpolated points
+
+
+
+
+ Tangents at interpolated points
+
+
+
+
+ Activation flag of tangents
+
+
+
+
+ Face support of the spiral
+
+
+
+
+ Nb of turns between 2 points, in U direction
+
+
+
+
+ Nb of turns between 2 points, in V direction
+
+
+
+
+ First Vertex
+
+
+
+
+ Second Vertex
+
+
+
+
+ First shape
+
+
+
+
+ Second shape
+
+
+
+
+ Projection direction of the first shape.
+If vector is null, shape's placement is used.
+
+
+
+
+ Projection direction of the second shape.
+If vector is null, shape's placement is used.
+
+
+
+
+ Build ruled surfaces between Shape1 and resulting Mixed-Curve
+
+
+
+
+ Build ruled surfaces between Shape2 and resulting Mixed-Curve
+
+
+
+
+ Objects to loft
+
+
+
+
+ Ruled Loft
+
+
+
+
+ Close loft
+
+
+
+
+ Max Bspline degree
+
+
+
+
+ List of faces to build the solid
+
+
+
+
+ If the output shape in not a solid, this will output the open edges
+
+
+
+
+ Sweep path
+
+
+
+
+ Profiles that are swept along spine
+
+
+
+
+ Shape of the ShapeSupport mode
+
+
+
+
+ Auxiliary spine
+
+
+
+
+ PipeShell mode
+
+
+
+
+ Make solid object
+
+
+
+
+ Maximum degree of the generated surface
+
+
+
+
+ Maximum number of segments of the generated surface
+
+
+
+
+ Number of samples for preview
+
+
+
+
+ Tolerance 3D
+
+
+
+
+ Tolerance boundary
+
+
+
+
+ Tolerance angular
+
+
+
+
+ Direction of the Binormal and FixedTrihedron modes
+
+
+
+
+ Location of the FixedTrihedron mode
+
+
+
+
+ Corrected Frenet
+
+
+
+
+ Curvilinear equivalence
+
+
+
+
+ Type of contact to auxiliary spine
+
+
+
+
+
+ SubShapes of the profile
+
+
+
+
+ source object of the profile
+
+
+
+
+
+
+
+ Vertex location on spine
+
+
+
+
+ Translate profile to contact spine
+
+
+
+
+ Rotate profile to be orthogonal to spine
+
+
+
+
+ Initial Face
+
+
+
+
+ Option list
+
+
+
+
+ Segmenting direction
+
+
+
+
+ Splitting parameters in U direction
+
+
+
+
+ Splitting parameters in V direction
+
+
+
+
+ Split the U parameter range in the given number of segments
+
+
+
+
+ Split the V parameter range in the given number of segments
+
+
+
+
+ Object generating normalized parameters in U direction
+
+
+
+
+ Object generating normalized parameters in V direction
+
+
+
+
+ Edge to split
+
+
+
+
+ List of splitting locations
+% and units are allowed
+Negative values are computed from edge end
+
+
+
+
+ Number of equal segments
+
+
+
+
+ List of objects that cut the curve
+
+
+
+
+ Create a split point at nearest of each vertex of the cutting objects
+
+
+
+
+ Expression-ready distance value
+
+
+
+
+ Rebuild and output the complete shape
+
+
+
+
+ CurveEditor
+
+
+ Curve Editor
+
+
+
+
+ Curve Type :
+
+
+
+
+ Bezier
+
+
+
+
+ Degree
+
+
+
+
+ OK
+
+
+
+
+ Cancel
+
+
+
+
+ Curves_AdjacentFaces
+
+
+ Select Adjacent faces
+
+
+
+
+ Select the Adjacent faces of the selected subshape
+
+
+
+
+ Select a face or an edge in the 3D View, activate tool
+and all the faces that touch it will be added to the selection.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_Approximate
+
+
+ Approximate
+
+
+
+
+ Approximate points to NURBS curve or surface
+
+
+
+
+ Curves_BlendSolid
+
+
+ BlendSolid
+
+
+
+
+ Create a solid between two faces with some continuity with their support shapes
+
+
+
+
+ Select a face on each of the two solids to blend, in the 3D View.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_BlendSurf2
+
+
+ BlendSurface
+
+
+
+
+ Create a surface between two edges with some continuity with their support faces
+
+
+
+
+ You must select 4 subshapes in the 3D View :
+- EDGE1 on FACE1
+- EDGE2 on FACE2
+
+
+
+
+ Usage
+
+
+
+
+ Curves_BsplineToConsole
+
+
+ Creates a python script to build the selected BSpline or Bezier geometries.
+
+
+
+
+ Select some Bezier or BSpline curves or surfaces in the 3D View and activate the tool.
+The selected curves or surfaces will be re-created with commands in the python console.
+
+
+
+
+ BSpline to Console
+
+
+
+
+ Usage
+
+
+
+
+ Curves_CurveOnSurface
+
+
+ CurveOnSurface
+
+
+
+
+ Create a curve on surface object
+
+
+
+
+ Curves_Discretize
+
+
+ Discretize
+
+
+
+
+ Discretize an edge or a wire.
+
+
+
+
+ Select an edge in the 3D View
+Activate tool
+It will generate some points along the edge, following various methods
+
+
+
+
+ Usage
+
+
+
+
+ Curves_EditableSpline
+
+
+ Freehand BSpline
+
+
+
+
+ Creates an freehand BSpline curve
+
+
+
+
+ *** Interpolation curve control keys :
+
+ a - Select all / Deselect
+ i - Insert point in selected segments
+ t - Set / unset tangent (view direction)
+ p - Align selected objects
+ s - Snap points on shape / Unsnap
+ l - Set/unset a linear interpolation
+ x,y,z - Axis constraints during grab
+ q - Apply changes and quit editing
+
+
+
+
+ Usage
+
+
+
+
+ Curves_ExtendCurve
+
+
+ Curve extend
+
+
+
+
+ Extend an edge by a given distance.
+
+
+
+
+ Select an edge in the 3D View, and activate tool.
+Edge can be extended at each end, by a given distance.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_ExtractSubshape
+
+
+ Extract subshape
+
+
+
+
+ Make a non-parametric copy of selected subshapes.
+Same as Part_ElementCopy
+
+
+
+
+ Curves_FlattenFace
+
+
+ Flatten face
+
+
+
+
+ Creates a flat developed face from conical and cylindrical faces
+
+
+
+
+ You must select a conical or cylindrical face in the 3D View.
+InPlace property puts the unrolled face tangent to the source face (InPlace = True)
+or in the XY plane (InPlace = False)
+
+
+
+
+ Usage
+
+
+
+
+ Curves_GeometryInfo
+
+
+ GeomInfo
+
+
+
+
+ Display geometry information about selected shape
+
+
+
+
+ While active, this tool displays information about the geometry of an edge or face.
+It displays poles, knots and weights of Bezier and BSpline curves and surfaces in the 3D View.
+
+
+
+
+ Curves_Interpolate
+
+
+ Interpolate
+
+
+
+
+ Interpolate a set of points.
+
+
+
+
+ Curves_JoinCurve
+
+
+ joinCurves
+
+
+
+
+ Joins the selected edges into a BSpline Curve
+
+
+
+
+ Select the edges to join in the 3D View, or select an object containing multiple edges in the Tree View.
+Activate the tool.
+The output is a single BSpline curve joining all selected edges.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_Line
+
+
+ Parametric line
+
+
+
+
+ Parametric line between two vertexes.
+
+
+
+
+ Select 2 vertexes in the 3D View and activate the tool.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_MixedCurve
+
+
+ Mixed curve
+
+
+
+
+ Builds a 3D curve as the intersection of 2 projected curves.
+
+
+
+
+ Select two objects or shapes, and activate tool.
+The camera direction is saved during each shape selection, and will be used as projection direction.
+Set these directions to (0,0,0) to use the placement of each shape as projection direction.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_ObjectsToConsole
+
+
+ Objects to Console
+
+
+
+
+ Give access to the selected objects in the python console.
+
+
+
+
+ Select some objects in the TreeView, or in the 3D View, and activate tool.
+Some variables will be created in the python console, to access the selection.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_ParametricBlendCurve
+
+
+ Blend curve
+
+
+
+
+ Blend curve between two edges. Double-clic object to enable/disable freehand mouse editing.
+
+
+
+
+ Curves_ParametricComb
+
+
+ Comb plot
+
+
+
+
+ Creates a parametric Comb plot on selected edges
+
+
+
+
+ Curves_ParametricSolid
+
+
+ Parametric solid
+
+
+
+
+ Make a parametric solid from selected faces.
+
+
+
+
+ Select some faces in the 3D View, or select objects in the Tree View.
+Activate tool.
+It will try to build a solid from selected faces.
+If not possible, it falls back to a shell, then to a compound.
+The ShapeStatus property (and the color of the icon) give the type of shape.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_PasteSVG
+
+
+ Paste SVG
+
+
+
+
+ Paste the SVG content of the clipboard
+
+
+
+
+ When working in parallel with FreeCAD and a SVG editor (Inkscape),
+copy (CTRL-C) an object in the SVG editor, switch to FreeCAD and activate tool.
+This will import the SVG content of the clipboard into the active FreeCAD document.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_ReflectLines
+
+
+ Reflect Lines
+
+
+
+
+ Creates the reflect lines on a shape, according to a view direction
+
+
+
+
+ Select an object and activate tool.
+This will create reflect lines according to the current view direction.
+If selected object is a ReflectLines object, the view direction will be updated to the current camera direction.
+If property OnShape is True, the lines will be ON the input shape (ViewPos and UpDir properties won't be used).
+Otherwise, lines will be on the XY plane.
+If view property TrackCam is True, the view direction will keep updating upon camera movements.
+
+
+
+
+
+ Usage
+
+
+
+
+ Curves_RotationSweep
+
+
+ Rotation Sweep
+
+
+
+
+ Sweep some profiles along a path, and around a point
+
+
+
+
+ Select a sweep path and some profiles in the 3D View.
+If TrimPath is False, the Sweep surface will be extrapolated to fit the whole path.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_SegmentSurface
+
+
+ Segment surface
+
+
+
+
+ Segment a surface on isocurves
+
+
+
+
+ Select a face in the 3D view and activate tool.
+The face will be converted to a BSpline surface.
+In Auto mode, the surface will be segmented along isocurves of highest multiplicity.
+In Custom mode, it will be segmented along isocurves of specified parameters.
+These parameters can be provided by an external object that have a NormalizedParameters property,
+like the Discretize, or the SplitCurve tools.
+
+
+
+
+ Usage
+
+
+
+
+ Curves_SplitCurve
+
+
+ Split curve
+
+
+
+
+ Splits the selected edge
+
+
+
+
+ Select an edge in the 3D View, or an object containing a wire in the Tree View
+Activate Tool
+The selected edges (or wire) will be cut at the specified location.
+The split locations can be given as real edge parameter, absolute distance(mm) or relative distance (%)
+The split locations can be set by proximity to cutting objects.
+Double-click in Tree-View to toggle Freehand editor in 3D View.
+
+
+
+
+
+ Usage
+
+
+
+
+ Curves_Trim
+
+
+ Trim face
+
+
+
+
+ Trim a face with a projected curve
+
+
+
+
+ Curves_ZebraTool
+
+
+ ZebraTool
+
+
+
+
+ Zebra texture for surface inspection
+
+
+
+
+ Log
+
+
+
+
+
+BSplineCurve
+
+
+
+
+
+
+ Degree: {}
+
+
+
+
+
+
+ NbPoles: {}
+
+
+
+
+
+
+ Knots: {} ({:0.2f} - {:0.2f})
+
+
+
+
+
+
+ Mults: {}
+
+
+
+
+
+
+ Periodic: {}
+
+
+
+
+
+
+
+
+BSplineSurface
+************
+
+
+
+
+
+
+
+
+ Failed to compute uIso curve
+
+
+
+
+
+
+
+
+ Failed to compute vIso curve
+
+
+
+
+
+
+
+ ************
+
+
+
+
+
+
+
+ {}
+
+
+
+
+
+
+
+
+
+ Error in onDelete: {0}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {} :
+{}
+
+
+
+
+
+ InterpolationPolygon : bad input
+
+
+
+
+
+
+
+
+
+ Select something first !
+
+
+
+
+
+ Bad input :{}-{}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ BlendCurve: Install 'scipy' python package for AutoScale feature
+
+
+
+
+
+
+ pointEditor : bad input
+
+
+
+
+ --- Entering Comb Edit Mode ---
+
+
+
+
+
+ Nb of samples : CTRL + Mouse Up / Down
+
+
+
+
+
+ Comb scale : SHIFT + Mouse Up / Down
+
+
+
+
+
+ --- Exiting Comb Edit Mode ---
+
+
+
+
+
+ Periodic interpolation
+
+
+
+
+
+ Ignoring duplicate last point
+
+
+
+
+
+ Duplicates point list
+
+
+
+
+
+ Parameters are not increasing
+
+
+
+
+
+ Falling back to ChordLength
+
+
+
+
+
+
+ Select 2 edges or vertexes first !
+
+
+
+
+
+ Select 2 rail objects, and optionally some profile objects
+
+
+
+
+
+ Select an object first !
+
+
+
+
+
+ Sketch on surface : failed to create solid # {}.
+
+
+
+
+
+ Please select a face (in the 3D view) or a sketch
+
+
+
+
+
+ Select a ruled surface and a list of profile edges
+
+
+
+
+
+ Select 2 rails and at least 2 profiles
+
+
+
+
+
+ Failed importing BOPTools. Fallback to Part API
+
+
+
+
+
+ Wrong Selection
+
+
+
+
+
+ Zebra already active
+
+
+
+
+
+ CurvesWB._utils.getShape: wrong property type.
+
+
+
+
+
+
+Please select an object that has at least 2 vertexes
+
+
+
+
+ BlendSolid : The two faces must have the same number of edges
+
+
+
+
+
+ BlendSurface : failed to compute scale
+{}
+
+
+
+
+
+ Select 2 CurveOnSurface objects.
+
+
+
+
+
+
+
+ failed to extract 2D geometry
+
+
+
+
+ Segmenting input curve
+
+
+
+
+
+ Select the edges to extend first !
+
+
+
+
+
+ Curve_on_surface.get_cross_curve : parameter out of range
+
+
+
+
+
+ {} is not in [{},{}]
+
+
+
+
+
+ {} - {}
+
+
+
+
+
+
+ Select an edge and its supporting face
+
+
+
+
+
+ ---
+
+
+
+
+
+
+
+ exchange UV
+
+
+
+
+
+ reverse U
+
+
+
+
+
+ reverse V
+
+
+
+
+
+ Inserting flat profile at 0.0
+
+
+
+
+
+ Inserting flat profile at 1.0
+
+
+
+
+
+ Select a curve network !
+
+
+
+
+
+ Gordon Profile : Data and DataType mismatch
+
+
+
+
+
+ execute is disabled during editing
+
+
+
+
+
+ {} : Not enough points
+
+
+
+
+
+ object has subobjects {}
+
+
+
+
+
+
+Please select an object that has at least 2 vertexes
+
+
+
+
+
+
+ Error. Not a face
+
+
+
+
+ Direction error
+
+
+
+
+ Parameter error
+
+
+
+
+
+ No intersection points
+
+
+
+
+
+ {} broken !
+
+
+
+
+
+ Projection: several pcurves
+
+
+
+
+ pcurve should be closed
+
+
+
+
+ Select 2 objects !
+
+
+
+
+
+
+
+ U degree mismatch error
+
+
+
+
+
+
+
+ V degree mismatch error
+
+
+
+
+
+
+ U parameter ranges mismatch error
+
+
+
+
+
+
+ V parameter ranges mismatch error
+
+
+
+
+
+ U KnotSequence mismatch error
+
+
+
+
+
+ V KnotSequence mismatch error
+
+
+
+
+
+ EdgeInterpolator input must be edge or wire
+
+
+
+
+ Bad type of data
+
+
+
+
+ Argument must be list or tuple
+
+
+
+
+
+Sorry, ContactOnBorder option is currently broken in OCCT.
+
+
+
+
+
+
+Wrong direction, defaulting to +Z
+
+
+
+
+
+
+Direction has null length, defaulting to +Z
+
+
+
+
+
+
+Please set a valid Auxiliary Spine Object
+
+
+
+
+
+
+Please set a valid Spine support Object
+
+
+
+
+
+
+Failed to create shape
+
+
+
+
+
+
+You must select:
+- in the 3D view, the edges that build the sweep path
+- in the Tree view, one or more 'pipeshellProfile' objects
+
+
+
+
+
+
+Failed to build wire
+
+
+
+
+
+
+Failed to extract edges
+
+
+
+
+
+ Select at least 1 edge !
+
+
+
+
+
+ InterpoCurveEditor : bad input
+
+
+
+
+ Snapped to {}
+
+
+
+
+
+ Snapped to Vertex
+
+
+
+
+
+ Snapped to Edge
+
+
+
+
+
+ Snapped to Face
+
+
+
+
+
+ Not snapped
+
+
+
+
+
+ Subdividing line #{}
+
+
+
+
+
+ VPEditor has no widget !
+
+
+
+
+
+ VPEditor.Quit()
+
+
+
+
+
+ Failed to remove from ComboView
+
+
+
+
+
+ SplitCurve : Input shape has no wires or edges
+
+
+
+
+
+ Split curve : failed to build temp Wire !
+
+
+
+
+ Split curve : Invalid Wire !
+
+
+
+
+ Nothing selected !
+
+
+
+
+
+ This property accept only 1 subobject !
+
+
+
+
+
+ Select 1 object !
+
+
+
+
+
+ Workbench
+
+
+
+
+
+
+ Curves
+
+
+
+
+ a workbench dedicated to curves and surfaces
+
+
+
+
+
+ Surfaces
+
+
+
+
+
+ Misc.
+
+
+
+
+ Zebra
+
+
+ Zebra Stripes Tool
+
+
+
+
+ Black Stripes Width
+
+
+
+
+ Scale
+
+
+
+
+ Rotation
+
+
+
+
+ Quit
+
+
+
+
diff --git a/freecad/Curves/resources/translations/README.md b/freecad/Curves/resources/translations/README.md
new file mode 100644
index 0000000..1012bfe
--- /dev/null
+++ b/freecad/Curves/resources/translations/README.md
@@ -0,0 +1,116 @@
+# About translating Curves Workbench
+
+
+- [About translating Curves Workbench](#about-translating-curves-workbench)
+ - [Updating translations template file](#updating-translations-template-file)
+ - [Creating file for missing locale](#creating-file-for-missing-locale)
+ - [Using script](#using-script)
+ - [Renaming file](#renaming-file)
+ - [Translating](#translating)
+ - [Compiling translations](#compiling-translations)
+ - [Sending translations](#sending-translations)
+ - [More information](#more-information)
+
+
+> [!NOTE]
+> All commands **must** be run in `./freecad/Curves/resources/translations/` directory.
+
+> [!IMPORTANT]
+> If you want to update/release the files you need to have installed
+> `lupdate` and `lrelease` from Qt6 version. Using the versions from
+> Qt5 is not advised because they're buggy.
+
+## Updating translations template file
+
+To update the template file from source files you should use this command:
+
+```shell
+./update_translation.sh -U
+```
+
+Once done you can commit the changes and upload the new file to CrowdIn platform
+at webpage and find the **Curves** project.
+
+## Creating file for missing locale
+
+### Using script
+
+To create a file for a new language with all **Curves** translatable strings execute
+the script with `-u` flag plus your locale:
+
+```shell
+./update_translation.sh -u fr
+```
+
+### Renaming file
+
+Also you can rename new `Curves.ts` file by appending the locale code,
+for example, `Curves_fr.ts` for French and change
+
+```xml
+
+```
+
+to
+
+```xml
+
+```
+
+As of 15/10/2024 the supported locales on FreeCAD
+(according to `FreeCADGui.supportedLocales()`) are 44:
+
+```python
+{'English': 'en', 'Afrikaans': 'af', 'Arabic': 'ar', 'Basque': 'eu',
+'Belarusian': 'be', 'Bulgarian': 'bg', 'Catalan': 'ca',
+'Chinese Simplified': 'zh-CN', 'Chinese Traditional': 'zh-TW', 'Croatian': 'hr',
+'Czech': 'cs', 'Danish': 'da', 'Dutch': 'nl', 'Filipino': 'fil', 'Finnish': 'fi',
+ 'French': 'fr', 'Galician': 'gl', 'Georgian': 'ka', 'German': 'de', 'Greek': 'el',
+ 'Hungarian': 'hu', 'Indonesian': 'id', 'Italian': 'it', 'Japanese': 'ja',
+ 'Kabyle': 'kab', 'Korean': 'ko', 'Lithuanian': 'lt', 'Norwegian': 'no',
+ 'Polish': 'pl', 'Portuguese': 'pt-PT', 'Portuguese, Brazilian': 'pt-BR',
+ 'Romanian': 'ro', 'Russian': 'ru', 'Serbian': 'sr', 'Serbian, Latin': 'sr-CS',
+ 'Slovak': 'sk', 'Slovenian': 'sl', 'Spanish': 'es-ES', 'Spanish, Argentina': 'es-AR',
+'Swedish': 'sv-SE', 'Turkish': 'tr', 'Ukrainian': 'uk', 'Valencian': 'val-ES',
+'Vietnamese': 'vi'}
+```
+
+## Translating
+
+To edit your language file open your file in `Qt Linguist` from `qt5-tools`/`qt6-tools`
+package or in a text editor like `xed`, `mousepad`, `gedit`, `nano`, `vim`/`nvim`,
+`geany` etc. and translate it.
+
+Alternatively you can visit the **FreeCAD-addons** project on CrowdIn platform
+at webpage and find your language,
+once done, look for the **Curves** project.
+
+## Compiling translations
+
+To convert all `.ts` files to `.qm` files (merge) you can use this command:
+
+```shell
+./update_translation.sh -R
+```
+
+If you are a translator that wants to update only their language file
+to test it on **FreeCAD** before doing a PR you can use this command:
+
+```shell
+./update_translation.sh -r fr
+```
+
+This will update the `.qm` file for your language (French in this case).
+
+## Sending translations
+
+Now you can contribute your translated `.ts` file to **Curves** repository,
+also include the `.qm` file.
+
+
+
+## More information
+
+You can read more about translating external workbenches here:
+
+
diff --git a/freecad/Curves/resources/translations/update_translation.sh b/freecad/Curves/resources/translations/update_translation.sh
new file mode 100755
index 0000000..327b072
--- /dev/null
+++ b/freecad/Curves/resources/translations/update_translation.sh
@@ -0,0 +1,142 @@
+#!/usr/bin/env bash
+
+# --------------------------------------------------------------------------------------------------
+#
+# Create, update and release translation files.
+#
+# Supported locales on FreeCAD <2024-10-15, FreeCADGui.supportedLocales(), total=44>:
+# {'English': 'en', 'Afrikaans': 'af', 'Arabic': 'ar', 'Basque': 'eu', 'Belarusian': 'be',
+# 'Bulgarian': 'bg', 'Catalan': 'ca', 'Chinese Simplified': 'zh-CN',
+# 'Chinese Traditional': 'zh-TW', 'Croatian': 'hr', 'Czech': 'cs', 'Danish': 'da',
+# 'Dutch': 'nl', 'Filipino': 'fil', 'Finnish': 'fi', 'French': 'fr', 'Galician': 'gl',
+# 'Georgian': 'ka', 'German': 'de', 'Greek': 'el', 'Hungarian': 'hu', 'Indonesian': 'id',
+# 'Italian': 'it', 'Japanese': 'ja', 'Kabyle': 'kab', 'Korean': 'ko', 'Lithuanian': 'lt',
+# 'Norwegian': 'no', 'Polish': 'pl', 'Portuguese': 'pt-PT', 'Portuguese, Brazilian': 'pt-BR',
+# 'Romanian': 'ro', 'Russian': 'ru', 'Serbian': 'sr', 'Serbian, Latin': 'sr-CS', 'Slovak': 'sk',
+# 'Slovenian': 'sl', 'Spanish': 'es-ES', 'Spanish, Argentina': 'es-AR', 'Swedish': 'sv-SE',
+# 'Turkish': 'tr', 'Ukrainian': 'uk', 'Valencian': 'val-ES', 'Vietnamese': 'vi'}
+#
+# NOTE: PREPARATION
+# - Install Qt tools
+# Debian-based (e.g., Ubuntu): $ sudo apt-get install qttools5-dev-tools pyqt6-dev-tools
+# Fedora-based: $ sudo dnf install qt6-linguist qt6-devel
+# Arch-based: $ sudo pacman -S qt6-tools python-pyqt6
+# - Make the script executable
+# $ chmod +x update_translation.sh
+# - The script has to be executed within the `freecad/freegrid/resources/translations` directory.
+# Executing the script with no flags invokes the help.
+# $ ./update_translation.sh
+#
+# NOTE: WORKFLOW TRANSLATOR (LOCAL)
+# - Execute the script passing the `-u` flag plus locale code as argument
+# Only update the file(s) you're translating!
+# $ ./update_translation.sh -u es-ES
+# - Do the translation via Qt Linguist and use `File>Release`
+# - If releasing with the script execute it passing the `-r` flag
+# plus locale code as argument
+# $ ./update_translation.sh -r es-ES
+#
+# NOTE: WORKFLOW MAINTAINER (CROWDIN)
+# - Execute the script passing the '-U' flag
+# $ ./update_translation.sh -U
+# - Once done, download the translated files, copy them to `freecad/freegrid/resources/translations`
+# - Upload the updated file to CrowdIn and wait for translators do their thing ;-)
+# and release all the files to update the changes
+# $ ./update_translation.sh -R
+#
+# --------------------------------------------------------------------------------------------------
+
+supported_locales=(
+ "en" "af" "ar" "eu" "be" "bg" "ca" "zh-CN" "zh-TW" "hr"
+ "cs" "da" "nl" "fil" "fi" "fr" "gl" "ka" "de" "el"
+ "hu" "id" "it" "ja" "kab" "ko" "lt" "no" "pl" "pt-PT"
+ "pt-BR" "ro" "ru" "sr" "sr-CS" "sk" "sl" "es-ES" "es-AR" "sv-SE"
+ "tr" "uk" "val-ES" "vi"
+)
+
+is_locale_supported() {
+ local locale="$1"
+ for supported_locale in "${supported_locales[@]}"; do
+ [ "$supported_locale" == "$locale" ] && return 0
+ done
+ return 1
+}
+
+update_locale() {
+ local locale="$1"
+ local u=${locale:+_} # Conditional underscore
+ FILES="../../*.py ../../Blending/*.py \
+ ../../DraftAnalysis_shaders/*.py \
+ ../../Gui/*.ui"
+
+ # NOTE: Execute the right command depending on:
+ # - if it's a locale file or the main, agnostic one
+ [ ! -f "${WB}${u}${locale}.ts" ] && action="Creating" || action="Updating"
+ echo -e "\033[1;34m\n\t<<< ${action} '${WB}${u}${locale}.ts' file >>>\n\033[m"
+ if [ "$u" == "" ]; then
+ eval $LUPDATE "$FILES" -ts "${WB}.ts" # locale-agnostic file
+ else
+ eval $LUPDATE "$FILES" -source-language en_US -target-language "${locale//-/_}" \
+ -ts "${WB}_${locale}.ts"
+ fi
+}
+
+help() {
+ echo -e "\nDescription:"
+ echo -e "\tCreate, update and release translation files."
+ echo -e "\nUsage:"
+ echo -e "\t./update_translation.sh [-R] [-U] [-r ] [-u ]"
+ echo -e "\nFlags:"
+ echo -e " -R\n\tRelease all locales"
+ echo -e " -U\n\tUpdate main translation file (locale agnostic)"
+ echo -e " -r \n\tRelease the specified locale"
+ echo -e " -u \n\tUpdate strings for the specified locale"
+}
+
+# Main function ------------------------------------------------------------------------------------
+
+LUPDATE=/usr/lib/qt6/bin/lupdate # from Qt6
+# LUPDATE=lupdate # from Qt5
+LRELEASE=/usr/lib/qt6/bin/lrelease # from Qt6
+# LRELEASE=lrelease # from Qt5
+WB="Curves"
+
+# Enforce underscore on locales
+sed -i '3s/-/_/' ${WB}*.ts
+
+if [ $# -eq 1 ]; then
+ if [ "$1" == "-R" ]; then
+ find . -type f -name '*_*.ts' | while IFS= read -r file; do
+ # Release all locales
+ $LRELEASE "$file"
+ echo
+ done
+ elif [ "$1" == "-U" ]; then
+ # Update main file (agnostic)
+ update_locale
+ else
+ help
+ fi
+elif [ $# -eq 2 ]; then
+ LOCALE="$2"
+ if is_locale_supported "$LOCALE"; then
+ if [ "$1" == "-r" ]; then
+ # Release locale (creation of *.qm file from *.ts file)
+ $LRELEASE "${WB}_${LOCALE}.ts"
+ elif [ "$1" == "-u" ]; then
+ # Update main & locale files
+ update_locale
+ update_locale "$LOCALE"
+ fi
+ else
+ echo "Verify your language code. Case sensitive."
+ echo "If it's correct, ask a maintainer to add support for your language on FreeCAD."
+ echo -e "\nSupported locales, '\033[1;34mFreeCADGui.supportedLocales()\033[m': \033[1;33m"
+ for locale in $(printf "%s\n" "${supported_locales[@]}" | sort); do
+ echo -n "$locale "
+ done
+ echo
+ fi
+else
+ help
+fi
diff --git a/freecad/Curves/segmentSurfaceFP.py b/freecad/Curves/segmentSurfaceFP.py
index 99df389..5b6ae1c 100644
--- a/freecad/Curves/segmentSurfaceFP.py
+++ b/freecad/Curves/segmentSurfaceFP.py
@@ -1,19 +1,26 @@
# -*- coding: utf-8 -*-
-__title__ = "Segment surface"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_SegmentSurface", "Segment surface")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = """Segment a surface on isocurves"""
-__usage__ = """Select a face in the 3D view and activate tool.
+__doc__ = translate("Curves_SegmentSurface", "Segment a surface on isocurves")
+__usage__ = translate(
+ "Curves_SegmentSurface",
+ """Select a face in the 3D view and activate tool.
The face will be converted to a BSpline surface.
In Auto mode, the surface will be segmented along isocurves of highest multiplicity.
In Custom mode, it will be segmented along isocurves of specified parameters.
These parameters can be provided by an external object that have a NormalizedParameters property,
-like the Discretize, or the SplitCurve tools."""
+like the Discretize, or the SplitCurve tools.""",
+)
import os
-import FreeCAD
import FreeCADGui
import Part
from . import ICONPATH
@@ -27,15 +34,68 @@ class SegmentSurface:
def __init__(self, obj, face):
"""Add the properties"""
- obj.addProperty("App::PropertyLinkSub", "Source", "Base", "Initial Face").Source = face
- obj.addProperty("App::PropertyEnumeration", "Option", "Base", "Option list").Option = ["Auto", "Custom"]
- obj.addProperty("App::PropertyEnumeration", "Direction", "OptionAuto", "Segmenting direction").Direction = ["U", "V", "Both"]
- obj.addProperty("App::PropertyFloatList", "KnotsU", "UDirection", "Splitting parameters in U direction")
- obj.addProperty("App::PropertyFloatList", "KnotsV", "VDirection", "Splitting parameters in V direction")
- obj.addProperty("App::PropertyInteger", "NumberU", "UDirection", "Split the U parameter range in the given number of segments").NumberU = 2
- obj.addProperty("App::PropertyInteger", "NumberV", "VDirection", "Split the V parameter range in the given number of segments").NumberV = 2
- obj.addProperty("App::PropertyLink", "KnotsUProvider", "UDirection", "Object generating normalized parameters in U direction")
- obj.addProperty("App::PropertyLink", "KnotsVProvider", "VDirection", "Object generating normalized parameters in V direction")
+ obj.addProperty(
+ "App::PropertyLinkSub",
+ "Source",
+ "Base",
+ QT_TRANSLATE_NOOP("App::Property", "Initial Face"),
+ ).Source = face
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Option",
+ "Base",
+ QT_TRANSLATE_NOOP("App::Property", "Option list"),
+ ).Option = ["Auto", "Custom"]
+ obj.addProperty(
+ "App::PropertyEnumeration",
+ "Direction",
+ "OptionAuto",
+ QT_TRANSLATE_NOOP("App::Property", "Segmenting direction"),
+ ).Direction = ["U", "V", "Both"]
+ obj.addProperty(
+ "App::PropertyFloatList",
+ "KnotsU",
+ "UDirection",
+ QT_TRANSLATE_NOOP("App::Property", "Splitting parameters in U direction"),
+ )
+ obj.addProperty(
+ "App::PropertyFloatList",
+ "KnotsV",
+ "VDirection",
+ QT_TRANSLATE_NOOP("App::Property", "Splitting parameters in V direction"),
+ )
+ obj.addProperty(
+ "App::PropertyInteger",
+ "NumberU",
+ "UDirection",
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Split the U parameter range in the given number of segments"
+ ),
+ ).NumberU = 2
+ obj.addProperty(
+ "App::PropertyInteger",
+ "NumberV",
+ "VDirection",
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Split the V parameter range in the given number of segments"
+ ),
+ ).NumberV = 2
+ obj.addProperty(
+ "App::PropertyLink",
+ "KnotsUProvider",
+ "UDirection",
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Object generating normalized parameters in U direction"
+ ),
+ )
+ obj.addProperty(
+ "App::PropertyLink",
+ "KnotsVProvider",
+ "VDirection",
+ QT_TRANSLATE_NOOP(
+ "App::Property", "Object generating normalized parameters in V direction"
+ ),
+ )
obj.Proxy = self
obj.Option = "Custom"
@@ -203,7 +263,7 @@ def makeFeature(self, s):
def Activated(self):
sel = FreeCADGui.Selection.getSelectionEx()
if sel == []:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
else:
self.makeFeature(sel[0])
@@ -214,9 +274,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('segment_surface', SegSurfCommand())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_SegmentSurface", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_SegmentSurface", SegSurfCommand())
diff --git a/freecad/Curves/splitCurves_2.py b/freecad/Curves/splitCurves_2.py
index 2121e1f..e5cda9c 100644
--- a/freecad/Curves/splitCurves_2.py
+++ b/freecad/Curves/splitCurves_2.py
@@ -1,20 +1,27 @@
# -*- coding: utf-8 -*-
-__title__ = "Split curve"
+import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_SplitCurve", "Split curve")
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
-__doc__ = "Splits the selected edge"
-__usage__ = """Select an edge in the 3D View, or an object containing a wire in the Tree View
+__doc__ = translate("Curves_SplitCurve", "Splits the selected edge")
+__usage__ = translate(
+ "Curves_SplitCurve",
+ """Select an edge in the 3D View, or an object containing a wire in the Tree View
Activate Tool
The selected edges (or wire) will be cut at the specified location.
The split locations can be given as real edge parameter, absolute distance(mm) or relative distance (%)
The split locations can be set by proximity to cutting objects.
Double-click in Tree-View to toggle Freehand editor in 3D View.
-"""
+""",
+)
import os
-import FreeCAD
import FreeCADGui
import Part
from freecad.Curves import _utils
@@ -34,38 +41,60 @@ class split:
"""Splits the selected edge."""
def __init__(self, obj, e):
obj.Proxy = self
- obj.addProperty("App::PropertyLinkSub",
- "Source",
- "Base",
- "Edge to split").Source = e
- obj.addProperty("App::PropertyStringList",
- "Values",
- "Split",
- "List of splitting locations\n% and units are allowed\nNegative values are computed from edge end")
- obj.addProperty("App::PropertyInteger",
- "Number",
- "Split",
- "Number of equal segments").Number = 2
- obj.addProperty("App::PropertyLinkList",
- "CuttingObjects",
- "Split",
- "List of objects that cut the curve")
- obj.addProperty("App::PropertyBool",
- "CutAtVertexes",
- "Split",
- "Create a split point at nearest of each vertex of the cutting objects")
- obj.addProperty("App::PropertyDistance",
- "Distance",
- "Split",
- "Expression-ready distance value")
- obj.addProperty("App::PropertyFloatList",
- "NormalizedParameters",
- "Output",
- "Normalized parameters list")
- obj.addProperty("App::PropertyBool",
- "KeepSolid",
- "Split",
- "Rebuild and output the complete shape")
+ obj.addProperty(
+ "App::PropertyLinkSub",
+ "Source",
+ "Base",
+ QT_TRANSLATE_NOOP("App::Property", "Edge to split"),
+ ).Source = e
+ obj.addProperty(
+ "App::PropertyStringList",
+ "Values",
+ "Split",
+ QT_TRANSLATE_NOOP(
+ "App::Property",
+ "List of splitting locations\n% and units are allowed\nNegative values are computed from edge end",
+ ),
+ )
+ obj.addProperty(
+ "App::PropertyInteger",
+ "Number",
+ "Split",
+ QT_TRANSLATE_NOOP("App::Property", "Number of equal segments"),
+ ).Number = 2
+ obj.addProperty(
+ "App::PropertyLinkList",
+ "CuttingObjects",
+ "Split",
+ QT_TRANSLATE_NOOP("App::Property", "List of objects that cut the curve"),
+ )
+ obj.addProperty(
+ "App::PropertyBool",
+ "CutAtVertexes",
+ "Split",
+ QT_TRANSLATE_NOOP(
+ "App::Property",
+ "Create a split point at nearest of each vertex of the cutting objects",
+ ),
+ )
+ obj.addProperty(
+ "App::PropertyDistance",
+ "Distance",
+ "Split",
+ QT_TRANSLATE_NOOP("App::Property", "Expression-ready distance value"),
+ )
+ obj.addProperty(
+ "App::PropertyFloatList",
+ "NormalizedParameters",
+ "Output",
+ QT_TRANSLATE_NOOP("App::Property", "Normalized parameters list"),
+ )
+ obj.addProperty(
+ "App::PropertyBool",
+ "KeepSolid",
+ "Split",
+ QT_TRANSLATE_NOOP("App::Property", "Rebuild and output the complete shape"),
+ )
obj.setEditorMode("NormalizedParameters", 2)
def getShape(self, fp):
@@ -83,7 +112,7 @@ def getShape(self, fp):
e = fp.Source[0].Shape.Edge1
w = None
else:
- FreeCAD.Console.PrintError("SplitCurve : Input shape has no wires or edges\n")
+ FreeCAD.Console.PrintError(translate("Log", "SplitCurve : Input shape has no wires or edges\n"))
return None, None
else:
e = _utils.getShape(fp, "Source", "Edge")
@@ -193,7 +222,7 @@ def execute(self, obj):
# print([e.Length for e in edges])
se = Part.sortEdges(edges)
if len(se) > 1:
- FreeCAD.Console.PrintError("Split curve : failed to build temp Wire !")
+ FreeCAD.Console.PrintError(translate("Log", "Split curve : failed to build temp Wire !"))
# print(se)
w = Part.Wire(se[0])
else:
@@ -207,7 +236,7 @@ def execute(self, obj):
#
# se = Part.sortEdges(edges)
# if len(se) > 1:
- # FreeCAD.Console.PrintError("Split curve : failed to build final Wire !")
+ # FreeCAD.Console.PrintError(translate("Log", "Split curve : failed to build final Wire !"))
# wires = []
# for el in se:
# wires.append(Part.Wire(el))
@@ -249,7 +278,7 @@ def execute(self, obj):
obj.Shape = w
obj.NormalizedParameters = KnotVector(params).normalize()
else:
- FreeCAD.Console.PrintError("Split curve : Invalid Wire !")
+ FreeCAD.Console.PrintError(translate("Log", "Split curve : Invalid Wire !"))
obj.Shape = e
@@ -423,7 +452,7 @@ def __init__(self, points=[], fp=None):
elif isinstance(p, MarkerOnEdge):
self.points.append(p)
else:
- FreeCAD.Console.PrintError("pointEditor : bad input")
+ FreeCAD.Console.PrintError(translate("Log", "pointEditor : bad input"))
for p in points:
if hasattr(p, "ctrl_keys"):
for key in p.ctrl_keys:
@@ -663,7 +692,7 @@ def makeSplitFeature(self, e):
def Activated(self):
sel = FreeCADGui.Selection.getSelectionEx()
if sel == []:
- FreeCAD.Console.PrintError("{} :\n{}\n".format(__title__, __usage__))
+ FreeCAD.Console.PrintError(translate("Log", "{} :\n{}\n")).format(__title__, __usage__)
for selobj in sel:
if selobj.HasSubObjects:
for i in range(len(selobj.SubObjects)):
@@ -684,9 +713,15 @@ def IsActive(self):
return False
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
-
-
-FreeCADGui.addCommand('split', splitCommand())
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_SplitCurve", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
+
+
+FreeCADGui.addCommand("Curves_SplitCurve", splitCommand())
diff --git a/freecad/Curves/sublink_edit.py b/freecad/Curves/sublink_edit.py
index 98ca345..5c4fd71 100644
--- a/freecad/Curves/sublink_edit.py
+++ b/freecad/Curves/sublink_edit.py
@@ -161,13 +161,13 @@ def set_link(self):
subs = list()
sel = FreeCADGui.Selection.getSelectionEx()
if sel == []:
- FreeCAD.Console.PrintError("Nothing selected !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Nothing selected !\n"))
for selobj in sel:
if selobj.HasSubObjects:
subs.append(("(FreeCAD.ActiveDocument.getObject('%s'),%s)" % (selobj.Object.Name, selobj.SubElementNames)))
if self.obj.getTypeIdOfProperty(self.link) == 'App::PropertyLinkSub':
if not len(subs) == 1:
- FreeCAD.Console.PrintError("This property accept only 1 subobject !\n")
+ FreeCAD.Console.PrintError(translate("Log", "This property accept only 1 subobject !\n"))
else:
# FreeCADGui.doCommand("subobj = FreeCAD.ActiveDocument.getObject('%s')"%(subs[0][0].Name))
FreeCADGui.doCommand("FreeCAD.ActiveDocument.getObject('%s').%s = %s" % (self.obj.Name, self.link, subs[0]))
@@ -224,7 +224,7 @@ class sle:
def Activated(self):
s = FreeCADGui.Selection.getSelection()
if not len(s) == 1:
- FreeCAD.Console.PrintError("Select 1 object !\n")
+ FreeCAD.Console.PrintError(translate("Log", "Select 1 object !\n"))
else:
hasSubLink = False
for p in s[0].PropertiesList:
@@ -255,10 +255,10 @@ def GetResources(self):
class proxy(object):
"""Feature python proxy"""
def __init__(self, obj):
- obj.addProperty("App::PropertyLinkSubList", "Profile", "Profile", "SubShapes of the profile")
- obj.addProperty("App::PropertyLinkSub", "Location1", "Profile", "Vertex location on spine")
- obj.addProperty("App::PropertyLinkSub", "Location2", "Profile", "Vertex location on spine")
- obj.addProperty("App::PropertyLinkSub", "Location3", "Profile", "Vertex location on spine")
+ obj.addProperty("App::PropertyLinkSubList", "Profile", "Profile", QT_TRANSLATE_NOOP("App::Property", "SubShapes of the profile"))
+ obj.addProperty("App::PropertyLinkSub", "Location1", "Profile", QT_TRANSLATE_NOOP("App::Property", "Vertex location on spine"))
+ obj.addProperty("App::PropertyLinkSub", "Location2", "Profile", QT_TRANSLATE_NOOP("App::Property", "Vertex location on spine"))
+ obj.addProperty("App::PropertyLinkSub", "Location3", "Profile", QT_TRANSLATE_NOOP("App::Property", "Vertex location on spine"))
obj.Proxy = self
diff --git a/freecad/Curves/toConsole.py b/freecad/Curves/toConsole.py
index e81d171..02e5765 100644
--- a/freecad/Curves/toConsole.py
+++ b/freecad/Curves/toConsole.py
@@ -1,13 +1,22 @@
# -*- coding: utf-8 -*-
-__title__ = 'Objects to Console'
-__author__ = 'Christophe Grellier (Chris_G)'
-__license__ = 'LGPL 2.1'
-__doc__ = 'Give access to the selected objects in the python console.'
-__usage__ = """Select some objects in the TreeView, or in the 3D View, and activate tool.
-Some variables will be created in the python console, to access the selection."""
-
import FreeCAD
+
+translate = FreeCAD.Qt.translate
+QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
+
+__title__ = QT_TRANSLATE_NOOP("Curves_ObjectsToConsole", "Objects to Console")
+__author__ = "Christophe Grellier (Chris_G)"
+__license__ = "LGPL 2.1"
+__doc__ = translate(
+ "Curves_ObjectsToConsole", "Give access to the selected objects in the python console."
+)
+__usage__ = translate(
+ "Curves_ObjectsToConsole",
+ """Select some objects in the TreeView, or in the 3D View, and activate tool.
+Some variables will be created in the python console, to access the selection.""",
+)
+
import FreeCADGui
import os
from freecad.Curves import _utils
@@ -21,10 +30,16 @@
class ToConsole:
"Brings the selected objects to the python console"
def GetResources(self):
- return {'Pixmap': TOOL_ICON,
- 'MenuText': __title__,
- 'Accel': "",
- 'ToolTip': "{}Usage : {}".format(__doc__, " ".join(__usage__.splitlines()))}
+ return {
+ "Pixmap": TOOL_ICON,
+ "MenuText": __title__,
+ "Accel": "",
+ "ToolTip": "{}{} : {}".format(
+ __doc__,
+ translate("Curves_ObjectsToConsole", "Usage"),
+ " ".join(__usage__.splitlines()),
+ ),
+ }
def Activated(self):
doc = ''
@@ -93,4 +108,4 @@ def IsActive(self):
return False
-FreeCADGui.addCommand('to_console', ToConsole())
+FreeCADGui.addCommand("Curves_ObjectsToConsole", ToConsole())