[Arch] - To allow exportIFC.py to work properly on sketch, which use only 1st face / wire.

Not fusing baseface in getExtrusionData(); fusing solids execute()

Forum Discussion - Arch Wall - Based on Sketch Issues

https://forum.freecadweb.org/viewtopic.php?f=39&t=31235&p=343444#p343444
This commit is contained in:
paullee0
2019-10-27 12:05:00 +08:00
committed by Yorik van Havre
parent a7ad04ba4a
commit 720d40a04e

View File

@@ -553,9 +553,13 @@ class _Wall(ArchComponent.Component):
obj.addProperty("App::PropertyInteger","Face","Wall",QT_TRANSLATE_NOOP("App::Property","The face number of the base object used to build this wall"))
if not "Offset" in lp:
obj.addProperty("App::PropertyDistance","Offset","Wall",QT_TRANSLATE_NOOP("App::Property","The offset between this wall and its baseline (only for left and right alignments)"))
if not "Refine" in lp:
obj.addProperty("App::PropertyEnumeration","Refine","Wall",QT_TRANSLATE_NOOP("App::Property","Select whether or not and the method to remove splitter of the Wall. Currently Draft removeSplitter and Part removeSplitter available but may not work on complex sketch."))
obj.Refine = ['No','DraftRemoveSplitter','PartRemoveSplitter']
# See getExtrusionData(), removeSplitters are no longer used
#if not "Refine" in lp:
# obj.addProperty("App::PropertyEnumeration","Refine","Wall",QT_TRANSLATE_NOOP("App::Property","Select whether or not and the method to remove splitter of the Wall. Currently Draft removeSplitter and Part removeSplitter available but may not work on complex sketch."))
# obj.Refine = ['No','DraftRemoveSplitter','PartRemoveSplitter']
# TODO - To implement in Arch Component ?
if not "MakeBlocks" in lp:
obj.addProperty("App::PropertyBool","MakeBlocks","Blocks",QT_TRANSLATE_NOOP("App::Property","Enable this to make the wall generate blocks"))
if not "BlockLength" in lp:
@@ -600,8 +604,18 @@ class _Wall(ArchComponent.Component):
for b in bplates:
b.Placement = extdata[2].multiply(b.Placement)
b = b.extrude(extv)
shps.append(b)
base = Part.makeCompound(shps)
# See getExtrusionData() - not fusing baseplates there - fuse solids here
# Remarks - If solids are fused, but exportIFC.py use underlying baseplates w/o fuse, the result in ifc look slightly different from in FC.
#shps.append(b)
if shps:
shps = shps.fuse(b) #shps.fuse(b)
else:
shps=b
# TODO - To let user to select whether to fuse (slower) or to do a compound (faster) only ?
#base = Part.makeCompound(shps)
base = shps
else:
bplates.Placement = extdata[2].multiply(bplates.Placement)
base = bplates.extrude(extv)
@@ -960,23 +974,38 @@ class _Wall(ArchComponent.Component):
sh.fix(0.1,0,1) # fixes self-intersecting wires
f = Part.Face(sh)
if baseface:
if layers:
if layers[i] >= 0:
baseface.append(f)
else:
baseface = baseface.fuse(f)
if obj.Refine == 'DraftRemoveSplitter':
s = DraftGeomUtils.removeSplitter(baseface)
if s:
baseface = s
elif obj.Refine == 'PartRemoveSplitter':
baseface = baseface.removeSplitter()
# To allow exportIFC.py to work properly on sketch, which use only 1st face / wire, do not fuse baseface here
# So for a sketch with multiple wires, each returns individual face (rather than fusing together) for exportIFC.py to work properly
# "ArchWall - Based on Sketch Issues" - https://forum.freecadweb.org/viewtopic.php?f=39&t=31235
#
baseface.append(f)
# The above make Refine methods below (in else) useless, regardless removeSpitters yet to be improved for cases do not work well
''' Whether layers or not, all baseface.append(f) '''
#if layers:
# if layers[i] >= 0:
# baseface.append(f)
#else:
#baseface = baseface.fuse(f)
#if obj.Refine == 'DraftRemoveSplitter':
# s = DraftGeomUtils.removeSplitter(baseface)
# if s:
# baseface = s
#elif obj.Refine == 'PartRemoveSplitter':
# baseface = baseface.removeSplitter()
else:
if layers:
if layers[i] >= 0:
baseface = [f]
else:
baseface = f
baseface = [f]
''' Whether layers or not, all baseface = [f] '''
#if layers:
# if layers[i] >= 0:
# baseface = [f]
#else:
#baseface = f
if baseface:
base,placement = self.rebase(baseface)
else: