diff --git a/src/Mod/Arch/ArchEquipment.py b/src/Mod/Arch/ArchEquipment.py index 281d83877..d81534c96 100644 --- a/src/Mod/Arch/ArchEquipment.py +++ b/src/Mod/Arch/ArchEquipment.py @@ -241,6 +241,7 @@ class _Equipment(ArchComponent.Component): obj.addProperty("App::PropertyString","Model","Arch","The model description of this equipment") obj.addProperty("App::PropertyString","Url","Arch","The url of the product page of this equipment") obj.addProperty("App::PropertyVectorList","SnapPoints","Arch","Additional snap points for this equipment") + obj.addProperty("App::PropertyFloat","EquipmentPower","Arch","The electric power needed by this equipment in Watts") self.Type = "Equipment" obj.Role = Roles obj.Proxy = self diff --git a/src/Mod/Arch/ArchFloor.py b/src/Mod/Arch/ArchFloor.py index ee4200842..db239331b 100644 --- a/src/Mod/Arch/ArchFloor.py +++ b/src/Mod/Arch/ArchFloor.py @@ -98,6 +98,7 @@ class _Floor: "The Floor object" def __init__(self,obj): obj.addProperty("App::PropertyLength","Height","Arch","The height of this object") + obj.addProperty("App::PropertyArea","Area", "Arch","The computed floor area of this floor") if not hasattr(obj,"Placement"): # obj can be a Part Feature and already has a placement obj.addProperty("App::PropertyPlacement","Placement","Arch","The placement of this object") @@ -116,6 +117,14 @@ class _Floor: if not hasattr(self,"Object"): # on restore, self.Object is not there anymore self.Object = obj + if (prop == "Group") and hasattr(obj,"Area"): + a = 0 + for o in Draft.getObjectsOfType(Draft.getGroupContents(obj.Group,addgroups=True),"Space"): + if hasattr(o,"Area"): + if hasattr(o.Area,"Value"): + a += o.Area.Value + if obj.Area.Value != a: + obj.Area = a def execute(self,obj): # move children with this floor diff --git a/src/Mod/Arch/ArchSite.py b/src/Mod/Arch/ArchSite.py index 52565625c..25ff52e88 100644 --- a/src/Mod/Arch/ArchSite.py +++ b/src/Mod/Arch/ArchSite.py @@ -117,6 +117,7 @@ class _Site(ArchFloor._Floor): obj.addProperty("App::PropertyString","Country","Arch","The country of this site") obj.addProperty("App::PropertyFloat","Latitude","Arch","The latitude of this site") obj.addProperty("App::PropertyFloat","Longitude","Arch","The latitude of this site") + obj.addProperty("App::PropertyLength","Elevation","Arch","The elevation of level 0 of this site") obj.addProperty("App::PropertyString","Url","Arch","An url that shows this site in a mapping website") obj.addProperty("App::PropertyLinkList","Group","Arch","The objects that are part of this site") obj.addProperty("App::PropertyLinkList","Additions","Arch","Other shapes that are appended to this object") diff --git a/src/Mod/Arch/ArchSpace.py b/src/Mod/Arch/ArchSpace.py index 5c8cc4962..62a91d4ca 100644 --- a/src/Mod/Arch/ArchSpace.py +++ b/src/Mod/Arch/ArchSpace.py @@ -141,6 +141,15 @@ SpaceTypes = [ "Transportation - Terminal - Ticket Counter" ] +ConditioningTypes = [ +"Unconditioned", +"Heated", +"Cooled", +"HeatedAndCooled", +"Vented", +"NaturallyVentedOnly" +] + import FreeCAD,ArchComponent,ArchCommands,math,Draft if FreeCAD.GuiUp: import FreeCADGui @@ -224,15 +233,22 @@ class _Space(ArchComponent.Component): def __init__(self,obj): ArchComponent.Component.__init__(self,obj) obj.addProperty("App::PropertyLinkSubList","Boundaries", "Arch","The objects that make the boundaries of this space object") - obj.addProperty("App::PropertyFloat", "Area", "Arch","The computed floor area of this space") + obj.addProperty("App::PropertyArea", "Area", "Arch","The computed floor area of this space") obj.addProperty("App::PropertyString", "FinishFloor", "Arch","The finishing of the floor of this space") obj.addProperty("App::PropertyString", "FinishWalls", "Arch","The finishing of the walls of this space") obj.addProperty("App::PropertyString", "FinishCeiling", "Arch","The finishing of the ceiling of this space") obj.addProperty("App::PropertyLinkList", "Group", "Arch","Objects that are included inside this space, such as furniture") obj.addProperty("App::PropertyEnumeration","SpaceType", "Arch","The type of this space") obj.addProperty("App::PropertyLength", "FloorThickness","Arch","The thickness of the floor finish") + obj.addProperty("App::PropertyLink", "Zone", "Arch","A zone this space is part of") + obj.addProperty("App::PropertyInteger", "NumberOfPeople","Arch","The number of people who typically occupy this space") + obj.addProperty("App::PropertyFloat", "LightingPower", "Arch","The electric power needed to light this space in Watts") + obj.addProperty("App::PropertyFloat", "EquipmentPower","Arch","The electric power needed by the equipments of this space in Watts") + obj.addProperty("App::PropertyBool", "AutoPower", "Arch","If True, Equipment Power will be automatically filled by the equipments included in this space") + obj.addProperty("App::PropertyEnumeration","Conditioning", "Arch","The type of air conditioning of this space") self.Type = "Space" - self.SpaceType = "Undefined" + obj.SpaceType = SpaceTypes + obj.Conditioning = ConditioningTypes obj.Role = Roles def execute(self,obj): @@ -245,7 +261,19 @@ class _Space(ArchComponent.Component): def onChanged(self,obj,prop): if prop in ["Boundaries","Base"]: self.getShape(obj) - obj.Area = self.getArea(obj) + if hasattr(obj.Area,"Value"): + a = self.getArea(obj) + if obj.Area.Value != a: + obj.Area = a + elif prop == "Group": + if hasattr(obj,"EquipmentPower"): + if obj.AutoPower: + p = 0 + for o in Draft.getObjectsOfType(Draft.getGroupContents(obj.Group,addgroups=True),"Equipment"): + if hasattr(o,"EquipmentPower"): + p += o.EquipmentPower + if p != obj.EquipmentPower: + obj.EquipmentPower = p if hasattr(obj,"Area"): obj.setEditorMode('Area',1) diff --git a/src/Mod/Arch/importGBXML.py b/src/Mod/Arch/importGBXML.py index ab03066db..c2fc7dcbc 100644 --- a/src/Mod/Arch/importGBXML.py +++ b/src/Mod/Arch/importGBXML.py @@ -33,18 +33,15 @@ else: def translate(ctx,txt): return txt -if open.__module__ == '__builtin__': - pyopen = open # because we'll redefine open below - def export(objectslist,filename): if len(objectslist) != 1: - FreeCAD.Console.PrintError(translate("Arch","This exporter can currently only export one site object")) + FreeCAD.Console.PrintError(translate("Arch","This exporter can currently only export one site object\n")) return site = objectslist[0] if Draft.getType(site) != "Site": - FreeCAD.Console.PrintError(translate("Arch","This exporter can currently only export one site object")) + FreeCAD.Console.PrintError(translate("Arch","This exporter can currently only export one site object\n")) return filestream = pyopen(filename,"wb") @@ -52,35 +49,84 @@ def export(objectslist,filename): # header filestream.write( '\n' ) filestream.write( '\n' % FreeCAD.Version()[0]+FreeCAD.Version()[1]+FreeCAD.Version()[2] ) - filestream.write( '\n' ) + filestream.write( '\n' ) filestream.write( '\n' ) # campus filestream.write( '\n' % site.Name ) filestream.write( '\n' ) filestream.write( ' %s\n' % site.PostalCode ) + filestream.write( ' %f\n' % site.Longitude ) + filestream.write( ' %f\n' % site.Latitude ) + filestream.write( ' %f/Elevation>\n' % site.Elevation.Value ) + filestream.write( ' %s\n' % site.Label ) + #filestream.write( ' 0\n' ) + #filestream.write( ' 53158_2004\n' ) filestream.write( '\n' ) - # building + # buildings for building in site.Group: if Draft.getType(building) == "Building": - area = 10000.0 # TODO calculate filestream.write( ' \n' % (building.Name,building.BuildingType) ) - filestream.write( ' $f\n' % area ) - - # space - for space in Draft.getGroupContents(building): - if Draft.getType(space) == "Space": - zone = "BLABLA" # TODO build values - filestream.write( ' \n' % (space.Name, space.SpaceType, zone) ) - filestream.write( ' %s\n' % space.Label ) - filestream.write( ' %s\n' % space.Description ) - filestream.write( ' %s\n' % space.Label ) - #filestream.write( ' 1.00000\n' ) - #filestream.write( ' 1.50000\n' ) - #filestream.write( ' 0.00000\n' ) - filestream.write( ' $f\n' % space.Area + filestream.write( ' $f\n' % str(building.Area.getValueAs("m^2")) ) + # spaces + for space in Draft.getObjectsOfType(Draft.getGroupContents(building.Group,addgroups=True),"Space"): + if not space.Zone: + FreeCAD.Console.PrintError(translate("Arch","Error: Space '%s' has no Zone. Aborting.\n") % space.Label) + return + filestream.write( ' \n' % (space.Name, space.SpaceType, space.Zone.Name, space.Conditioning) ) + #filestream.write( ' %s\n' % space.Name ) # not sure what this is used for? + filestream.write( ' %s\n' % space.Label ) + filestream.write( ' %s\n' % space.Description ) + filestream.write( ' %i\n' % space.NumberOfPeople) + filestream.write( ' %f\n' % space.LightingPower/space.Area.getValueAs("m^2") ) + filestream.write( ' %f\n' % space.EquipmentPower/space.Area.getValueAs("m^2") ) + filestream.write( ' $f\n' % space.Area.getValueAs("m^2") ) + filestream.write( ' $f\n' % FreeCAD.Units.Quantity(space.Shape.Volume,FreeCAD.Units.Volume).getValueAs("m^3") ) + filestream.write( ' \n' % space.Name ) + + # shells + for solid in space.Shape.Solids: + filestream.write( ' \n' ) + for face in solid.Faces: + filestream.write( ' \n' ) + for v in face.OuterWire.Vertexes: + filestream.write( ' \n' ) + filestream.write( ' %f\n' % v.Point.x ) + filestream.write( ' %f\n' % v.Point.y ) + filestream.write( ' %f\n' % v.Point.z ) + filestream.write( ' \n' ) + filestream.write( ' \n' ) + filestream.write( ' \n' ) + filestream.write( ' \n' ) + filestream.write( ' \n' ) + + # surfaces + for i,face in enumerate(space.Shape.Faces): + filestream.write( ' \n' ) + filestream.write( ' \n' ) + for v in face.OuterWire.Vertexes: + filestream.write( ' \n' ) + filestream.write( ' %f\n' % v.Point.x ) + filestream.write( ' %f\n' % v.Point.y ) + filestream.write( ' %f\n' % v.Point.z ) + filestream.write( ' \n' ) + filestream.write( ' \n' ) + filestream.write( ' \n' ) + filestream.write( ' \n' ) + + filestream.write( ' \n' ) filestream.write( ' \n' ) @@ -127,6 +173,37 @@ def export(objectslist,filename): + + + + + + 9.981497 + -31.19363 + 0 + + + 9.981497 + -5.193626 + 0 + + + 9.981497 + -5.193626 + 100 + + + 9.981497 + -31.19363 + 100 + + + + + + + + 21E2 @@ -393,6 +470,14 @@ def export(objectslist,filename): 80.00000 + + + Autodesk, Inc. + Autodesk Project Vasari CEA + TP2.0 20110514_1800 + Microsoft Windows XP + + sp3_LabandCorridor_Lab1