add subvolume property

This commit is contained in:
Mark Peres
2024-02-11 19:53:10 +03:00
committed by Yorik van Havre
parent 6717065a2b
commit adf69f23f6

View File

@@ -308,6 +308,11 @@ class _Roof(ArchComponent.Component):
"Flip",
"Roof",
QT_TRANSLATE_NOOP("App::Property", "Specifies if the direction of the roof should be flipped"))
if not "Subvolume" in pl:
obj.addProperty("App::PropertyLink",
"Subvolume",
"Roof",
QT_TRANSLATE_NOOP("App::Property", "An optional object that defines a volume to be subtracted from walls. If field is set - it has a priority over auto-generated subvolume"))
self.Type = "Roof"
def onDocumentRestored(self, obj):
@@ -825,6 +830,10 @@ class _Roof(ArchComponent.Component):
def getSubVolume(self, obj):
'''returns a volume to be subtracted'''
custom_subvolume = getattr(obj, 'Subvolume', None)
if custom_subvolume:
return custom_subvolume.Shape
if not obj.Base:
return None