Arch: optimizations in IFC import + furniture objects can be included in spaces
This commit is contained in:
parent
850d0b5e82
commit
f647f25490
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user