diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 66c97189f..0e62d9d6f 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -676,6 +676,8 @@ class ViewProviderComponent: c.append(s) if hasattr(self.Object,"Armatures"): c.extend(self.Object.Armatures) + if hasattr(self.Object,"Group"): + c.extend(self.Object.Group) if hasattr(self.Object,"Tool"): if self.Object.Tool: c.append(self.Object.Tool) diff --git a/src/Mod/Arch/ArchEquipment.py b/src/Mod/Arch/ArchEquipment.py index 99152a523..faf57b0fa 100644 --- a/src/Mod/Arch/ArchEquipment.py +++ b/src/Mod/Arch/ArchEquipment.py @@ -57,7 +57,7 @@ def makeEquipment(baseobj=None,placement=None,name=translate("Arch","Equipment") _ViewProviderEquipment(obj.ViewObject) if baseobj: baseobj.ViewObject.hide() - + return obj def createMeshView(obj,direction=FreeCAD.Vector(0,0,-1),outeronly=False,largestonly=False): """createMeshView(obj,[direction,outeronly,largestonly]): creates a flat shape that is the diff --git a/src/Mod/Arch/ArchSpace.py b/src/Mod/Arch/ArchSpace.py index 3a64b924a..791a56a48 100644 --- a/src/Mod/Arch/ArchSpace.py +++ b/src/Mod/Arch/ArchSpace.py @@ -113,6 +113,7 @@ class _Space(ArchComponent.Component): obj.addProperty("App::PropertyString", "FinishFloor", "Arch",translate("Arch","The finishing of the floor of this space")) obj.addProperty("App::PropertyString", "FinishWalls", "Arch",translate("Arch","The finishing of the walls of this space")) obj.addProperty("App::PropertyString", "FinishCeiling","Arch",translate("Arch","The finishing of the ceiling of this space")) + obj.addProperty("App::PropertyLinkList", "Group", "Arch",translate("Arch","Objects that are included inside this space, such as furniture")) self.Type = "Space" def execute(self,obj): diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index 46e3c179f..3571a1b0c 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -40,8 +40,16 @@ typesmap = { "Site": ["IfcSite"], "Stairs": ["IfcStair", "IfcStairFlight", "IfcRamp", "IfcRampFlight"], "Space": ["IfcSpace"], "Rebar": ["IfcReinforcingBar"], - "Equipment": ["IfcFurnishingElement","IfcFurniture","IfcSanitaryTerminal","IfcFlowTerminal","IfcElectricAppliance"] + "Equipment": ["IfcFurnishingElement","IfcSanitaryTerminal","IfcFlowTerminal","IfcElectricAppliance"] } + +translationtable = { "Foundation":"Footing", + "Floor":"BuildingStorey", + "Rebar":"ReinforcingBar", + "HydroEquipment":"SanitaryTerminal", + "ElectricEquipment":"ElectricAppliance", + "Furniture":"FurnishingElement" + } ifctemplate = """ISO-10303-21; HEADER; @@ -74,15 +82,6 @@ ENDSEC; END-ISO-10303-21; """ -ifctypes = ["IfcSite", "IfcBuilding", "IfcBuildingStorey", "IfcBeam", "IfcBeamStandardCase", - "IfcChimney", "IfcColumn", "IfcColumnStandardCase", "IfcCovering", "IfcCurtainWall", - "IfcDoor", "IfcDoorStandardCase", "IfcMember", "IfcMemberStandardCase", "IfcPlate", - "IfcPlateStandardCase", "IfcRailing", "IfcRamp", "IfcRampFlight", "IfcRoof", - "IfcSlab", "IfcStair", "IfcStairFlight", "IfcWall","IfcSpace", - "IfcWallStandardCase", "IfcWindow", "IfcWindowStandardCase", "IfcBuildingElementProxy", - "IfcPile", "IfcFooting", "IfcReinforcingBar", "IfcTendon", "IfcGroup", - "FurnishingElement", "SanitaryTerminal", "ElectricAppliance"] - def explore(filename=None): "opens a dialog showing the contents of an IFC file" @@ -186,6 +185,15 @@ def insert(filename,docname,skip=[]): if ptype in ifctypes: obj = getattr(Arch,"make"+freecadtype)(baseobj=baseobj,name=name) obj.Label = name + # setting role + try: + r = ptype[3:] + tr = dict((v,k) for k, v in translationtable.iteritems()) + if r in tr.keys(): + r = tr[r] + obj.Role = r + except: + pass # setting uid if hasattr(obj,"IfcAttributes"): a = obj.IfcAttributes @@ -293,21 +301,14 @@ def export(exportList,filename): ifctype = obj.Role.replace(" ","") else: ifctype = Draft.getType(obj) - if ifctype == "Foundation": - ifctype = "Footing" - elif ifctype == "Floor": - ifctype = "BuildingStorey" - elif ifctype == "Rebar": - ifctype = "ReinforcingBar" - elif ifctype == "HydroEquipment": - ifctype = "SanitaryTerminal" - elif ifctype == "ElectricEquipment": - ifctype = "ElectricAppliance" - elif ifctype == "Furniture": - ifctype = "FurnishingElement" + if ifctype in translationtable.keys(): + ifctype = translationtable[ifctype] ifctype = "Ifc" + ifctype if ifctype == "IfcGroup": continue + ifctypes = [] + for v in typesmap.values(): + ifctypes.extend(v) if not ifctype in ifctypes: ifctype = "IfcBuildingElementProxy" diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 02153e49d..7db5a166c 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -314,7 +314,7 @@ def getGroupContents(objectslist,walls=False,addgroups=False): if not isinstance(objectslist,list): objectslist = [objectslist] for obj in objectslist: - if obj.isDerivedFrom("App::DocumentObjectGroup"): + if obj.isDerivedFrom("App::DocumentObjectGroup") or ((getType(obj) == "Space") and hasattr(obj,"Group")): if obj.isDerivedFrom("Drawing::FeaturePage"): # skip if the group is a page newlist.append(obj)