Skip to content

Commit

Permalink
Arch: Merge of PR #2259 - Fix ifc project
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Aug 14, 2019
1 parent ce94398 commit a937461
Show file tree
Hide file tree
Showing 23 changed files with 12,848 additions and 2,475 deletions.
1 change: 1 addition & 0 deletions src/Mod/Arch/Arch.py
Expand Up @@ -43,6 +43,7 @@
from ArchWall import *
from ArchFloor import *
from ArchFence import *
from ArchProject import *
from ArchSite import *
from ArchBuilding import *
from ArchStructure import *
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Arch/ArchBuildingPart.py
Expand Up @@ -313,7 +313,7 @@ def Activated(self):



class BuildingPart:
class BuildingPart(ArchIFC.IfcProduct):


"The BuildingPart object"
Expand All @@ -326,7 +326,7 @@ def __init__(self,obj):
self.setProperties(obj)

def setProperties(self,obj):
ArchIFC.setProperties(obj)
ArchIFC.IfcProduct.setProperties(self, obj)

pl = obj.PropertiesList
if not "Height" in pl:
Expand Down Expand Up @@ -366,7 +366,7 @@ def onBeforeChange(self,obj,prop):

def onChanged(self,obj,prop):

ArchIFC.onChanged(obj, prop)
ArchIFC.IfcProduct.onChanged(self, obj, prop)

if prop == "Height":
for child in obj.Group:
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Arch/ArchCommands.py
Expand Up @@ -116,7 +116,7 @@ def addComponents(objectsList,host):
if not isinstance(objectsList,list):
objectsList = [objectsList]
hostType = Draft.getType(host)
if hostType in ["Floor","Building","Site","BuildingPart"]:
if hostType in ["Floor","Building","Site","Project","BuildingPart"]:
for o in objectsList:
host.addObject(o)
elif hostType in ["Wall","Structure","Window","Roof","Stairs","StructuralSystem","Panel","Component"]:
Expand Down Expand Up @@ -744,7 +744,7 @@ def pruneIncluded(objectslist,strict=False):
if obj.isDerivedFrom("Part::Feature"):
if not (Draft.getType(obj) in ["Window","Clone","Pipe","Rebar"]):
for parent in obj.InList:
if parent.isDerivedFrom("Part::Feature") and not (Draft.getType(parent) in ["Space","Facebinder","Window","Roof","Clone","Site"]):
if parent.isDerivedFrom("Part::Feature") and not (Draft.getType(parent) in ["Space","Facebinder","Window","Roof","Clone","Site","Project"]):
if not parent.isDerivedFrom("Part::Part2DObject"):
# don't consider 2D objects based on arch elements
if hasattr(parent,"Host") and (parent.Host == obj):
Expand Down
25 changes: 9 additions & 16 deletions src/Mod/Arch/ArchComponent.py
Expand Up @@ -133,22 +133,20 @@ def removeFromComponent(compobject,subobject):



class Component:

class Component(ArchIFC.IfcProduct):

"The default Arch Component object"

def __init__(self,obj):

def __init__(self, obj):
obj.Proxy = self
Component.setProperties(self,obj)
Component.setProperties(self, obj)
self.Type = "Component"

def setProperties(self,obj):
def setProperties(self, obj):

"Sets the needed properties of this object"

ArchIFC.setProperties(obj)
ArchIFC.IfcProduct.setProperties(self, obj)

pl = obj.PropertiesList
if not "Base" in pl:
Expand Down Expand Up @@ -195,9 +193,8 @@ def setProperties(self,obj):
#self.MoveWithHost = False
self.Type = "Component"

def onDocumentRestored(self,obj):

Component.setProperties(self,obj)
def onDocumentRestored(self, obj):
Component.setProperties(self, obj)

def execute(self,obj):

Expand All @@ -210,24 +207,20 @@ def execute(self,obj):
obj.Shape = shape

def __getstate__(self):

# for compatibility with 0.17
if hasattr(self,"Type"):
return self.Type
return "Component"

def __setstate__(self,state):

return None

def onBeforeChange(self,obj,prop):

if prop == "Placement":
self.oldPlacement = FreeCAD.Placement(obj.Placement)

def onChanged(self,obj,prop):

ArchIFC.onChanged(obj, prop)
def onChanged(self, obj, prop):
ArchIFC.IfcProduct.onChanged(self, obj, prop)

if prop == "Placement":
if hasattr(self,"oldPlacement"):
Expand Down
10 changes: 4 additions & 6 deletions src/Mod/Arch/ArchFloor.py
Expand Up @@ -22,7 +22,7 @@
#* *
#***************************************************************************

import FreeCAD,Draft,ArchCommands, DraftVecUtils
import FreeCAD,Draft,ArchCommands, DraftVecUtils, ArchIFC
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
Expand Down Expand Up @@ -121,7 +121,7 @@ def Activated(self):
FreeCAD.ActiveDocument.recompute()


class _Floor:
class _Floor(ArchIFC.IfcProduct):

"The Floor object"

Expand All @@ -134,6 +134,7 @@ def __init__(self,obj):

def setProperties(self,obj):

ArchIFC.IfcProduct.setProperties(self, obj)
pl = obj.PropertiesList
if not "Height" in pl:
obj.addProperty("App::PropertyLength","Height","Floor",QT_TRANSLATE_NOOP("App::Property","The height of this object"))
Expand All @@ -142,10 +143,6 @@ def setProperties(self,obj):
if not hasattr(obj,"Placement"):
# obj can be a Part Feature and already has a placement
obj.addProperty("App::PropertyPlacement","Placement","Base",QT_TRANSLATE_NOOP("App::Property","The placement of this object"))
if not "IfcType" in pl:
obj.addProperty("App::PropertyEnumeration","IfcType","IFC",QT_TRANSLATE_NOOP("App::Property","The type of this object"))
import ArchIFC
obj.IfcType = ArchIFC.IfcTypes
self.Type = "Floor"

def onDocumentRestored(self,obj):
Expand All @@ -161,6 +158,7 @@ def __setstate__(self,state):
return None

def onChanged(self,obj,prop):
ArchIFC.IfcProduct.onChanged(self, obj, prop)

if not hasattr(self,"Object"):
# on restore, self.Object is not there anymore
Expand Down

0 comments on commit a937461

Please sign in to comment.