Arch : Internal object name are in English.

Arch objets Label could be translated.
This commit is contained in:
wood galaxy
2015-01-05 00:45:05 +01:00
committed by Yorik van Havre
parent 5657eed566
commit 95c0fe3a84
15 changed files with 260 additions and 247 deletions

View File

@@ -1,7 +1,7 @@
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
@@ -47,7 +47,7 @@ Roles = ["Beam","Column","Slab","Wall","Curtain Wall","Roof","Foundation","Pile"
Presets = [None,
# wood sections
["Wood","1x2in",19,28],
["Wood","1x3in",19,64],
["Wood","1x4in",19,89],
@@ -55,7 +55,7 @@ Presets = [None,
["Wood","1x8in",19,140],
["Wood","1x10in",19,184],
["Wood","1x12in",19,286],
["Wood","2x2in",38,38],
["Wood","2x3in",38,64],
["Wood","2x4in",38,89],
@@ -63,15 +63,15 @@ Presets = [None,
["Wood","2x8in",38,184],
["Wood","2x10in",38,235],
["Wood","2x12in",38,286],
["Wood","4x4in",89,89],
["Wood","4x6in",89,140],
["Wood","6x6in",140,140],
["Wood","8x8in",184,184],
# HEA
# HEA
["Steel","HEA100",100,96,5,8],
["Steel","HEA120",120,114,5,8],
["Steel","HEA140",140,133,5.5,8.5],
@@ -96,9 +96,9 @@ Presets = [None,
["Steel","HEA800",300,790,15,28],
["Steel","HEA900",300,890,16,30],
["Steel","HEA1000",300,990,16.5,31],
# HEAA
# HEAA
["Steel","HEAA100",100,91,4.2,5.5],
["Steel","HEAA120",120,109,4.2,5.5],
["Steel","HEAA140",140,128,4.3,6],
@@ -123,9 +123,9 @@ Presets = [None,
["Steel","HEAA800",300,770,14,18],
["Steel","HEAA900",300,870,15,20],
["Steel","HEAA1000",300,970,16,21],
# HEB
# HEB
["Steel","HEB100",100,100,6,10],
["Steel","HEB120",120,120,6.5,11],
["Steel","HEB140",140,140,7,12],
@@ -150,9 +150,9 @@ Presets = [None,
["Steel","HEB800",300,800,17.5,33],
["Steel","HEB900",300,900,18.5,35],
["Steel","HEB1000",300,1000,19,36],
# HEM
# HEM
["Steel","HEM160",166,180,14,23],
["Steel","HEM180",186,200,14.5,24],
["Steel","HEM200",206,220,15,25],
@@ -174,9 +174,9 @@ Presets = [None,
["Steel","HEM800",303,814,21,40],
["Steel","HEM900",302,910,21,40],
["Steel","HEM1000",302,1008,21,40],
# INP
["Steel","INP80",42,80,3.9,5.9],
["Steel","INP100",50,100,4.5,6.8],
["Steel","INP120",58,120,5.1,7.7],
@@ -195,8 +195,8 @@ Presets = [None,
["Steel","INP380",149,380,13.7,20.5],
["Steel","INP400",155,400,14.4,21.6],
# IPE
# IPE
["Steel","IPE100",55,100,4.1,5.7],
["Steel","IPE120",64,120,4.4,6.3],
["Steel","IPE140",73,140,4.7,6.9],
@@ -214,9 +214,9 @@ Presets = [None,
["Steel","IPE500",200,500,10.2,16],
["Steel","IPE550",210,550,11.1,17.2],
["Steel","IPE600",220,600,12,19],
# IPEA
# IPEA
["Steel","IPEA100",55,98,3.6,4.7],
["Steel","IPEA120",64,118,3.8,5.1],
["Steel","IPEA140",73,138,3.8,5.6],
@@ -234,9 +234,9 @@ Presets = [None,
["Steel","IPEA500",200,497,8.4,14.5],
["Steel","IPEA550",210,547,9,15.7],
["Steel","IPEA600",220,597,9.8,17.5],
# IPEO
# IPEO
["Steel","IPEO180",89,182,6.4,9.5],
["Steel","IPEO200",102,202,6.2,9.5],
["Steel","IPEO220",112,222,6.6,10.2],
@@ -250,9 +250,9 @@ Presets = [None,
["Steel","IPEO500",202,506,12,19],
["Steel","IPEO550",212,556,12.7,20.2],
["Steel","IPEO600",224,610,15,24],
# IPER
# IPER
["Steel","IPER140",72,142,5.3,7.8],
["Steel","IPER160",81,162,5.6,8.5],
["Steel","IPER180",92,183,6,9],
@@ -268,9 +268,9 @@ Presets = [None,
["Steel","IPER500",198,508,12.6,20],
["Steel","IPER550",210,560,14,22.2],
["Steel","IPER600",218,608,14,23],
# IPEV
# IPEV
["Steel","IPEV400",182,408,10.6,17.5],
["Steel","IPEV450",194,460,12.4,19.6],
["Steel","IPEV500",204,514,14.2,23],
@@ -287,13 +287,14 @@ Presets = [None,
]
def makeStructure(baseobj=None,length=None,width=None,height=None,name=translate("Arch","Structure")):
def makeStructure(baseobj=None,length=None,width=None,height=None,name="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
length and width for a cubic object.'''
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
obj.Label = translate("Arch",name)
_Structure(obj)
if FreeCAD.GuiUp:
_ViewProviderStructure(obj.ViewObject)
@@ -321,7 +322,7 @@ def makeStructure(baseobj=None,length=None,width=None,height=None,name=translate
obj.Role = "Column"
return obj
def makeStructuralSystem(objects=[],axes=[],name=translate("Arch","StructuralSystem")):
def makeStructuralSystem(objects=[],axes=[],name="StructuralSystem"):
'''makeStructuralSystem(objects,axes): makes a structural system
based on the given objects and axes'''
result = []
@@ -335,6 +336,7 @@ def makeStructuralSystem(objects=[],axes=[],name=translate("Arch","StructuralSys
objects = [None]
for o in objects:
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
obj.Label = translate("Arch",name)
_StructuralSystem(obj)
if FreeCAD.GuiUp:
_ViewProviderStructuralSystem(obj.ViewObject)
@@ -350,14 +352,15 @@ def makeStructuralSystem(objects=[],axes=[],name=translate("Arch","StructuralSys
return result[0]
else:
return result
def makeProfile(W=46,H=80,tw=3.8,tf=5.2,name="Profile"):
'''makeProfile(W,H,tw,tf): returns a shape with one face describing
'''makeProfile(W,H,tw,tf): returns a shape with one face describing
the profile of a steel beam (IPE, IPN, HE, etc...) based on the following
dimensions: W = total width, H = total height, tw = web thickness
tw = flange thickness (see http://en.wikipedia.org/wiki/I-beam for
reference)'''
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",name)
obj.Label = translate("Arch",name)
_Profile(obj)
obj.Width = W
obj.Height = H
@@ -377,8 +380,8 @@ class _CommandStructure:
def IsActive(self):
return not FreeCAD.ActiveDocument is None
def Activated(self):
def Activated(self):
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
self.Length = p.GetFloat("StructureLength",100)
self.Width = p.GetFloat("StructureWidth",100)
@@ -422,7 +425,7 @@ class _CommandStructure:
self.tracker.length(self.Length)
self.tracker.on()
FreeCADGui.Snapper.getPoint(callback=self.getPoint,movecallback=self.update,extradlg=self.taskbox())
def getPoint(self,point=None,obj=None):
"this function is called by the snapper when it has a 3D point"
self.tracker.finalize()
@@ -456,7 +459,7 @@ class _CommandStructure:
ui = FreeCADGui.UiLoader()
w.setWindowTitle(translate("Arch","Structure options").decode("utf8"))
grid = QtGui.QGridLayout(w)
# presets box
labelp = QtGui.QLabel(translate("Arch","Preset").decode("utf8"))
valuep = QtGui.QComboBox()
@@ -466,14 +469,14 @@ class _CommandStructure:
valuep.addItems(fpresets)
grid.addWidget(labelp,0,0,1,1)
grid.addWidget(valuep,0,1,1,1)
# length
label1 = QtGui.QLabel(translate("Arch","Length").decode("utf8"))
self.vLength = ui.createWidget("Gui::InputField")
self.vLength.setText(self.FORMAT % self.Length)
grid.addWidget(label1,1,0,1,1)
grid.addWidget(self.vLength,1,1,1,1)
# width
label2 = QtGui.QLabel(translate("Arch","Width").decode("utf8"))
self.vWidth = ui.createWidget("Gui::InputField")
@@ -487,7 +490,7 @@ class _CommandStructure:
self.vHeight.setText(self.FORMAT % self.Height)
grid.addWidget(label3,3,0,1,1)
grid.addWidget(self.vHeight,3,1,1,1)
# horizontal button
value5 = QtGui.QPushButton(translate("Arch","Rotate").decode("utf8"))
grid.addWidget(value5,4,0,1,2)
@@ -511,7 +514,7 @@ class _CommandStructure:
QtCore.QObject.connect(value4,QtCore.SIGNAL("stateChanged(int)"),self.setContinue)
QtCore.QObject.connect(value5,QtCore.SIGNAL("pressed()"),self.rotate)
return w
def update(self,point,info):
"this function is called by the Snapper when the mouse is moved"
if FreeCADGui.Control.activeDialog():
@@ -520,7 +523,7 @@ class _CommandStructure:
else:
delta = Vector(self.Length/2,0,0)
self.tracker.pos(point.add(delta))
def setWidth(self,d):
self.Width = d
self.tracker.width(d)
@@ -537,7 +540,7 @@ class _CommandStructure:
self.continueCmd = bool(i)
if hasattr(FreeCADGui,"draftToolBar"):
FreeCADGui.draftToolBar.continueMode = bool(i)
def setPreset(self,i):
if i > 0:
self.vLength.setText(self.FORMAT % float(Presets[i][2]))
@@ -546,7 +549,7 @@ class _CommandStructure:
self.Profile = i
else:
self.Profile = 0
def rotate(self):
l = self.Length
w = self.Width
@@ -554,7 +557,7 @@ class _CommandStructure:
self.vLength.setText(self.FORMAT % h)
self.vHeight.setText(self.FORMAT % w)
self.vWidth.setText(self.FORMAT % l)
class _Structure(ArchComponent.Component):
"The Structure object"
def __init__(self,obj):
@@ -569,12 +572,12 @@ class _Structure(ArchComponent.Component):
obj.addProperty("App::PropertyString","Profile","Arch",translate("Arch","A description of the standard profile this element is based upon"))
self.Type = "Structure"
obj.Role = Roles
def execute(self,obj):
"creates the structure shape"
import Part, DraftGeomUtils
normal,length,width,height = self.getDefaultValues(obj)
# creating base shape
@@ -613,7 +616,7 @@ class _Structure(ArchComponent.Component):
if base.Wires[0].isClosed():
base = Part.Face(base.Wires[0])
base = base.extrude(normal)
elif obj.Base.isDerivedFrom("Mesh::Feature"):
if obj.Base.Mesh.isSolid():
if obj.Base.Mesh.countComponents() == 1:
@@ -632,7 +635,7 @@ class _Structure(ArchComponent.Component):
normal = normal.multiply(height)
base = Part.Face(base[0])
base = base.extrude(normal)
base = self.processSubShapes(obj,base,pl)
self.applyShape(obj,base,pl)
@@ -676,7 +679,7 @@ class _ViewProviderStructure(ArchComponent.ViewProviderComponent):
def getIcon(self):
import Arch_rc
return ":/icons/Arch_Structure_Tree.svg"
def updateData(self,obj,prop):
if prop == "Nodes":
if obj.Nodes:
@@ -687,7 +690,7 @@ class _ViewProviderStructure(ArchComponent.ViewProviderComponent):
self.coords.point.setValues(0,len(p),p)
self.pointset.numPoints.setValue(len(p))
self.lineset.coordIndex.setValues(0,len(p)+1,range(len(p))+[-1])
def onChanged(self,vobj,prop):
if prop == "ShowNodes":
if hasattr(self,"nodes"):
@@ -729,14 +732,14 @@ class _ViewProviderStructure(ArchComponent.ViewProviderComponent):
class _Profile(Draft._DraftObject):
"A parametric beam profile object"
def __init__(self,obj):
obj.addProperty("App::PropertyLength","Width","Draft","Width of the beam").Width = 10
obj.addProperty("App::PropertyLength","Height","Draft","Height of the beam").Height = 30
obj.addProperty("App::PropertyLength","WebThickness","Draft","Thickness of the webs").WebThickness = 3
obj.addProperty("App::PropertyLength","FlangeThickness","Draft","Thickness of the flange").FlangeThickness = 2
Draft._DraftObject.__init__(self,obj,"Profile")
def execute(self,obj):
import Part
pl = obj.Placement
@@ -764,12 +767,12 @@ class _StructuralSystem(ArchComponent.Component):
obj.addProperty("App::PropertyLinkList","Axes","Arch",translate("Arch","Axes systems this structure is built on"))
obj.addProperty("App::PropertyIntegerList","Exclude","Arch",translate("Arch","The element numbers to exclude when this structure is based on axes"))
self.Type = "StructuralSystem"
def execute(self,obj):
"creates the structure shape"
import Part, DraftGeomUtils
# creating base shape
pl = obj.Placement
if obj.Base:
@@ -780,7 +783,7 @@ class _StructuralSystem(ArchComponent.Component):
return
base = None
# applying axes
pts = self.getAxisPoints(obj)
apl = self.getAxisPlacement(obj)
@@ -813,7 +816,7 @@ class _StructuralSystem(ArchComponent.Component):
obj.Shape = base
if not pl.isNull():
obj.Placement = pl
def getAxisPoints(self,obj):
"returns the gridpoints of linked axes"
import DraftGeomUtils
@@ -825,7 +828,7 @@ class _StructuralSystem(ArchComponent.Component):
set1 = obj.Axes[0].Shape.Edges
set2 = obj.Axes[1].Shape.Edges
for e1 in set1:
for e2 in set2:
for e2 in set2:
pts.extend(DraftGeomUtils.findIntersection(e1,e2))
return pts