From 2a3ff10d84bd358f9b42126d544c71fbf5c257fb Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 31 May 2012 12:30:20 -0300 Subject: [PATCH] Arch: Adapted all other tools to doCommand() + translatable --- src/Mod/Arch/ArchAxis.py | 18 ++++---- src/Mod/Arch/ArchBuilding.py | 24 +++++++--- src/Mod/Arch/ArchCommands.py | 34 ++++++++++++--- src/Mod/Arch/ArchFloor.py | 27 ++++++++---- src/Mod/Arch/ArchRoof.py | 26 ++++++----- src/Mod/Arch/ArchSectionPlane.py | 75 +++++++++++++++++++++----------- src/Mod/Arch/ArchSite.py | 21 +++++++-- src/Mod/Arch/ArchStructure.py | 24 +++++----- src/Mod/Arch/ArchWindow.py | 10 +++-- 9 files changed, 173 insertions(+), 86 deletions(-) diff --git a/src/Mod/Arch/ArchAxis.py b/src/Mod/Arch/ArchAxis.py index 37cdf9f54..d165e69ea 100644 --- a/src/Mod/Arch/ArchAxis.py +++ b/src/Mod/Arch/ArchAxis.py @@ -25,12 +25,13 @@ import FreeCAD,FreeCADGui,Draft,math,DraftVecUtils from FreeCAD import Vector from PyQt4 import QtCore, QtGui from pivy import coin +from DraftTools import translate __title__="FreeCAD Axis System" __author__ = "Yorik van Havre" __url__ = "http://free-cad.sourceforge.net" -def makeAxis(num=0,size=0,name="Axes"): +def makeAxis(num=5,size=1,name=str(translate("Arch","Axes"))): '''makeAxis(num,size): makes an Axis System based on the given number of axes and interval distances''' obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) @@ -56,16 +57,17 @@ class _CommandAxis: 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Axis","Creates an axis system.")} def Activated(self): - FreeCAD.ActiveDocument.openTransaction("Axis") - makeAxis(5,1) + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Axis"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("Arch.makeAxis()") FreeCAD.ActiveDocument.commitTransaction() class _Axis: "The Axis object" def __init__(self,obj): - obj.addProperty("App::PropertyFloatList","Distances","Base", "The intervals between axes") - obj.addProperty("App::PropertyFloatList","Angles","Base", "The angles of each axis") - obj.addProperty("App::PropertyFloat","Length","Base", "The length of the axes") + obj.addProperty("App::PropertyFloatList","Distances","Base", str(translate("Arch","The intervals between axes"))) + obj.addProperty("App::PropertyFloatList","Angles","Base", str(translate("Arch","The angles of each axis"))) + obj.addProperty("App::PropertyFloat","Length","Base", str(translate("Arch","The length of the axes"))) self.Type = "Axis" obj.Length=1.0 obj.Proxy = self @@ -98,8 +100,8 @@ class _ViewProviderAxis: "A View Provider for the Axis object" def __init__(self,vobj): - vobj.addProperty("App::PropertyLength","BubbleSize","Base", "The size of the axis bubbles") - vobj.addProperty("App::PropertyEnumeration","NumerationStyle","Base", "The numeration style") + vobj.addProperty("App::PropertyLength","BubbleSize","Base", str(translate("Arch","The size of the axis bubbles"))) + vobj.addProperty("App::PropertyEnumeration","NumerationStyle","Base", str(translate("Arch","The numeration style"))) vobj.NumerationStyle = ["1,2,3","01,02,03","001,002,003","A,B,C","a,b,c","I,II,III","L0,L1,L2"] vobj.Proxy = self vobj.BubbleSize = .1 diff --git a/src/Mod/Arch/ArchBuilding.py b/src/Mod/Arch/ArchBuilding.py index f8ed4e8ca..4b0011b34 100644 --- a/src/Mod/Arch/ArchBuilding.py +++ b/src/Mod/Arch/ArchBuilding.py @@ -23,12 +23,13 @@ import FreeCAD,FreeCADGui,Draft,ArchCommands from PyQt4 import QtCore +from DraftTools import translate __title__="FreeCAD Building" __author__ = "Yorik van Havre" __url__ = "http://free-cad.sourceforge.net" -def makeBuilding(objectslist=None,join=False,name="Building"): +def makeBuilding(objectslist=None,join=False,name=str(translate("Arch","Building"))): '''makeBuilding(objectslist,[joinmode]): creates a building including the objects from the given list. If joinmode is True, components will be joined.''' obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name) @@ -51,15 +52,24 @@ class _CommandBuilding: ok = False if (len(sel) == 1): if Draft.getType(sel[0]) in ["Cell","Site","Floor"]: - FreeCAD.ActiveDocument.openTransaction("Type conversion") - nobj = makeBuilding() - ArchCommands.copyProperties(sel[0],nobj) - FreeCAD.ActiveDocument.removeObject(sel[0].Name) + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Type conversion"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("obj = Arch.makeBuilding()") + FreeCADGui.doCommand("Arch.copyProperties(FreeCAD.ActiveDocument."+sel[0].Name+",obj)") + FreeCADGui.doCommand("FreeCAD.ActiveDocument.removeObject("+sel[0].Name+")") FreeCAD.ActiveDocument.commitTransaction() ok = True if not ok: - FreeCAD.ActiveDocument.openTransaction("Building") - makeBuilding(sel) + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch"," Create Building"))) + ss = "[" + for o in sel: + if len(ss) > 1: + ss += "," + ss += "FreeCAD.ActiveDocument."+o.Name + ss += "]" + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Floor"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("Arch.makeBuilding("+ss+")") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index 2ebfad0d0..2025a6f30 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -24,6 +24,7 @@ import FreeCAD,FreeCADGui,Draft,ArchComponent,DraftVecUtils from FreeCAD import Vector from PyQt4 import QtCore +from DraftTools import translate __title__="FreeCAD Arch Commands" __author__ = "Yorik van Havre" @@ -341,11 +342,20 @@ class _CommandAdd: def Activated(self): sel = FreeCADGui.Selection.getSelection() - FreeCAD.ActiveDocument.openTransaction("Grouping") + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Grouping"))) if not mergeCells(sel): host = sel.pop() - addComponents(sel,host) + ss = "[" + for o in sel: + if len(ss) > 1: + ss += "," + ss += "FreeCAD.ActiveDocument."+o.Name + ss += "]" + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("Arch.addComponents("+ss+",FreeCAD.ActiveDocument."+host.Name+")") FreeCAD.ActiveDocument.commitTransaction() + FreeCAD.ActiveDocument.recompute() + class _CommandRemove: "the Arch Add command definition" @@ -362,13 +372,22 @@ class _CommandRemove: def Activated(self): sel = FreeCADGui.Selection.getSelection() - FreeCAD.ActiveDocument.openTransaction("Ungrouping") + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Ungrouping"))) if Draft.getType(sel[-1]) in ["Wall","Structure"]: host = sel.pop() - removeComponents(sel,host) + ss = "[" + for o in sel: + if len(ss) > 1: + ss += "," + ss += "FreeCAD.ActiveDocument."+o.Name + ss += "]" + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("Arch.removeComponents("+ss+",FreeCAD.ActiveDocument."+host.Name+")") else: - removeComponents(sel) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("Arch.removeComponents("+ss+")") FreeCAD.ActiveDocument.commitTransaction() + FreeCAD.ActiveDocument.recompute() class _CommandSplitMesh: @@ -387,7 +406,7 @@ class _CommandSplitMesh: def Activated(self): if FreeCADGui.Selection.getSelection(): sel = FreeCADGui.Selection.getSelection() - FreeCAD.ActiveDocument.openTransaction("Split Mesh") + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Split Mesh"))) for obj in sel: n = obj.Name nobjs = splitMesh(obj) @@ -396,6 +415,7 @@ class _CommandSplitMesh: for o in nobjs: g.addObject(o) FreeCAD.ActiveDocument.commitTransaction() + FreeCAD.ActiveDocument.recompute() class _CommandMeshToShape: @@ -424,7 +444,7 @@ class _CommandMeshToShape: if f.InList: if f.InList[0].isDerivedFrom("App::DocumentObjectGroup"): g = f.InList[0] - FreeCAD.ActiveDocument.openTransaction("Mesh to Shape") + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Mesh to Shape"))) for obj in FreeCADGui.Selection.getSelection(): newobj = meshToShape(obj) if g and newobj: diff --git a/src/Mod/Arch/ArchFloor.py b/src/Mod/Arch/ArchFloor.py index 606395961..922d8aca0 100644 --- a/src/Mod/Arch/ArchFloor.py +++ b/src/Mod/Arch/ArchFloor.py @@ -23,12 +23,13 @@ import FreeCAD,FreeCADGui,Draft,ArchCommands from PyQt4 import QtCore +from DraftTools import translate __title__="FreeCAD Arch Floor" __author__ = "Yorik van Havre" __url__ = "http://free-cad.sourceforge.net" -def makeFloor(objectslist=None,join=True,name="Floor"): +def makeFloor(objectslist=None,join=True,name=str(translate("Arch","Floor"))): '''makeFloor(objectslist,[joinmode]): creates a floor including the objects from the given list. If joinmode is False, components will not be joined.''' @@ -52,23 +53,31 @@ class _CommandFloor: ok = False if (len(sel) == 1): if Draft.getType(sel[0]) in ["Cell","Site","Building"]: - FreeCAD.ActiveDocument.openTransaction("Type conversion") - nobj = makeFloor() - ArchCommands.copyProperties(sel[0],nobj) - FreeCAD.ActiveDocument.removeObject(sel[0].Name) + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Type conversion"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("obj = Arch.makeFloor()") + FreeCADGui.doCommand("Arch.copyProperties(FreeCAD.ActiveDocument."+sel[0].Name+",obj)") + FreeCADGui.doCommand("FreeCAD.ActiveDocument.removeObject("+sel[0].Name+")") FreeCAD.ActiveDocument.commitTransaction() ok = True if not ok: - FreeCAD.ActiveDocument.openTransaction("Floor") - makeFloor(sel) + ss = "[" + for o in sel: + if len(ss) > 1: + ss += "," + ss += "FreeCAD.ActiveDocument."+o.Name + ss += "]" + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Floor"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("Arch.makeFloor("+ss+")") FreeCAD.ActiveDocument.commitTransaction() - FreeCAD.ActiveDocument.recompute() + FreeCAD.ActiveDocument.recompute() class _Floor: "The Cell object" def __init__(self,obj): obj.addProperty("App::PropertyLength","Height","Base", - "The height of this floor") + str(translate("Arch","The height of this floor"))) self.Type = "Floor" obj.Proxy = self self.Object = obj diff --git a/src/Mod/Arch/ArchRoof.py b/src/Mod/Arch/ArchRoof.py index 31515afbc..4c8d6964c 100644 --- a/src/Mod/Arch/ArchRoof.py +++ b/src/Mod/Arch/ArchRoof.py @@ -24,12 +24,13 @@ import FreeCAD,FreeCADGui,Draft,ArchComponent, DraftVecUtils from FreeCAD import Vector from PyQt4 import QtCore +from DraftTools import translate __title__="FreeCAD Roof" __author__ = "Yorik van Havre" __url__ = "http://free-cad.sourceforge.net" -def makeRoof(baseobj,facenr=1,angle=45,name="Roof"): +def makeRoof(baseobj,facenr=1,angle=45,name=str(translate("Arch","Roof"))): '''makeRoof(baseobj,[facenr],[angle],[name]) : Makes a roof based on a face from an existing object. You can provide the number of the face to build the roof on (default = 1), the angle (default=45) and a name (default @@ -64,35 +65,38 @@ class _CommandRoof: if sel.HasSubObjects: if "Face" in sel.SubElementNames[0]: idx = int(sel.SubElementNames[0][4:]) - FreeCAD.ActiveDocument.openTransaction("Create Roof") - makeRoof(obj,idx) + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Roof"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+","+str(idx)+")") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() elif obj.isDerivedFrom("Part::Feature"): if len(obj.Shape.Faces) == 1: - FreeCAD.ActiveDocument.openTransaction("Create Roof") - makeRoof(obj,1) + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Roof"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+",1)") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() elif obj.isDerivedFrom("Part::Feature"): if len(obj.Shape.Faces) == 1: - FreeCAD.ActiveDocument.openTransaction("Create Roof") - makeRoof(obj,1) + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Roof"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+",1)") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() else: - FreeCAD.Console.PrintMessage("Unable to create a roof") + FreeCAD.Console.PrintMessage(str(translate("Arch","Unable to create a roof"))) else: - FreeCAD.Console.PrintMessage("No object selected") + FreeCAD.Console.PrintMessage(str(translate("Arch","No object selected"))) class _Roof(ArchComponent.Component): "The Roof object" def __init__(self,obj): ArchComponent.Component.__init__(self,obj) obj.addProperty("App::PropertyAngle","Angle","Base", - "The angle of this roof") + str(translate("Arch","The angle of this roof"))) obj.addProperty("App::PropertyInteger","Face","Base", - "The face number of the base object used to build this roof") + str(translate("Arch","The face number of the base object used to build this roof"))) self.Type = "Structure" def execute(self,obj): diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index e1230e59f..8f695d708 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -25,7 +25,45 @@ import FreeCAD,FreeCADGui,ArchComponent,WorkingPlane,math,Draft,ArchCommands, Dr from FreeCAD import Vector from PyQt4 import QtCore from pivy import coin +from DraftTools import translate +def makeSectionPlane(objectslist=None): + """makeSectionPlane([objectslist]) : Creates a Section plane objects including the + given objects. If no object is given, the whole document will be considered.""" + obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Section") + _SectionPlane(obj) + _ViewProviderSectionPlane(obj.ViewObject) + if objectslist: + g = [] + for o in objectslist: + if o.isDerivedFrom("Part::Feature"): + g.append(o) + elif o.isDerivedFrom("App::DocumentObjectGroup"): + g.append(o) + obj.Objects = g + +def makeSectionView(section): + """makeSectionView(section) : Creates a Drawing view of the given Section Plane + in the active Page object (a new page will be created if none exists""" + page = None + for o in FreeCAD.ActiveDocument.Objects: + if o.isDerivedFrom("Drawing::FeaturePage"): + page = o + break + if not page: + page = FreeCAD.ActiveDocument.addObject("Drawing::FeaturePage",str(translate("Arch","Page"))) + template = Draft.getParam("template") + if not template: + template = FreeCAD.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg' + page.ViewObject.HintOffsetX = 200 + page.ViewObject.HintOffsetY = 100 + page.ViewObject.HintScale = 20 + page.Template = template + + view = FreeCAD.ActiveDocument.addObject("Drawing::FeatureViewPython","View") + page.addObject(view) + _ArchDrawingView(view) + view.Source = section class _CommandSectionPlane: "the Arch SectionPlane command definition" @@ -37,30 +75,17 @@ class _CommandSectionPlane: def Activated(self): sel = FreeCADGui.Selection.getSelection() - FreeCAD.ActiveDocument.openTransaction("Section Plane") - obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Section") - _SectionPlane(obj) - _ViewProviderSectionPlane(obj.ViewObject) - FreeCAD.ActiveDocument.commitTransaction() - g = [] + ss = "[" for o in sel: - if o.isDerivedFrom("Part::Feature"): - g.append(o) - elif o.isDerivedFrom("App::DocumentObjectGroup"): - g.append(o) - obj.Objects = g - page = FreeCAD.ActiveDocument.addObject("Drawing::FeaturePage","Page") - template = Draft.getParam("template") - if not template: - template = FreeCAD.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg' - page.ViewObject.HintOffsetX = 200 - page.ViewObject.HintOffsetY = 100 - page.ViewObject.HintScale = 20 - page.Template = template - view = FreeCAD.ActiveDocument.addObject("Drawing::FeatureViewPython","View") - page.addObject(view) - _ArchDrawingView(view) - view.Source = obj + if len(ss) > 1: + ss += "," + ss += "FreeCAD.ActiveDocument."+o.Name + ss += "]" + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Section Plane"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("section = Arch.makeSectionPlane("+ss+")") + FreeCADGui.doCommand("Arch.makeSectionView(section)") + FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() class _SectionPlane: @@ -68,7 +93,7 @@ class _SectionPlane: def __init__(self,obj): obj.Proxy = self obj.addProperty("App::PropertyLinkList","Objects","Base", - "The objects that must be considered by this section plane. Empty means all document") + str(translate("Arch","The objects that must be considered by this section plane. Empty means all document"))) self.Type = "SectionPlane" def execute(self,obj): @@ -89,7 +114,7 @@ class _ViewProviderSectionPlane(ArchComponent.ViewProviderComponent): "A View Provider for Section Planes" def __init__(self,vobj): vobj.addProperty("App::PropertyLength","DisplaySize","Base", - "The display size of the section plane") + str(translate("Arch","The display size of this section plane"))) vobj.DisplaySize = 1 vobj.Transparency = 85 vobj.LineWidth = 1 diff --git a/src/Mod/Arch/ArchSite.py b/src/Mod/Arch/ArchSite.py index 300fd09ef..d05a7e8ff 100644 --- a/src/Mod/Arch/ArchSite.py +++ b/src/Mod/Arch/ArchSite.py @@ -23,12 +23,13 @@ import FreeCAD,FreeCADGui,Draft,ArchCommands from PyQt4 import QtCore +from DraftTools import translate __title__="FreeCAD Site" __author__ = "Yorik van Havre" __url__ = "http://free-cad.sourceforge.net" -def makeSite(objectslist=None,name="Site"): +def makeSite(objectslist=None,name=str(translate("Arch","Site"))): '''makeBuilding(objectslist): creates a site including the objects from the given list.''' obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name) @@ -51,15 +52,27 @@ class _CommandSite: ok = False if (len(sel) == 1): if Draft.getType(sel[0]) in ["Cell","Building","Floor"]: - FreeCAD.ActiveDocument.openTransaction("Type conversion") + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Type conversion"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("obj = Arch.makeSite()") + FreeCADGui.doCommand("Arch.copyProperties(FreeCAD.ActiveDocument."+sel[0].Name+",obj)") + FreeCADGui.doCommand("FreeCAD.ActiveDocument.removeObject("+sel[0].Name+")") + nobj = makeSite() ArchCommands.copyProperties(sel[0],nobj) FreeCAD.ActiveDocument.removeObject(sel[0].Name) FreeCAD.ActiveDocument.commitTransaction() ok = True if not ok: - FreeCAD.ActiveDocument.openTransaction("Site") - makeSite(sel) + ss = "[" + for o in sel: + if len(ss) > 1: + ss += "," + ss += "FreeCAD.ActiveDocument."+o.Name + ss += "]" + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Site"))) + FreeCADGui.doCommand("import Arch") + FreeCADGui.doCommand("Arch.makeSite("+ss+")") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index 2327ad7ca..7bf73cc1e 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -24,12 +24,13 @@ import FreeCAD,FreeCADGui,Draft,ArchComponent,DraftVecUtils from FreeCAD import Vector from PyQt4 import QtCore +from DraftTools import translate __title__="FreeCAD Structure" __author__ = "Yorik van Havre" __url__ = "http://free-cad.sourceforge.net" -def makeStructure(baseobj=None,length=None,width=None,height=None,name="Structure"): +def makeStructure(baseobj=None,length=None,width=None,height=None,name=str(translate("Arch","Structure"))): '''makeStructure([obj],[length],[width],[heigth],[swap]): creates a structure element based on the given profile object and the given extrusion height. If no base object is given, you can also specify @@ -64,29 +65,31 @@ class _CommandStructure: 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Structure","Creates a structure object from scratch or from a selected object (sketch, wire, face or solid)")} def Activated(self): + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Structure"))) + FreeCADGui.doCommand("import Arch") sel = FreeCADGui.Selection.getSelection() if sel: - FreeCAD.ActiveDocument.openTransaction("Structure") for obj in sel: - makeStructure(obj) - FreeCAD.ActiveDocument.commitTransaction() + FreeCADGui.doCommand("Arch.makeStructure(FreeCAD.ActiveDocument."+obj.Name+")") else: - makeStructure() + FreeCADGui.doCommand("Arch.makeStructure()") + FreeCAD.ActiveDocument.commitTransaction() + FreeCAD.ActiveDocument.recompute() class _Structure(ArchComponent.Component): "The Structure object" def __init__(self,obj): ArchComponent.Component.__init__(self,obj) obj.addProperty("App::PropertyLength","Length","Base", - "The length of this element, if not based on a profile") + str(translate("Arch","The length of this element, if not based on a profile"))) obj.addProperty("App::PropertyLength","Width","Base", - "The width of this element, if not based on a profile") + str(translate("Arch","The width of this element, if not based on a profile"))) obj.addProperty("App::PropertyLength","Height","Base", - "The height or extrusion depth of this element. Keep 0 for automatic") + str(translate("Arch","The height or extrusion depth of this element. Keep 0 for automatic"))) obj.addProperty("App::PropertyLinkList","Axes","Base", - "Axes systems this structure is built on") + str(translate("Arch","Axes systems this structure is built on"))) obj.addProperty("App::PropertyVector","Normal","Base", - "The normal extrusion direction of this object (keep (0,0,0) for automatic normal)") + str(translate("Arch","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)"))) self.Type = "Structure" def execute(self,obj): @@ -167,7 +170,6 @@ class _Structure(ArchComponent.Component): if hasattr(hole,"Proxy"): if hasattr(hole.Proxy,"Subvolume"): if hole.Proxy.Subvolume: - print "cutting subvolume",hole.Proxy.Subvolume base = base.cut(hole.Proxy.Subvolume) cut = True if not cut: diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index 35813ddfc..40b038aed 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -24,12 +24,13 @@ import FreeCAD,FreeCADGui,Draft,ArchComponent,DraftVecUtils from FreeCAD import Vector from PyQt4 import QtCore,QtGui +from DraftTools import translate __title__="FreeCAD Wall" __author__ = "Yorik van Havre" __url__ = "http://free-cad.sourceforge.net" -def makeWindow(baseobj=None,width=None,name="Window"): +def makeWindow(baseobj=None,width=None,name=str(translate("Arch","Window"))): '''makeWindow(obj,[name]): creates a window based on the given object''' if baseobj: @@ -87,9 +88,10 @@ class _CommandWindow: def Activated(self): sel = FreeCADGui.Selection.getSelection() - FreeCAD.ActiveDocument.openTransaction("Create Window") + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Window"))) + FreeCADGui.doCommand("import Arch") for obj in sel: - makeWindow(obj) + FreeCADGui.doCommand("Arch.makeWindow(FreeCAD.ActiveDocument."+obj.Name+")") FreeCAD.ActiveDocument.commitTransaction() class _Window(ArchComponent.Component): @@ -97,7 +99,7 @@ class _Window(ArchComponent.Component): def __init__(self,obj): ArchComponent.Component.__init__(self,obj) obj.addProperty("App::PropertyStringList","WindowParts","Base", - "the components of this window") + str(translate("Arch","the components of this window"))) self.Type = "Window" def execute(self,obj):