Site.py
Go to the documentation of this file.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 Site"
00028 __author__ = "Yorik van Havre"
00029 __url__ = "http://free-cad.sourceforge.net"
00030
00031 def makeSite(objectslist,name="Site"):
00032 '''makeBuilding(objectslist): creates a site including the
00033 objects from the given list.'''
00034 obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
00035 Site(obj)
00036 ViewProviderSite(obj.ViewObject)
00037 obj.Components = objectslist
00038 obj.JoinMode = False
00039 return obj
00040
00041 class CommandSite:
00042 "the Arch Site command definition"
00043 def GetResources(self):
00044 return {'Pixmap' : 'Arch_Site',
00045 'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Site","Site"),
00046 'Accel': "S, I",
00047 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Site","Creates a site object including selected objects.")}
00048
00049 def Activated(self):
00050 FreeCAD.ActiveDocument.openTransaction("Site")
00051 makeSite(FreeCADGui.Selection.getSelection())
00052 FreeCAD.ActiveDocument.commitTransaction()
00053
00054 class Site(Cell.Cell):
00055 "The Site object"
00056 def __init__(self,obj):
00057 Cell.Cell.__init__(self,obj)
00058 self.Type = "Site"
00059
00060 def execute(self,obj):
00061 pass
00062
00063 def onChanged(self,obj,prop):
00064 pass
00065
00066 class ViewProviderSite(Cell.ViewProviderCell):
00067 "A View Provider for the Site object"
00068 def __init__(self,vobj):
00069 Cell.ViewProviderCell.__init__(self,vobj)
00070
00071 def getIcon(self):
00072 return """
00073 /* XPM */
00074 static char * Arch_Site_xpm[] = {
00075 "16 16 9 1",
00076 " c None",
00077 ". c #49370C",
00078 "+ c #204F0E",
00079 "@ c #535219",
00080 "# c #6F551D",
00081 "$ c #127210",
00082 "% c #049512",
00083 "& c #08BD16",
00084 "* c #00EB1B",
00085 " +$++ ",
00086 " $%%%$++++",
00087 " $&&%%$$$+@",
00088 " $&&&%%$$+@.",
00089 " &&&&%%$$+#.",
00090 " $*&&&%%$+##.",
00091 " &*&&&%%$@##.",
00092 " %**&&&%%+###.",
00093 " %***&&&%$@###.",
00094 " %****&&&%+##. ",
00095 "+&****&&&$@#. ",
00096 ".#+%&*&&$@#. ",
00097 " ..#@$%$@#. ",
00098 " ..#@@. ",
00099 " .. ",
00100 " "};
00101 """
00102
00103 FreeCADGui.addCommand('Arch_Site',CommandSite())