Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code

This commit is contained in:
wmayer 2015-01-05 16:29:06 +01:00
commit 71efef4761
16 changed files with 332 additions and 320 deletions

View File

@ -36,10 +36,11 @@ __title__="FreeCAD Axis System"
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
def makeAxis(num=5,size=1000,name=translate("Arch","Axes")):
def makeAxis(num=5,size=1000,name="Axes"):
'''makeAxis(num,size): makes an Axis System
based on the given number of axes and interval distances'''
obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython",name)
obj.Label = translate("Arch",name)
_Axis(obj)
if FreeCAD.GuiUp:
_ViewProviderAxis(obj.ViewObject)

View File

@ -34,7 +34,7 @@ __title__="FreeCAD Building"
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
def makeBuilding(objectslist=None,baseobj=None,name=translate("Arch","Building")):
def makeBuilding(objectslist=None,baseobj=None,name="Building"):
'''makeBuilding(objectslist): creates a building including the
objects from the given list.'''
obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name)
@ -43,6 +43,7 @@ def makeBuilding(objectslist=None,baseobj=None,name=translate("Arch","Building")
_ViewProviderBuilding(obj.ViewObject)
if objectslist:
obj.Group = objectslist
obj.Label = translate("Arch",name)
return obj
class _CommandBuilding:

View File

@ -41,7 +41,7 @@ else:
Roles = ["Furniture", "Hydro Equipment", "Electric Equipment"]
def makeEquipment(baseobj=None,placement=None,name=translate("Arch","Equipment"),type=None):
def makeEquipment(baseobj=None,placement=None,name="Equipment",type=None):
"makeEquipment([baseobj,placement,name,type]): creates an equipment object from the given base object"
if type:
if type == "Part":
@ -62,7 +62,7 @@ def makeEquipment(baseobj=None,placement=None,name=translate("Arch","Equipment")
else:
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
_Equipment(obj)
obj.Label = name
obj.Label = translate("Arch",name)
if placement:
obj.Placement = placement
if FreeCAD.GuiUp:

View File

@ -34,11 +34,11 @@ __title__="FreeCAD Arch Floor"
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
def makeFloor(objectslist=None,baseobj=None,name=translate("Arch","Floor")):
def makeFloor(objectslist=None,baseobj=None,name="Floor"):
'''makeFloor(objectslist): creates a floor including the
objects from the given list.'''
obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name)
obj.Label = name
obj.Label = translate("Arch",name)
_Floor(obj)
if FreeCAD.GuiUp:
_ViewProviderFloor(obj.ViewObject)

View File

@ -42,6 +42,7 @@ def makeFrame(baseobj,profile,name=translate("Arch","Frame")):
"""makeFrame(baseobj,profile,[name]): creates a frame object from a base sketch (or any other object
containing wires) and a profile object (an extrudable 2D object containing faces or closed wires)"""
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
obj.Label = translate("Arch",name)
_Frame(obj)
if FreeCAD.GuiUp:
_ViewProviderFrame(obj.ViewObject)

View File

@ -43,12 +43,13 @@ Presets = [None,
["Plywoood 25mm, 1220 x 2440",1200,2400,18]]
def makePanel(baseobj=None,length=0,width=0,thickness=0,placement=None,name=translate("Arch","Panel")):
def makePanel(baseobj=None,length=0,width=0,thickness=0,placement=None,name="Panel"):
'''makePanel([obj],[length],[width],[thickness],[placement]): creates a
panel element based on the given profile object and the given
extrusion thickness. If no base object is given, you can also specify
length and width for a simple cubic object.'''
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
obj.Label = translate("Arch",name)
_Panel(obj)
_ViewProviderPanel(obj.ViewObject)
if baseobj:

View File

@ -36,11 +36,12 @@ __author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
def makeRebar(baseobj,sketch,diameter=None,amount=1,offset=None,name=translate("Arch","Rebar")):
def makeRebar(baseobj,sketch,diameter=None,amount=1,offset=None,name="Rebar"):
"""makeRebar(baseobj,sketch,[diameter,amount,offset,name]): adds a Reinforcement Bar object
to the given structural object, using the given sketch as profile."""
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
obj.Label = translate("Arch",name)
_Rebar(obj)
if FreeCAD.GuiUp:
_ViewProviderRebar(obj.ViewObject)

View File

@ -35,12 +35,13 @@ __title__="FreeCAD Roof"
__author__ = "Yorik van Havre", "Jonathan Wiedemann"
__url__ = "http://www.freecadweb.org"
def makeRoof(baseobj=None,facenr=1, angles=[45.,], run = [], idrel = [0,],thickness = [1.,], overhang=[2.,], name=translate("Arch","Roof")):
def makeRoof(baseobj=None,facenr=1, angles=[45.,], run = [], idrel = [0,],thickness = [1.,], overhang=[2.,], name="Roof"):
'''makeRoof(baseobj,[facenr],[angle],[name]) : Makes a roof based on a closed wire.
face from an existing object. You can provide a list of angles, run, idrel, thickness,
overhang for each edges in the wire to define the roof shape. The default for angle is 45
and the list is automatically complete to match with number of edges in the wire.'''
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
obj.Label = translate("Arch",name)
_Roof(obj)
if FreeCAD.GuiUp:
_ViewProviderRoof(obj.ViewObject)

View File

@ -32,10 +32,11 @@ else:
def translate(ctxt,txt):
return txt
def makeSectionPlane(objectslist=None,name=translate("Arch","Section")):
def makeSectionPlane(objectslist=None,name="Section"):
"""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("App::FeaturePython",name)
obj.Label = translate("Arch",name)
_SectionPlane(obj)
if FreeCAD.GuiUp:
_ViewProviderSectionPlane(obj.ViewObject)

View File

@ -34,10 +34,11 @@ __title__="FreeCAD Site"
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
def makeSite(objectslist=None,baseobj=None,name=translate("Arch","Site")):
def makeSite(objectslist=None,baseobj=None,name="Site"):
'''makeBuilding(objectslist): creates a site including the
objects from the given list.'''
obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name)
obj.Label = translate("Arch",name)
_Site(obj)
if FreeCAD.GuiUp:
_ViewProviderSite(obj.ViewObject)

View File

@ -38,11 +38,12 @@ else:
def translate(ctxt,txt):
return txt
def makeSpace(objects=None,baseobj=None,name=translate("Arch","Space")):
def makeSpace(objects=None,baseobj=None,name="Space"):
"""makeSpace([objects]): Creates a space object from the given objects. Objects can be one
document object, in which case it becomes the base shape of the space object, or a list of
selection objects as got from getSelectionEx(), or a list of tuples (object, subobjectname)"""
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
obj.Label = translate("Arch",name)
_Space(obj)
if FreeCAD.GuiUp:
_ViewProviderSpace(obj.ViewObject)

View File

@ -36,11 +36,12 @@ else:
return txt
def makeStairs(baseobj=None,length=None,width=None,height=None,steps=None,name=translate("Arch","Stairs")):
def makeStairs(baseobj=None,length=None,width=None,height=None,steps=None,name="Stairs"):
"""makeStairs([baseobj,length,width,height,steps]): creates a Stairs
objects with given attributes."""
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
obj.Label = translate("Arch",name)
_Stairs(obj)
if FreeCAD.GuiUp:
_ViewProviderStairs(obj.ViewObject)

View File

@ -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)
@ -358,6 +360,7 @@ def makeProfile(W=46,H=80,tw=3.8,tf=5.2,name="Profile"):
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

View File

@ -38,13 +38,14 @@ __url__ = "http://www.freecadweb.org"
# Possible roles for walls
Roles = ['Wall','Wall Layer','Beam','Column','Curtain Wall']
def makeWall(baseobj=None,length=None,width=None,height=None,align="Center",face=None,name=translate("Arch","Wall")):
def makeWall(baseobj=None,length=None,width=None,height=None,align="Center",face=None,name="Wall"):
'''makeWall([obj],[length],[width],[height],[align],[face],[name]): creates a wall based on the
given object, which can be a sketch, a draft object, a face or a solid, or no object at
all, then you must provide length, width and height. Align can be "Center","Left" or "Right",
face can be an index number of a face in the base object to base the wall on.'''
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
obj.Label = translate("Arch",name)
_Wall(obj)
if FreeCAD.GuiUp:
_ViewProviderWall(obj.ViewObject)

View File

@ -43,7 +43,7 @@ WindowPresets = ["Fixed", "Open 1-pane", "Open 2-pane", "Sash 2-pane",
Roles = ["Window","Door"]
def makeWindow(baseobj=None,width=None,height=None,parts=None,name=translate("Arch","Window")):
def makeWindow(baseobj=None,width=None,height=None,parts=None,name="Window"):
'''makeWindow(baseobj,[width,height,parts,name]): creates a window based on the
given base 2D object (sketch or draft).'''
@ -53,7 +53,7 @@ def makeWindow(baseobj=None,width=None,height=None,parts=None,name=translate("Ar
return obj
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
obj.Label = name
obj.Label = translate("Arch",name)
_Window(obj)
if FreeCAD.GuiUp:
_ViewProviderWindow(obj.ViewObject)
@ -515,18 +515,18 @@ class _CommandWindow:
"sets up a taskbox widget"
w = QtGui.QWidget()
ui = FreeCADGui.UiLoader()
w.setWindowTitle(translate("Arch","Window options"))
w.setWindowTitle(translate("Arch","Window options").decode("utf8"))
grid = QtGui.QGridLayout(w)
# sill height
labels = QtGui.QLabel(translate("Arch","Sill height"))
labels = QtGui.QLabel(translate("Arch","Sill height").decode("utf8"))
values = ui.createWidget("Gui::InputField")
grid.addWidget(labels,0,0,1,1)
grid.addWidget(values,0,1,1,1)
QtCore.QObject.connect(values,QtCore.SIGNAL("valueChanged(double)"),self.setSill)
# presets box
labelp = QtGui.QLabel(translate("Arch","Preset"))
labelp = QtGui.QLabel(translate("Arch","Preset").decode("utf8"))
valuep = QtGui.QComboBox()
valuep.addItems(["Create from scratch"]+WindowPresets)
valuep.setCurrentIndex(self.Preset)

View File

@ -688,7 +688,7 @@ class BezCurve(Line):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_BezCurve", "Creates a Bezier curve. CTRL to snap, SHIFT to constrain")}
def Activated(self):
Line.Activated(self,name=translate("draft","BezCurve"))
Line.Activated(self,name=translate("draft","BezCurve").decode("utf8"))
if self.doc:
self.bezcurvetrack = bezcurveTracker()
@ -2061,7 +2061,7 @@ class Move(Modifier):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Move", "Moves the selected objects between 2 points. CTRL to snap, SHIFT to constrain, ALT to copy")}
def Activated(self):
self.name = translate("draft","Move")
self.name = translate("draft","Move").decode("utf8")
Modifier.Activated(self,self.name)
self.ghost = None
if self.ui:
@ -2972,7 +2972,7 @@ class Scale(Modifier):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_Scale", "Scales the selected objects from a base point. CTRL to snap, SHIFT to constrain, ALT to copy")}
def Activated(self):
self.name = translate("draft","Scale")
self.name = translate("draft","Scale").decode("utf8")
Modifier.Activated(self,self.name)
self.ghost = None
if self.ui:
@ -4548,5 +4548,3 @@ FreeCADGui.addCommand('Draft_Snap_WorkingPlane',Draft_Snap_WorkingPlane())
# a global place to look for active draft Command
FreeCAD.activeDraftCommand = None