Arch: Renamed Role property to IfcRole
This commit is contained in:
@@ -95,7 +95,7 @@ def makeStructure(baseobj=None,length=None,width=None,height=None,name="Structur
|
||||
# gets wrong
|
||||
obj.Length = p.GetFloat("StructureLength",100)
|
||||
if obj.Height > obj.Length:
|
||||
obj.Role = "Column"
|
||||
obj.IfcRole = "Column"
|
||||
return obj
|
||||
|
||||
def makeStructuralSystem(objects=[],axes=[],name="StructuralSystem"):
|
||||
@@ -460,7 +460,7 @@ class _Structure(ArchComponent.Component):
|
||||
obj.addProperty("App::PropertyEnumeration","FaceMaker","Arch",QT_TRANSLATE_NOOP("App::Property","The facemaker type to use to build the profile of this object"))
|
||||
self.Type = "Structure"
|
||||
obj.FaceMaker = ["None","Simple","Cheese","Bullseye"]
|
||||
obj.Role = "Beam"
|
||||
obj.IfcRole = "Beam"
|
||||
|
||||
def execute(self,obj):
|
||||
"creates the structure shape"
|
||||
@@ -514,6 +514,10 @@ class _Structure(ArchComponent.Component):
|
||||
|
||||
def getExtrusionData(self,obj):
|
||||
"""returns (shape,extrusion vector,placement) or None"""
|
||||
if hasattr(obj,"IfcRole"):
|
||||
role = obj.IfcRole
|
||||
else:
|
||||
role = obj.Role
|
||||
import Part,DraftGeomUtils
|
||||
data = ArchComponent.Component.getExtrusionData(self,obj)
|
||||
if data:
|
||||
@@ -572,7 +576,7 @@ class _Structure(ArchComponent.Component):
|
||||
baseface = Part.Face(w)
|
||||
base,placement = self.rebase(baseface)
|
||||
elif length and width and height:
|
||||
if (length > height) and (obj.Role != "Slab"):
|
||||
if (length > height) and (role != "Slab"):
|
||||
h2 = height/2 or 0.5
|
||||
w2 = width/2 or 0.5
|
||||
v1 = Vector(0,-w2,-h2)
|
||||
@@ -598,7 +602,7 @@ class _Structure(ArchComponent.Component):
|
||||
if not normal.Length:
|
||||
normal = Vector(0,0,1)
|
||||
extrusion = normal
|
||||
if (length > height) and (obj.Role != "Slab"):
|
||||
if (length > height) and (role != "Slab"):
|
||||
if length:
|
||||
extrusion = normal.multiply(length)
|
||||
else:
|
||||
@@ -608,6 +612,12 @@ class _Structure(ArchComponent.Component):
|
||||
return None
|
||||
|
||||
def onChanged(self,obj,prop):
|
||||
if hasattr(obj,"IfcRole"):
|
||||
role = obj.IfcRole
|
||||
elif hasattr(obj,"Role"):
|
||||
role = obj.Role
|
||||
else:
|
||||
role = None
|
||||
self.hideSubobjects(obj,prop)
|
||||
if prop in ["Shape","ResetNodes","NodesOffset"]:
|
||||
# ResetNodes is not a property but it allows us to use this function to force reset the nodes
|
||||
@@ -616,7 +626,7 @@ class _Structure(ArchComponent.Component):
|
||||
if extdata:
|
||||
nodes = extdata[0]
|
||||
nodes.Placement = nodes.Placement.multiply(extdata[2])
|
||||
if obj.Role not in ["Slab"]:
|
||||
if role not in ["Slab"]:
|
||||
if obj.Tool:
|
||||
nodes = obj.Tool.Shape
|
||||
elif extdata[1].Length > 0:
|
||||
@@ -698,9 +708,13 @@ class _ViewProviderStructure(ArchComponent.ViewProviderComponent):
|
||||
self.coords.point.set1Value(len(p),p[0][0],p[0][1],p[0][2])
|
||||
self.lineset.coordIndex.setValues(0,len(p)+2,range(len(p)+1)+[-1])
|
||||
self.faceset.coordIndex.setValues(0,len(p)+1,range(len(p))+[-1])
|
||||
elif prop == "Role":
|
||||
elif prop in ["Role","IfcRole"]:
|
||||
if hasattr(obj.ViewObject,"NodeType"):
|
||||
if obj.Role == "Slab":
|
||||
if hasattr(obj,"IfcRole"):
|
||||
role = obj.IfcRole
|
||||
else:
|
||||
role = obj.Role
|
||||
if role == "Slab":
|
||||
obj.ViewObject.NodeType = "Area"
|
||||
else:
|
||||
obj.ViewObject.NodeType = "Linear"
|
||||
|
||||
Reference in New Issue
Block a user