Arch: misc bugfixes
This commit is contained in:
parent
6b1e6a66ad
commit
d5469ba3fc
|
@ -766,15 +766,15 @@ def toggleIfcBrepFlag(obj):
|
|||
FreeCAD.Console.PrintMessage(translate("Arch","Object doesn't have settable IFC Attributes"))
|
||||
else:
|
||||
d = obj.IfcAttributes
|
||||
if "ForceBrep" in d.keys():
|
||||
if d["ForceBrep"] == "True":
|
||||
d["ForceBrep"] = "False"
|
||||
if "FlagForceBrep" in d.keys():
|
||||
if d["FlagForceBrep"] == "True":
|
||||
d["FlagForceBrep"] = "False"
|
||||
FreeCAD.Console.PrintMessage(translate("Arch","Disabling Brep force flag of object")+" "+obj.Label+"\n")
|
||||
else:
|
||||
d["ForceBrep"] = "True"
|
||||
d["FlagForceBrep"] = "True"
|
||||
FreeCAD.Console.PrintMessage(translate("Arch","Enabling Brep force flag of object")+" "+obj.Label+"\n")
|
||||
else:
|
||||
d["ForceBrep"] = "True"
|
||||
d["FlagForceBrep"] = "True"
|
||||
FreeCAD.Console.PrintMessage(translate("Arch","Enabling Brep force flag of object")+" "+obj.Label+"\n")
|
||||
obj.IfcAttributes = d
|
||||
|
||||
|
|
|
@ -352,6 +352,8 @@ class Component:
|
|||
|
||||
def getProfiles(self,obj,noplacement=False):
|
||||
"Returns the base profile(s) of this component, if applicable"
|
||||
if not obj.Shape: return []
|
||||
if obj.Shape.isNull(): return []
|
||||
wires = []
|
||||
n,l,w,h = self.getDefaultValues(obj)
|
||||
if obj.Base:
|
||||
|
@ -411,7 +413,7 @@ class Component:
|
|||
wires.append(sh)
|
||||
else:
|
||||
wires.append(wire)
|
||||
else:
|
||||
elif Draft.getType(obj) in ["Wall","Structure"]:
|
||||
if (Draft.getType(obj) == "Structure") and (l > h):
|
||||
if noplacement:
|
||||
h2 = h/2 or 0.5
|
||||
|
|
|
@ -60,8 +60,6 @@ def makeStairs(baseobj=None,length=None,width=None,height=None,steps=None,name=t
|
|||
obj.Height = p.GetFloat("StairsHeight",3000.0)
|
||||
if steps:
|
||||
obj.NumberOfSteps = steps
|
||||
else:
|
||||
obj.NumberOfSteps = p.GetInt("StairsSteps",17)
|
||||
return obj
|
||||
|
||||
|
||||
|
@ -77,13 +75,14 @@ class _CommandStairs:
|
|||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Stairs"))
|
||||
FreeCADGui.doCommand("import Arch")
|
||||
if len(FreeCADGui.Selection.getSelection()) == 1:
|
||||
n = FreeCADGui.Selection.getSelection()[0].Name
|
||||
FreeCADGui.doCommand("Arch.makeStairs(baseobj=FreeCAD.ActiveDocument."+n+")")
|
||||
else:
|
||||
FreeCADGui.doCommand("Arch.makeStairs()")
|
||||
FreeCADGui.doCommand("Arch.makeStairs(steps="+str(p.GetInt("StairsSteps",17))+")")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
@ -138,62 +137,65 @@ class _Stairs(ArchComponent.Component):
|
|||
pl = obj.Placement
|
||||
landings = 0
|
||||
|
||||
# base tests
|
||||
if not obj.Width.Value:
|
||||
return
|
||||
if not obj.Height.Value:
|
||||
if not obj.Base:
|
||||
return
|
||||
if obj.NumberOfSteps < 2:
|
||||
return
|
||||
base = None
|
||||
|
||||
if obj.Base:
|
||||
if not obj.Base.isDerivedFrom("Part::Feature"):
|
||||
return
|
||||
if obj.Base.Shape.Solids:
|
||||
obj.Shape = obj.Base.Shape.copy()
|
||||
obj.Placement = FreeCAD.Placement(obj.Base.Placement).multiply(pl)
|
||||
obj.TreadDepth = 0.0
|
||||
obj.RiserHeight = 0.0
|
||||
return
|
||||
if not obj.Base.Shape.Edges:
|
||||
return
|
||||
if obj.Base.Shape.Faces:
|
||||
return
|
||||
if (len(obj.Base.Shape.Edges) == 1):
|
||||
edge = obj.Base.Shape.Edges[0]
|
||||
if isinstance(edge.Curve,Part.Line):
|
||||
if obj.Landings == "At center":
|
||||
landings = 1
|
||||
self.makeStraightStairsWithLanding(obj,edge)
|
||||
if hasattr(obj.Base,"Shape"):
|
||||
if obj.Base.Shape:
|
||||
if obj.Base.Shape.Solids:
|
||||
base = obj.Base.Shape.copy()
|
||||
|
||||
if (not base) and obj.Width.Value and obj.Height.Value and (obj.NumberOfSteps > 1):
|
||||
if obj.Base:
|
||||
if not obj.Base.isDerivedFrom("Part::Feature"):
|
||||
return
|
||||
if obj.Base.Shape.Solids:
|
||||
obj.Shape = obj.Base.Shape.copy()
|
||||
obj.Placement = FreeCAD.Placement(obj.Base.Placement).multiply(pl)
|
||||
obj.TreadDepth = 0.0
|
||||
obj.RiserHeight = 0.0
|
||||
return
|
||||
if not obj.Base.Shape.Edges:
|
||||
return
|
||||
if obj.Base.Shape.Faces:
|
||||
return
|
||||
if (len(obj.Base.Shape.Edges) == 1):
|
||||
edge = obj.Base.Shape.Edges[0]
|
||||
if isinstance(edge.Curve,Part.Line):
|
||||
if obj.Landings == "At center":
|
||||
landings = 1
|
||||
self.makeStraightStairsWithLanding(obj,edge)
|
||||
else:
|
||||
self.makeStraightStairs(obj,edge)
|
||||
else:
|
||||
self.makeStraightStairs(obj,edge)
|
||||
else:
|
||||
if obj.Landings == "At center":
|
||||
landings = 1
|
||||
self.makeCurvedStairsWithLandings(obj,edge)
|
||||
else:
|
||||
self.makeCurvedStairs(obj,edge)
|
||||
else:
|
||||
if not obj.Length.Value:
|
||||
return
|
||||
edge = Part.Line(Vector(0,0,0),Vector(obj.Length.Value,0,0)).toShape()
|
||||
if obj.Landings == "At center":
|
||||
landings = 1
|
||||
self.makeStraightStairsWithLanding(obj,edge)
|
||||
if obj.Landings == "At center":
|
||||
landings = 1
|
||||
self.makeCurvedStairsWithLandings(obj,edge)
|
||||
else:
|
||||
self.makeCurvedStairs(obj,edge)
|
||||
else:
|
||||
self.makeStraightStairs(obj,edge)
|
||||
if not obj.Length.Value:
|
||||
return
|
||||
edge = Part.Line(Vector(0,0,0),Vector(obj.Length.Value,0,0)).toShape()
|
||||
if obj.Landings == "At center":
|
||||
landings = 1
|
||||
self.makeStraightStairsWithLanding(obj,edge)
|
||||
else:
|
||||
self.makeStraightStairs(obj,edge)
|
||||
|
||||
if self.structures or self.steps:
|
||||
shape = Part.makeCompound(self.structures + self.steps)
|
||||
shape = self.processSubShapes(obj,shape,pl)
|
||||
obj.Shape = shape
|
||||
obj.Placement = pl
|
||||
base = Part.makeCompound(self.structures + self.steps)
|
||||
elif self.pseudosteps:
|
||||
shape = Part.makeCompound(self.pseudosteps)
|
||||
obj.Shape = shape
|
||||
obj.Placement = pl
|
||||
else:
|
||||
print "unable to calculate a stairs shape"
|
||||
return
|
||||
|
||||
base = self.processSubShapes(obj,base,pl)
|
||||
if base:
|
||||
if not base.isNull():
|
||||
obj.Shape = base
|
||||
obj.Placement = pl
|
||||
|
||||
# compute step data
|
||||
if obj.NumberOfSteps > 1:
|
||||
|
|
|
@ -1016,8 +1016,8 @@ def export(exportList,filename):
|
|||
# getting the "Force BREP" flag
|
||||
brepflag = False
|
||||
if hasattr(obj,"IfcAttributes"):
|
||||
if "ForceBrep" in obj.IfcAttributes.keys():
|
||||
if obj.IfcAttributes["ForceBrep"] == "True":
|
||||
if "FlagForceBrep" in obj.IfcAttributes.keys():
|
||||
if obj.IfcAttributes["FlagForceBrep"] == "True":
|
||||
brepflag = True
|
||||
|
||||
if DEBUG: print "Adding " + obj.Label + " as Ifc" + ifctype
|
||||
|
@ -1324,9 +1324,21 @@ def getIfcBrepFacesData(obj,scale=1,sub=False,tessellation=1):
|
|||
if not obj.Shape.isNull():
|
||||
if obj.Shape.isValid():
|
||||
shape = obj.Shape
|
||||
elif hasattr(obj,"Terrain"):
|
||||
if obj.Terrain:
|
||||
if hasattr(obj.Terrain,"Shape"):
|
||||
if obj.Terrain.Shape:
|
||||
if not obj.Terrain.Shape.isNull():
|
||||
if obj.Terrain.Shape.isValid():
|
||||
fcshape = obj.Terrain.Shape
|
||||
if shape:
|
||||
import Part
|
||||
sols = []
|
||||
if fcshape.Solids:
|
||||
dataset = fcshape.Solids
|
||||
else:
|
||||
dataset = fcshape.Shells
|
||||
print "Warning! object contains no solids"
|
||||
for sol in shape.Solids:
|
||||
s = []
|
||||
curves = False
|
||||
|
|
Loading…
Reference in New Issue
Block a user