Arch: Removed Armatures property from Structures + added Host property to Rebars
This commit is contained in:
@@ -158,7 +158,7 @@ class ComponentTaskPanel:
|
||||
# the categories are shown only if they are not empty.
|
||||
|
||||
self.obj = None
|
||||
self.attribs = ["Base","Additions","Subtractions","Objects","Components","Axes","Fixtures","Armatures","Group"]
|
||||
self.attribs = ["Base","Additions","Subtractions","Objects","Components","Axes","Fixtures","Group"]
|
||||
self.baseform = QtGui.QWidget()
|
||||
self.baseform.setObjectName("TaskPanel")
|
||||
self.grid = QtGui.QGridLayout(self.baseform)
|
||||
@@ -303,7 +303,6 @@ class ComponentTaskPanel:
|
||||
self.treeAxes.setText(0,QtGui.QApplication.translate("Arch", "Axes", None))
|
||||
self.treeComponents.setText(0,QtGui.QApplication.translate("Arch", "Components", None))
|
||||
self.treeFixtures.setText(0,QtGui.QApplication.translate("Arch", "Fixtures", None))
|
||||
self.treeArmatures.setText(0,QtGui.QApplication.translate("Arch", "Armatures", None))
|
||||
self.treeGroup.setText(0,QtGui.QApplication.translate("Arch", "Group", None))
|
||||
|
||||
class Component:
|
||||
@@ -868,6 +867,11 @@ class ViewProviderComponent:
|
||||
objlink = getattr(self.Object,link)
|
||||
if objlink:
|
||||
c.append(objlink)
|
||||
for link in self.Object.InList:
|
||||
if hasattr(link,"Host"):
|
||||
if link.Host:
|
||||
if link.Host == self.Object:
|
||||
c.append(link)
|
||||
return c
|
||||
return []
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ class _Precast(ArchComponent.Component):
|
||||
obj.addProperty("App::PropertyDistance","Length","Arch",QT_TRANSLATE_NOOP("App::Property","The length of this element"))
|
||||
obj.addProperty("App::PropertyDistance","Width","Arch",QT_TRANSLATE_NOOP("App::Property","The width of this element"))
|
||||
obj.addProperty("App::PropertyDistance","Height","Arch",QT_TRANSLATE_NOOP("App::Property","The height of this element"))
|
||||
obj.addProperty("App::PropertyLinkList","Armatures","Arch",QT_TRANSLATE_NOOP("App::Property","Armatures contained in this element"))
|
||||
obj.addProperty("App::PropertyVectorList","Nodes","Arch",QT_TRANSLATE_NOOP("App::Property","The structural nodes of this element"))
|
||||
self.Type = "Precast"
|
||||
obj.Role = ["Beam","Column","Panel","Slab","Stairs"]
|
||||
|
||||
@@ -69,17 +69,7 @@ def makeRebar(baseobj=None,sketch=None,diameter=None,amount=1,offset=None,name="
|
||||
obj.Base = sketch
|
||||
if FreeCAD.GuiUp:
|
||||
sketch.ViewObject.hide()
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
if p.GetBool("archRemoveExternal",False):
|
||||
a = baseobj.Armatures
|
||||
a.append(obj)
|
||||
baseobj.Armatures = a
|
||||
else:
|
||||
import Arch
|
||||
host = getattr(Arch,"make"+Draft.getType(baseobj))(baseobj)
|
||||
a = host.Armatures
|
||||
a.append(obj)
|
||||
host.Armatures = a
|
||||
obj.Host = baseobj
|
||||
if diameter:
|
||||
obj.Diameter = diameter
|
||||
else:
|
||||
@@ -171,6 +161,7 @@ class _Rebar(ArchComponent.Component):
|
||||
obj.addProperty("App::PropertyVector","Direction","Arch",QT_TRANSLATE_NOOP("App::Property","The direction to use to spread the bars. Keep (0,0,0) for automatic direction."))
|
||||
obj.addProperty("App::PropertyFloat","Rounding","Arch",QT_TRANSLATE_NOOP("App::Property","The fillet to apply to the angle of the base profile. This value is multiplied by the bar diameter."))
|
||||
obj.addProperty("App::PropertyPlacementList","PlacementList","Arch",QT_TRANSLATE_NOOP("App::Property","List of placement of all the bars"))
|
||||
obj.addProperty("App::PropertyLink","Host","Arch",QT_TRANSLATE_NOOP("App::Property","The structure object that hosts this rebar"))
|
||||
self.Type = "Rebar"
|
||||
obj.setEditorMode("Spacing",1)
|
||||
|
||||
@@ -245,18 +236,18 @@ class _Rebar(ArchComponent.Component):
|
||||
wire.translate(vinterval)
|
||||
wires.append(wire)
|
||||
return [wires,obj.Diameter.Value/2]
|
||||
|
||||
def onChanged(self,obj,prop):
|
||||
if prop == "Host":
|
||||
if hasattr(obj,"Host"):
|
||||
if obj.Host:
|
||||
# mark host to recompute so it can detect this object
|
||||
obj.Host.touch()
|
||||
|
||||
def execute(self,obj):
|
||||
|
||||
if self.clone(obj):
|
||||
return
|
||||
|
||||
if len(obj.InList) != 1:
|
||||
return
|
||||
if Draft.getType(obj.InList[0]) != "Structure":
|
||||
return
|
||||
if not obj.InList[0].Shape:
|
||||
return
|
||||
if not obj.Base:
|
||||
return
|
||||
if not obj.Base.Shape:
|
||||
@@ -267,7 +258,18 @@ class _Rebar(ArchComponent.Component):
|
||||
return
|
||||
if not obj.Amount:
|
||||
return
|
||||
father = obj.InList[0]
|
||||
father = obj.Host
|
||||
fathershape = None
|
||||
if not father:
|
||||
# support for old-style rebars
|
||||
if obj.InList:
|
||||
if hasattr(obj.InList[0],"Armatures"):
|
||||
if obj in obj.InList[0].Armatures:
|
||||
father = obj.InList[0]
|
||||
if father:
|
||||
if father.isDerivedFrom("Part::Feature"):
|
||||
fathershape = father.Shape
|
||||
|
||||
wire = obj.Base.Shape.Wires[0]
|
||||
if hasattr(obj,"Rounding"):
|
||||
#print(obj.Rounding)
|
||||
@@ -279,12 +281,18 @@ class _Rebar(ArchComponent.Component):
|
||||
if not bpoint:
|
||||
return
|
||||
axis = obj.Base.Placement.Rotation.multVec(FreeCAD.Vector(0,0,-1))
|
||||
size = (ArchCommands.projectToVector(father.Shape.copy(),axis)).Length
|
||||
if fathershape:
|
||||
size = (ArchCommands.projectToVector(fathershape.copy(),axis)).Length
|
||||
else:
|
||||
size = 1
|
||||
if hasattr(obj,"Direction"):
|
||||
if not DraftVecUtils.isNull(obj.Direction):
|
||||
axis = FreeCAD.Vector(obj.Direction)
|
||||
axis.normalize()
|
||||
size = (ArchCommands.projectToVector(father.Shape.copy(),axis)).Length
|
||||
if fathershape:
|
||||
size = (ArchCommands.projectToVector(fathershape.copy(),axis)).Length
|
||||
else:
|
||||
size = 1
|
||||
if hasattr(obj,"Distance"):
|
||||
if obj.Distance.Value:
|
||||
size = obj.Distance.Value
|
||||
@@ -306,8 +314,12 @@ class _Rebar(ArchComponent.Component):
|
||||
# building final shape
|
||||
shapes = []
|
||||
placementlist = []
|
||||
if father:
|
||||
rot = father.Placement.Rotation
|
||||
else:
|
||||
rot = FreeCAD.Rotation()
|
||||
if obj.Amount == 1:
|
||||
barplacement = CalculatePlacement(obj.Amount, 1, size, axis, father.Placement.Rotation, obj.OffsetStart.Value, obj.OffsetEnd.Value)
|
||||
barplacement = CalculatePlacement(obj.Amount, 1, size, axis, rot, obj.OffsetStart.Value, obj.OffsetEnd.Value)
|
||||
placementlist.append(barplacement)
|
||||
if hasattr(obj,"Spacing"):
|
||||
obj.Spacing = 0
|
||||
@@ -319,7 +331,7 @@ class _Rebar(ArchComponent.Component):
|
||||
interval = size - (obj.OffsetStart.Value + obj.OffsetEnd.Value)
|
||||
interval = interval / (obj.Amount - 1)
|
||||
for i in range(obj.Amount):
|
||||
barplacement = CalculatePlacement(obj.Amount, i+1, size, axis, father.Placement.Rotation, obj.OffsetStart.Value, obj.OffsetEnd.Value)
|
||||
barplacement = CalculatePlacement(obj.Amount, i+1, size, axis, rot, obj.OffsetStart.Value, obj.OffsetEnd.Value)
|
||||
placementlist.append(barplacement)
|
||||
if hasattr(obj,"Spacing"):
|
||||
obj.Spacing = interval
|
||||
|
||||
@@ -402,7 +402,6 @@ class _Structure(ArchComponent.Component):
|
||||
obj.addProperty("App::PropertyLength","Length","Arch",QT_TRANSLATE_NOOP("App::Property","The length of this element, if not based on a profile"))
|
||||
obj.addProperty("App::PropertyLength","Width","Arch",QT_TRANSLATE_NOOP("App::Property","The width of this element, if not based on a profile"))
|
||||
obj.addProperty("App::PropertyLength","Height","Arch",QT_TRANSLATE_NOOP("App::Property","The height or extrusion depth of this element. Keep 0 for automatic"))
|
||||
obj.addProperty("App::PropertyLinkList","Armatures","Arch",QT_TRANSLATE_NOOP("App::Property","Armatures contained in this element"))
|
||||
obj.addProperty("App::PropertyVector","Normal","Arch",QT_TRANSLATE_NOOP("App::Property","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)"))
|
||||
obj.addProperty("App::PropertyVectorList","Nodes","Arch",QT_TRANSLATE_NOOP("App::Property","The structural nodes of this element"))
|
||||
obj.addProperty("App::PropertyString","Profile","Arch",QT_TRANSLATE_NOOP("App::Property","A description of the standard profile this element is based upon"))
|
||||
|
||||
Reference in New Issue
Block a user