00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 import Cell,FreeCAD,FreeCADGui
00025 from PyQt4 import QtCore
00026
00027 __title__="FreeCAD Arch Floor"
00028 __author__ = "Yorik van Havre"
00029 __url__ = "http://free-cad.sourceforge.net"
00030
00031 def makeFloor(objectslist,join=True,name="Floor"):
00032 '''makeFloor(objectslist,[joinmode]): creates a floor including the
00033 objects from the given list. If joinmode is False, components will
00034 not be joined.'''
00035 obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
00036 Floor(obj)
00037 ViewProviderFloor(obj.ViewObject)
00038 obj.Components = objectslist
00039 for comp in obj.Components:
00040 comp.ViewObject.hide()
00041 obj.JoinMode = join
00042 return obj
00043
00044 class CommandFloor:
00045 "the Arch Cell command definition"
00046 def GetResources(self):
00047 return {'Pixmap' : 'Arch_Floor',
00048 'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Floor","Floor"),
00049 'Accel': "F, R",
00050 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Floor","Creates a floor object including selected objects")}
00051
00052 def Activated(self):
00053 FreeCAD.ActiveDocument.openTransaction("Floor")
00054 makeFloor(FreeCADGui.Selection.getSelection())
00055 FreeCAD.ActiveDocument.commitTransaction()
00056
00057 class Floor(Cell.Cell):
00058 "The Cell object"
00059 def __init__(self,obj):
00060 Cell.Cell.__init__(self,obj)
00061 obj.addProperty("App::PropertyLength","Height","Base",
00062 "The height of this floor")
00063 self.Type = "Floor"
00064
00065 class ViewProviderFloor(Cell.ViewProviderCell):
00066 "A View Provider for the Cell object"
00067 def __init__(self,vobj):
00068 Cell.ViewProviderCell.__init__(self,vobj)
00069
00070 def getIcon(self):
00071 return """
00072 /* XPM */
00073 static char * Arch_Floor_xpm[] = {
00074 "16 16 9 1",
00075 " c None",
00076 ". c #171817",
00077 "+ c #2E2876",
00078 "@ c #545653",
00079 "# c #605C98",
00080 "$ c #959794",
00081 "% c #9694BC",
00082 "& c #C8C9CC",
00083 "* c #F9FBFA",
00084 " ",
00085 " ",
00086 "............... ",
00087 ".&&%&*&%%%%%&*. ",
00088 ".&++#*#+++++#*. ",
00089 ".&+%****&+*+#*. ",
00090 ".&+#%%&*&+*+#*. ",
00091 ".&++++&**+*+#*. ",
00092 ".&+%***%%**+.$. ",
00093 ".&++###*#+#.$@. ",
00094 ".&++++#*+++.&.. ",
00095 ".&********&.. ",
00096 ".$$$$$$$$$@. ",
00097 " .......... ",
00098 " ",
00099 " "};
00100 """
00101
00102 FreeCADGui.addCommand('Arch_Floor',CommandFloor())