Draft: move newlines out of translations
This commit is contained in:
@@ -912,15 +912,15 @@ def makeBSpline(pointslist,closed=False,placement=None,face=None,support=None):
|
||||
nlist.append(v.Point)
|
||||
pointslist = nlist
|
||||
if len(pointslist) < 2:
|
||||
msg(translate("draft","Draft.makeBSpline: not enough points\n"), 'error')
|
||||
msg(translate("draft","Draft.makeBSpline: not enough points")+"\n", 'error')
|
||||
return
|
||||
if (pointslist[0] == pointslist[-1]):
|
||||
if len(pointslist) > 2:
|
||||
closed = True
|
||||
pointslist.pop()
|
||||
msg(translate("draft","Draft.makeBSpline: Equal endpoints forced Closed\n"), 'warning')
|
||||
msg(translate("draft","Draft.makeBSpline: Equal endpoints forced Closed")+"\n", 'warning')
|
||||
else: # len == 2 and first == last GIGO
|
||||
msg(translate("draft","Draft.makeBSpline: Invalid pointslist\n"), 'error')
|
||||
msg(translate("draft","Draft.makeBSpline: Invalid pointslist")+"\n", 'error')
|
||||
return
|
||||
# should have sensible parms from here on
|
||||
if placement: typecheck([(placement,FreeCAD.Placement)], "makeBSpline")
|
||||
@@ -3433,12 +3433,12 @@ def upgrade(objects,delete=False,force=None):
|
||||
# if we have a group: turn each closed wire inside into a face
|
||||
if groups:
|
||||
result = closeGroupWires(groups)
|
||||
if result: msg(translate("draft", "Found groups: closing each open object inside\n"))
|
||||
if result: msg(translate("draft", "Found groups: closing each open object inside")+"\n")
|
||||
|
||||
# if we have meshes, we try to turn them into shapes
|
||||
elif meshes:
|
||||
result = turnToParts(meshes)
|
||||
if result: msg(translate("draft", "Found mesh(es): turning into Part shapes\n"))
|
||||
if result: msg(translate("draft", "Found mesh(es): turning into Part shapes")+"\n")
|
||||
|
||||
# we have only faces here, no lone edges
|
||||
elif faces and (len(wires) + len(openwires) == len(facewires)):
|
||||
@@ -3446,40 +3446,40 @@ def upgrade(objects,delete=False,force=None):
|
||||
# we have one shell: we try to make a solid
|
||||
if (len(objects) == 1) and (len(faces) > 3):
|
||||
result = makeSolid(objects[0])
|
||||
if result: msg(translate("draft", "Found 1 solidificable object: solidifying it\n"))
|
||||
if result: msg(translate("draft", "Found 1 solidificable object: solidifying it")+"\n")
|
||||
|
||||
# we have exactly 2 objects: we fuse them
|
||||
elif (len(objects) == 2) and (not curves):
|
||||
result = makeFusion(objects[0],objects[1])
|
||||
if result: msg(translate("draft", "Found 2 objects: fusing them\n"))
|
||||
if result: msg(translate("draft", "Found 2 objects: fusing them")+"\n")
|
||||
|
||||
# we have many separate faces: we try to make a shell
|
||||
elif (len(objects) > 2) and (len(faces) > 1) and (not loneedges):
|
||||
result = makeShell(objects)
|
||||
if result: msg(translate("draft", "Found several objects: creating a shell\n"))
|
||||
if result: msg(translate("draft", "Found several objects: creating a shell")+"\n")
|
||||
|
||||
# we have faces: we try to join them if they are coplanar
|
||||
elif len(faces) > 1:
|
||||
result = joinFaces(objects)
|
||||
if result: msg(translate("draft", "Found several coplanar objects or faces: creating one face\n"))
|
||||
if result: msg(translate("draft", "Found several coplanar objects or faces: creating one face")+"\n")
|
||||
|
||||
# only one object: if not parametric, we "draftify" it
|
||||
elif len(objects) == 1 and (not objects[0].isDerivedFrom("Part::Part2DObjectPython")):
|
||||
result = draftify(objects[0])
|
||||
if result: msg(translate("draft", "Found 1 non-parametric objects: draftifying it\n"))
|
||||
if result: msg(translate("draft", "Found 1 non-parametric objects: draftifying it")+"\n")
|
||||
|
||||
# we have only one object that contains one edge
|
||||
elif (not faces) and (len(objects) == 1) and (len(edges) == 1):
|
||||
# we have a closed sketch: Extract a face
|
||||
if objects[0].isDerivedFrom("Sketcher::SketchObject") and (len(edges[0].Vertexes) == 1):
|
||||
result = makeSketchFace(objects[0])
|
||||
if result: msg(translate("draft", "Found 1 closed sketch object: creating a face from it\n"))
|
||||
if result: msg(translate("draft", "Found 1 closed sketch object: creating a face from it")+"\n")
|
||||
else:
|
||||
# turn to Draft line
|
||||
e = objects[0].Shape.Edges[0]
|
||||
if isinstance(e.Curve,(Part.LineSegment,Part.Line)):
|
||||
result = turnToLine(objects[0])
|
||||
if result: msg(translate("draft", "Found 1 linear object: converting to line\n"))
|
||||
if result: msg(translate("draft", "Found 1 linear object: converting to line")+"\n")
|
||||
|
||||
# we have only closed wires, no faces
|
||||
elif wires and (not faces) and (not openwires):
|
||||
@@ -3487,36 +3487,36 @@ def upgrade(objects,delete=False,force=None):
|
||||
# we have a sketch: Extract a face
|
||||
if (len(objects) == 1) and objects[0].isDerivedFrom("Sketcher::SketchObject"):
|
||||
result = makeSketchFace(objects[0])
|
||||
if result: msg(translate("draft", "Found 1 closed sketch object: creating a face from it\n"))
|
||||
if result: msg(translate("draft", "Found 1 closed sketch object: creating a face from it")+"\n")
|
||||
|
||||
# only closed wires
|
||||
else:
|
||||
result = makeFaces(objects)
|
||||
if result: msg(translate("draft", "Found closed wires: creating faces\n"))
|
||||
if result: msg(translate("draft", "Found closed wires: creating faces")+"\n")
|
||||
|
||||
# special case, we have only one open wire. We close it, unless it has only 1 edge!"
|
||||
elif (len(openwires) == 1) and (not faces) and (not loneedges):
|
||||
result = closeWire(objects[0])
|
||||
if result: msg(translate("draft", "Found 1 open wire: closing it\n"))
|
||||
if result: msg(translate("draft", "Found 1 open wire: closing it")+"\n")
|
||||
|
||||
# only open wires and edges: we try to join their edges
|
||||
elif openwires and (not wires) and (not faces):
|
||||
result = makeWires(objects)
|
||||
if result: msg(translate("draft", "Found several open wires: joining them\n"))
|
||||
if result: msg(translate("draft", "Found several open wires: joining them")+"\n")
|
||||
|
||||
# only loneedges: we try to join them
|
||||
elif loneedges and (not facewires):
|
||||
result = makeWires(objects)
|
||||
if result: msg(translate("draft", "Found several edges: wiring them\n"))
|
||||
if result: msg(translate("draft", "Found several edges: wiring them")+"\n")
|
||||
|
||||
# all other cases, if more than 1 object, make a compound
|
||||
elif (len(objects) > 1):
|
||||
result = makeCompound(objects)
|
||||
if result: msg(translate("draft", "Found several non-treatable objects: creating compound\n"))
|
||||
if result: msg(translate("draft", "Found several non-treatable objects: creating compound")+"\n")
|
||||
|
||||
# no result has been obtained
|
||||
if not result:
|
||||
msg(translate("draft", "Unable to upgrade these objects.\n"))
|
||||
msg(translate("draft", "Unable to upgrade these objects.")+"\n")
|
||||
|
||||
if delete:
|
||||
names = []
|
||||
@@ -3672,52 +3672,52 @@ def downgrade(objects,delete=False,force=None):
|
||||
# we have a block, we explode it
|
||||
if (len(objects) == 1) and (getType(objects[0]) == "Block"):
|
||||
result = explode(objects[0])
|
||||
if result: msg(translate("draft", "Found 1 block: exploding it\n"))
|
||||
if result: msg(translate("draft", "Found 1 block: exploding it")+"\n")
|
||||
|
||||
# we have one multi-solids compound object: extract its solids
|
||||
elif (len(objects) == 1) and (getType(objects[0]) == "Part") and (len(solids) > 1):
|
||||
result = splitCompounds(objects)
|
||||
#print(result)
|
||||
if result: msg(translate("draft", "Found 1 multi-solids compound: exploding it\n"))
|
||||
if result: msg(translate("draft", "Found 1 multi-solids compound: exploding it")+"\n")
|
||||
|
||||
# special case, we have one parametric object: we "de-parametrize" it
|
||||
elif (len(objects) == 1) and (objects[0].isDerivedFrom("Part::Feature")) and ("Base" in objects[0].PropertiesList):
|
||||
result = shapify(objects[0])
|
||||
if result:
|
||||
msg(translate("draft", "Found 1 parametric object: breaking its dependencies\n"))
|
||||
msg(translate("draft", "Found 1 parametric object: breaking its dependencies")+"\n")
|
||||
addList.append(result)
|
||||
#deleteList.append(objects[0])
|
||||
|
||||
# we have only 2 objects: cut 2nd from 1st
|
||||
elif len(objects) == 2:
|
||||
result = cut2(objects)
|
||||
if result: msg(translate("draft", "Found 2 objects: subtracting them\n"))
|
||||
if result: msg(translate("draft", "Found 2 objects: subtracting them")+"\n")
|
||||
|
||||
elif (len(faces) > 1):
|
||||
|
||||
# one object with several faces: split it
|
||||
if len(objects) == 1:
|
||||
result = splitFaces(objects)
|
||||
if result: msg(translate("draft", "Found several faces: splitting them\n"))
|
||||
if result: msg(translate("draft", "Found several faces: splitting them"+"\n")
|
||||
|
||||
# several objects: remove all the faces from the first one
|
||||
else:
|
||||
result = subtr(objects)
|
||||
if result: msg(translate("draft", "Found several objects: subtracting them from the first one\n"))
|
||||
if result: msg(translate("draft", "Found several objects: subtracting them from the first one")+"\n")
|
||||
|
||||
# only one face: we extract its wires
|
||||
elif (len(faces) > 0):
|
||||
result = getWire(objects[0])
|
||||
if result: msg(translate("draft", "Found 1 face: extracting its wires\n"))
|
||||
if result: msg(translate("draft", "Found 1 face: extracting its wires")+"\n")
|
||||
|
||||
# no faces: split wire into single edges
|
||||
elif not onlyedges:
|
||||
result = splitWires(objects)
|
||||
if result: msg(translate("draft", "Found only wires: extracting their edges\n"))
|
||||
if result: msg(translate("draft", "Found only wires: extracting their edges")+"\n")
|
||||
|
||||
# no result has been obtained
|
||||
if not result:
|
||||
msg(translate("draft", "No more downgrade possible\n"))
|
||||
msg(translate("draft", "No more downgrade possible")+"\n")
|
||||
|
||||
if delete:
|
||||
names = []
|
||||
@@ -3918,8 +3918,8 @@ class _Dimension(_DraftObject):
|
||||
_DraftObject.__init__(self,obj,"Dimension")
|
||||
obj.addProperty("App::PropertyVectorDistance","Start","Draft",QT_TRANSLATE_NOOP("App::Property","Startpoint of dimension"))
|
||||
obj.addProperty("App::PropertyVectorDistance","End","Draft",QT_TRANSLATE_NOOP("App::Property","Endpoint of dimension"))
|
||||
obj.addProperty("App::PropertyVector","Normal","Draft",QT_TRANSLATE_NOOP("App::Property","the normal direction of this dimension"))
|
||||
obj.addProperty("App::PropertyVector","Direction","Draft",QT_TRANSLATE_NOOP("App::Property","the normal direction of this dimension"))
|
||||
obj.addProperty("App::PropertyVector","Normal","Draft",QT_TRANSLATE_NOOP("App::Property","The normal direction of this dimension"))
|
||||
obj.addProperty("App::PropertyVector","Direction","Draft",QT_TRANSLATE_NOOP("App::Property","The normal direction of this dimension"))
|
||||
obj.addProperty("App::PropertyVectorDistance","Dimline","Draft",QT_TRANSLATE_NOOP("App::Property","Point through which the dimension line passes"))
|
||||
obj.addProperty("App::PropertyLink","Support","Draft",QT_TRANSLATE_NOOP("App::Property","The object measured by this dimension"))
|
||||
obj.addProperty("App::PropertyLinkSubList","LinkedGeometry","Draft",QT_TRANSLATE_NOOP("App::Property","The geometry this dimension is linked to"))
|
||||
@@ -5328,7 +5328,7 @@ class _BSpline(_DraftObject):
|
||||
plm = obj.Placement
|
||||
if obj.Closed and (len(obj.Points) > 2):
|
||||
if obj.Points[0] == obj.Points[-1]: # should not occur, but OCC will crash
|
||||
msg(translate('draft', "_BSpline.createGeometry: Closed with same first/last Point. Geometry not updated.\n"), "error")
|
||||
msg(translate('draft', "_BSpline.createGeometry: Closed with same first/last Point. Geometry not updated.")+"\n", "error")
|
||||
return
|
||||
spline = Part.BSplineCurve()
|
||||
spline.interpolate(obj.Points, PeriodicFlag = True, Parameters = self.knotSeq)
|
||||
@@ -6140,7 +6140,7 @@ class _ShapeString(_DraftObject):
|
||||
else:
|
||||
CharList = Part.makeWireString(obj.String,obj.FontFile,obj.Size,obj.Tracking)
|
||||
if len(CharList) == 0:
|
||||
msg(translate("draft","ShapeString: string has no wires\n"), 'warning')
|
||||
msg(translate("draft","ShapeString: string has no wires")+"\n", 'warning')
|
||||
return
|
||||
SSChars = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user