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