Arch: Misc bugfixes

This commit is contained in:
Yorik van Havre
2019-07-05 20:58:44 -03:00
parent 20bdfee010
commit 07d3423add
5 changed files with 19 additions and 12 deletions

View File

@@ -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 ["Facebinder","Window","Roof","Clone","Site"]):
if parent.isDerivedFrom("Part::Feature") and not (Draft.getType(parent) in ["Space","Facebinder","Window","Roof","Clone","Site"]):
if not parent.isDerivedFrom("Part::Part2DObject"):
# don't consider 2D objects based on arch elements
if hasattr(parent,"Host") and (parent.Host == obj):
@@ -764,6 +764,8 @@ def pruneIncluded(objectslist,strict=False):
toplevel = True
if toplevel:
newlist.append(obj)
else:
FreeCAD.Console.PrintLog("pruning "+obj.Label+"n")
return newlist
def getAllChildren(objectlist):

View File

@@ -804,6 +804,7 @@ class _Wall(ArchComponent.Component):
if hasattr(obj,"Material"):
if obj.Material:
if hasattr(obj.Material,"Materials"):
# multimaterials
varwidth = 0
restwidth = width - sum(obj.Material.Thicknesses)
if restwidth > 0:
@@ -935,14 +936,15 @@ class _Wall(ArchComponent.Component):
offset = 0
base = []
for l in layers:
l2 = length/2 or 0.5
w1 = -totalwidth/2 + offset
w2 = w1 + l
v1 = Vector(-l2,w1,0)
v2 = Vector(l2,w1,0)
v3 = Vector(l2,w2,0)
v4 = Vector(-l2,w2,0)
base.append(Part.Face(Part.makePolygon([v1,v2,v3,v4,v1])))
if l > 0:
l2 = length/2 or 0.5
w1 = -totalwidth/2 + offset
w2 = w1 + l
v1 = Vector(-l2,w1,0)
v2 = Vector(l2,w1,0)
v3 = Vector(l2,w2,0)
v4 = Vector(-l2,w2,0)
base.append(Part.Face(Part.makePolygon([v1,v2,v3,v4,v1])))
offset += l
else:
l2 = length/2 or 0.5

View File

@@ -1881,6 +1881,8 @@ class _ArchWindowTaskPanel:
hinge = self.field6.property("text")
n = self.field7.currentIndex()
if (hinge.startswith("Edge")) and (n > 0):
# remove accelerator added by Qt
hinge = hinge.replace("&","")
t += "," + hinge + ",Mode" + str(n)
ar.append(t)

View File

@@ -1534,7 +1534,7 @@ def export(exportList,filename,colors=None):
# clean objects list of unwanted types
objectslist = [obj for obj in objectslist if obj not in annotations]
objectslist = Arch.pruneIncluded(objectslist,strict=True)
objectslist = [obj for obj in objectslist if Draft.getType(obj) not in ["Material","MaterialContainer","WorkingPlaneProxy"]]
objectslist = [obj for obj in objectslist if Draft.getType(obj) not in ["Dimension","Material","MaterialContainer","WorkingPlaneProxy"]]
if FULL_PARAMETRIC:
objectslist = Arch.getAllChildren(objectslist)
products = {} # { Name: IfcEntity, ... }
@@ -2146,7 +2146,7 @@ def export(exportList,filename,colors=None):
treated.append(c.Name)
if subs:
ifcfile.createIfcRelAggregates(
ifcopenshell.new(),
ifcopenshell.guid.new(),
history,
'Assembly',
'',
@@ -2170,7 +2170,7 @@ def export(exportList,filename,colors=None):
f = products[floor.Name]
if children:
ifcfile.createIfcRelContainedInSpatialStructure(
ifcopenshell.new(),
ifcopenshell.guid.new(),
history,
'StoreyLink',
'',

View File

@@ -262,6 +262,7 @@ def displayExternal(internValue,decimals=None,dim='Length',showUnit=True,unit=No
uom = "??"
if not showUnit:
uom = ""
decimals = abs(decimals) # prevent negative values
fmt = "{0:."+ str(decimals) + "f} "+ uom
displayExt = fmt.format(float(internValue) / float(conversion))
displayExt = displayExt.replace(".",QtCore.QLocale().decimalPoint())