Arch: Add support for editing profile type, add L and T sections
This commit is contained in:
@@ -101,6 +101,10 @@ def makeProfile(profile=[0,'REC','REC100x100','R',100,100]):
|
||||
_ProfileRH(obj, profile)
|
||||
elif profile[3]=="U":
|
||||
_ProfileU(obj, profile)
|
||||
elif profile[3]=="L":
|
||||
_ProfileL(obj, profile)
|
||||
elif profile[3]=="T":
|
||||
_ProfileT(obj, profile)
|
||||
else :
|
||||
print("Profile not supported")
|
||||
if FreeCAD.GuiUp:
|
||||
@@ -239,13 +243,25 @@ class _Profile(Draft._DraftObject):
|
||||
def __setstate__(self,state):
|
||||
if isinstance(state,list):
|
||||
self.Profile = state
|
||||
|
||||
def cleanProperties(self, obj):
|
||||
|
||||
'''Remove all Profile properties'''
|
||||
|
||||
obj.removeProperty("Width")
|
||||
obj.removeProperty("Height")
|
||||
obj.removeProperty("WebThickness")
|
||||
obj.removeProperty("FlangeThickness")
|
||||
obj.removeProperty("OutDiameter")
|
||||
obj.removeProperty("Thickness")
|
||||
|
||||
|
||||
class _ProfileC(_Profile):
|
||||
|
||||
'''A parametric circular tubeprofile. Profile data: [Outside diameter, Inside diameter]'''
|
||||
'''A parametric circular tubeprofile. Profile data: [Outside diameter, Wall thickness]'''
|
||||
|
||||
def __init__(self,obj, profile):
|
||||
self.cleanProperties(obj)
|
||||
obj.addProperty("App::PropertyLength","OutDiameter","Draft",QT_TRANSLATE_NOOP("App::Property","Outside Diameter")).OutDiameter = profile[4]
|
||||
obj.addProperty("App::PropertyLength","Thickness","Draft",QT_TRANSLATE_NOOP("App::Property","Wall thickness")).Thickness = profile[5]
|
||||
_Profile.__init__(self,obj,profile)
|
||||
@@ -270,6 +286,7 @@ class _ProfileH(_Profile):
|
||||
'''A parametric H or I beam profile. Profile data: [width, height, web thickness, flange thickness] (see http://en.wikipedia.org/wiki/I-beam for reference)'''
|
||||
|
||||
def __init__(self,obj, profile):
|
||||
self.cleanProperties(obj)
|
||||
obj.addProperty("App::PropertyLength","Width","Draft",QT_TRANSLATE_NOOP("App::Property","Width of the beam")).Width = profile[4]
|
||||
obj.addProperty("App::PropertyLength","Height","Draft",QT_TRANSLATE_NOOP("App::Property","Height of the beam")).Height = profile[5]
|
||||
obj.addProperty("App::PropertyLength","WebThickness","Draft",QT_TRANSLATE_NOOP("App::Property","Thickness of the web")).WebThickness = profile[6]
|
||||
@@ -303,6 +320,7 @@ class _ProfileR(_Profile):
|
||||
'''A parametric rectangular beam profile based on [Width, Height]'''
|
||||
|
||||
def __init__(self,obj, profile):
|
||||
self.cleanProperties(obj)
|
||||
obj.addProperty("App::PropertyLength","Width","Draft",QT_TRANSLATE_NOOP("App::Property","Width of the beam")).Width = profile[4]
|
||||
obj.addProperty("App::PropertyLength","Height","Draft",QT_TRANSLATE_NOOP("App::Property","Height of the beam")).Height = profile[5]
|
||||
_Profile.__init__(self,obj,profile)
|
||||
@@ -326,6 +344,7 @@ class _ProfileRH(_Profile):
|
||||
'''A parametric Rectangular hollow beam profile. Profile data: [width, height, thickness]'''
|
||||
|
||||
def __init__(self,obj, profile):
|
||||
self.cleanProperties(obj)
|
||||
obj.addProperty("App::PropertyLength","Width","Draft",QT_TRANSLATE_NOOP("App::Property","Width of the beam")).Width = profile[4]
|
||||
obj.addProperty("App::PropertyLength","Height","Draft",QT_TRANSLATE_NOOP("App::Property","Height of the beam")).Height = profile[5]
|
||||
obj.addProperty("App::PropertyLength","Thickness","Draft",QT_TRANSLATE_NOOP("App::Property","Thickness of the sides")).Thickness = profile[6]
|
||||
@@ -355,9 +374,10 @@ class _ProfileRH(_Profile):
|
||||
|
||||
class _ProfileU(_Profile):
|
||||
|
||||
'''A parametric H or I beam profile. Profile data: [width, height, web thickness, flange thickness] (see http://en.wikipedia.org/wiki/I-beam forreference)'''
|
||||
'''A parametric U profile. Profile data: [width, height, web thickness, flange thickness] (see https://en.wikipedia.org/wiki/Structural_channel for reference)'''
|
||||
|
||||
def __init__(self,obj, profile):
|
||||
self.cleanProperties(obj)
|
||||
obj.addProperty("App::PropertyLength","Width","Draft",QT_TRANSLATE_NOOP("App::Property","Width of the beam")).Width = profile[4]
|
||||
obj.addProperty("App::PropertyLength","Height","Draft",QT_TRANSLATE_NOOP("App::Property","Height of the beam")).Height = profile[5]
|
||||
obj.addProperty("App::PropertyLength","WebThickness","Draft",QT_TRANSLATE_NOOP("App::Property","Thickness of the webs")).WebThickness = profile[6]
|
||||
@@ -380,6 +400,64 @@ class _ProfileU(_Profile):
|
||||
#p.reverse()
|
||||
obj.Shape = p
|
||||
obj.Placement = pl
|
||||
|
||||
|
||||
class _ProfileL(_Profile):
|
||||
|
||||
'''A parametric L profile. Profile data: [width, height, thickness]'''
|
||||
|
||||
def __init__(self, obj, profile):
|
||||
self.cleanProperties(obj)
|
||||
obj.addProperty("App::PropertyLength","Width","Draft",QT_TRANSLATE_NOOP("App::Property","Width of the beam")).Width = profile[4]
|
||||
obj.addProperty("App::PropertyLength","Height","Draft",QT_TRANSLATE_NOOP("App::Property","Height of the beam")).Height = profile[5]
|
||||
obj.addProperty("App::PropertyLength","Thickness","Draft",QT_TRANSLATE_NOOP("App::Property","Thickness of the legs")).Thickness = profile[6]
|
||||
_Profile.__init__(self,obj,profile)
|
||||
|
||||
def execute(self,obj):
|
||||
import Part
|
||||
pl = obj.Placement
|
||||
p1 = Vector(-obj.Width.Value/2, obj.Height.Value/2, 0)
|
||||
p2 = Vector(-obj.Width.Value/2, -obj.Height.Value/2, 0)
|
||||
p3 = Vector(obj.Width.Value/2, -obj.Height.Value/2, 0)
|
||||
p4 = Vector(obj.Width.Value/2, -obj.Height.Value/2+obj.Thickness.Value, 0)
|
||||
p5 = Vector(-obj.Width.Value/2+obj.Thickness.Value, -obj.Height.Value/2+obj.Thickness.Value, 0)
|
||||
p6 = Vector(-obj.Width.Value/2+obj.Thickness.Value, obj.Height.Value/2, 0)
|
||||
p = Part.makePolygon([p1,p2,p3,p4,p5,p6,p1])
|
||||
p = Part.Face(p)
|
||||
#p.reverse()
|
||||
obj.Shape = p
|
||||
obj.Placement = pl
|
||||
|
||||
|
||||
class _ProfileT(_Profile):
|
||||
|
||||
'''A parametric T profile. Profile data: [width, height, web thickness, flange thickness]'''
|
||||
|
||||
def __init__(self, obj, profile):
|
||||
self.cleanProperties(obj)
|
||||
obj.addProperty("App::PropertyLength","Width","Draft",QT_TRANSLATE_NOOP("App::Property","Width of the beam")).Width = profile[4]
|
||||
obj.addProperty("App::PropertyLength","Height","Draft",QT_TRANSLATE_NOOP("App::Property","Height of the beam")).Height = profile[5]
|
||||
obj.addProperty("App::PropertyLength","WebThickness","Draft",QT_TRANSLATE_NOOP("App::Property","Thickness of the web")).WebThickness = profile[6]
|
||||
obj.addProperty("App::PropertyLength","FlangeThickness","Draft",QT_TRANSLATE_NOOP("App::Property","Thickness of the flanges")).FlangeThickness = profile[7]
|
||||
_Profile.__init__(self,obj,profile)
|
||||
|
||||
def execute(self,obj):
|
||||
import Part
|
||||
pl = obj.Placement
|
||||
p1 = Vector(obj.WebThickness.Value/2, -obj.Height.Value/2, 0)
|
||||
p2 = Vector(obj.WebThickness.Value/2, obj.Height.Value/2-obj.FlangeThickness.Value, 0)
|
||||
p3 = Vector(obj.Width.Value/2, obj.Height.Value/2-obj.FlangeThickness.Value, 0)
|
||||
p4 = Vector(obj.Width.Value/2, obj.Height.Value/2, 0)
|
||||
p5 = Vector(-obj.Width.Value/2, obj.Height.Value/2, 0)
|
||||
p6 = Vector(-obj.Width.Value/2, obj.Height.Value/2-obj.FlangeThickness.Value, 0)
|
||||
p7 = Vector(-obj.WebThickness.Value/2, obj.Height.Value/2-obj.FlangeThickness.Value, 0)
|
||||
p8 = Vector(-obj.WebThickness.Value/2, -obj.Height.Value/2, 0)
|
||||
p = Part.makePolygon([p1,p2,p3,p4,p5,p6,p7,p8,p1])
|
||||
p = Part.Face(p)
|
||||
#p.reverse()
|
||||
obj.Shape = p
|
||||
obj.Placement = pl
|
||||
|
||||
|
||||
class ViewProviderProfile(Draft._ViewProviderDraft):
|
||||
|
||||
@@ -427,6 +505,10 @@ class ProfileTaskPanel:
|
||||
self.type = "RH"
|
||||
elif isinstance(self.obj.Proxy,_ProfileU):
|
||||
self.type = "U"
|
||||
elif isinstance(self.obj.Proxy,_ProfileL):
|
||||
self.type = "L"
|
||||
elif isinstance(self.obj.Proxy,_ProfileT):
|
||||
self.type = "T"
|
||||
else:
|
||||
self.type = "Undefined"
|
||||
self.form = QtGui.QWidget()
|
||||
@@ -441,9 +523,8 @@ class ProfileTaskPanel:
|
||||
self.categories = []
|
||||
self.presets = readPresets()
|
||||
for pre in self.presets:
|
||||
if pre[3] == self.type:
|
||||
if pre[1] not in self.categories:
|
||||
self.categories.append(pre[1])
|
||||
if pre[1] not in self.categories:
|
||||
self.categories.append(pre[1])
|
||||
self.comboCategory.addItem(" ")
|
||||
if self.categories:
|
||||
self.comboCategory.addItems(self.categories)
|
||||
@@ -489,21 +570,26 @@ class ProfileTaskPanel:
|
||||
self.Profile = self.currentpresets[idx]
|
||||
|
||||
def accept(self):
|
||||
|
||||
|
||||
self.obj.Label = self.Profile[2]
|
||||
if self.Profile:
|
||||
self.obj.Label = self.Profile[2]
|
||||
if self.type in ["H","R","RH","U"]:
|
||||
self.obj.Width = self.Profile[4]
|
||||
self.obj.Height = self.Profile[5]
|
||||
if self.type in ["H","U"]:
|
||||
self.obj.WebThickness = self.Profile[6]
|
||||
self.obj.FlangeThickness = self.Profile[7]
|
||||
elif self.type == "RH":
|
||||
self.obj.Thickness = self.Profile[6]
|
||||
elif self.type == "C":
|
||||
self.obj.OutDiameter = self.Profile[4]
|
||||
self.obj.Thickness = self.Profile[5]
|
||||
self.obj.Proxy.Profile = self.Profile
|
||||
if self.Profile[3]=="C":
|
||||
_ProfileC(self.obj, self.Profile)
|
||||
elif self.Profile[3]=="H":
|
||||
_ProfileH(self.obj, self.Profile)
|
||||
elif self.Profile[3]=="R":
|
||||
_ProfileR(self.obj, self.Profile)
|
||||
elif self.Profile[3]=="RH":
|
||||
_ProfileRH(self.obj, self.Profile)
|
||||
elif self.Profile[3]=="U":
|
||||
_ProfileU(self.obj, self.Profile)
|
||||
elif self.Profile[3]=="L":
|
||||
_ProfileL(self.obj, self.Profile)
|
||||
elif self.Profile[3]=="T":
|
||||
_ProfileT(self.obj, self.Profile)
|
||||
else:
|
||||
print("Profile not supported")
|
||||
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
return True
|
||||
|
||||
@@ -1262,3 +1262,113 @@ IS Channel,ISMC300,U,300,90,7.6,13.6
|
||||
IS Channel,ISMC350,U,350,100,8.1,13.5
|
||||
IS Channel,ISMC400,U,400,100,8.6,15.3
|
||||
|
||||
|
||||
# L-profiles
|
||||
|
||||
# Category,Name,U,width,height,thickness
|
||||
|
||||
|
||||
# Indian Standard Angle Sections (L profiles)
|
||||
|
||||
IS Angle,ISA20x20x3,L,20,20,3
|
||||
IS Angle,ISA20x20x4,L,20,20,4
|
||||
IS Angle,ISA25x25x3,L,25,25,3
|
||||
IS Angle,ISA25x25x4,L,25,25,4
|
||||
IS Angle,ISA25x25x5,L,25,25,5
|
||||
IS Angle,ISA30x30x3,L,30,30,3
|
||||
IS Angle,ISA30x30x4,L,30,30,4
|
||||
IS Angle,ISA30x30x5,L,30,30,5
|
||||
IS Angle,ISA35x35x3,L,35,35,3
|
||||
IS Angle,ISA35x35x4,L,35,35,4
|
||||
IS Angle,ISA35x35x5,L,35,35,5
|
||||
IS Angle,ISA35x35x6,L,35,35,6
|
||||
IS Angle,ISA40x40x3,L,40,40,3
|
||||
IS Angle,ISA40x40x4,L,40,40,4
|
||||
IS Angle,ISA40x40x5,L,40,40,5
|
||||
IS Angle,ISA40x40x6,L,40,40,6
|
||||
IS Angle,ISA45x45x3,L,45,45,3
|
||||
IS Angle,ISA45x45x4,L,45,45,4
|
||||
IS Angle,ISA45x45x5,L,45,45,5
|
||||
IS Angle,ISA45x45x6,L,45,45,6
|
||||
IS Angle,ISA50x50x3,L,50,50,3
|
||||
IS Angle,ISA50x50x4,L,50,50,4
|
||||
IS Angle,ISA50x50x5,L,50,50,5
|
||||
IS Angle,ISA50x50x6,L,50,50,6
|
||||
IS Angle,ISA55x55x4,L,55,55,4
|
||||
IS Angle,ISA55x55x5,L,55,55,5
|
||||
IS Angle,ISA55x55x6,L,55,55,6
|
||||
IS Angle,ISA55x55x8,L,55,55,8
|
||||
IS Angle,ISA60x60x4,L,60,60,4
|
||||
IS Angle,ISA60x60x5,L,60,60,5
|
||||
IS Angle,ISA60x60x6,L,60,60,6
|
||||
IS Angle,ISA60x60x8,L,60,60,8
|
||||
IS Angle,ISA65x65x4,L,65,65,4
|
||||
IS Angle,ISA65x65x5,L,65,65,5
|
||||
IS Angle,ISA65x65x6,L,65,65,6
|
||||
IS Angle,ISA65x65x8,L,65,65,8
|
||||
IS Angle,ISA70x70x5,L,70,70,5
|
||||
IS Angle,ISA70x70x6,L,70,70,6
|
||||
IS Angle,ISA70x70x8,L,70,70,8
|
||||
IS Angle,ISA70x70x10,L,70,70,10
|
||||
IS Angle,ISA75x75x5,L,75,75,5
|
||||
IS Angle,ISA75x75x6,L,75,75,6
|
||||
IS Angle,ISA75x75x8,L,75,75,8
|
||||
IS Angle,ISA75x75x10,L,75,75,10
|
||||
IS Angle,ISA80x80x6,L,80,80,6
|
||||
IS Angle,ISA80x80x8,L,80,80,8
|
||||
IS Angle,ISA80x80x10,L,80,80,10
|
||||
IS Angle,ISA80x80x12,L,80,80,12
|
||||
IS Angle,ISA90x90x6,L,90,90,6
|
||||
IS Angle,ISA90x90x8,L,90,90,8
|
||||
IS Angle,ISA90x90x10,L,90,90,10
|
||||
IS Angle,ISA90x90x12,L,90,90,12
|
||||
IS Angle,ISA100x100x6,L,100,100,6
|
||||
IS Angle,ISA100x100x8,L,100,100,8
|
||||
IS Angle,ISA100x100x10,L,100,100,10
|
||||
IS Angle,ISA100x100x12,L,100,100,12
|
||||
IS Angle,ISA110x110x8,L,110,110,8
|
||||
IS Angle,ISA110x110x10,L,110,110,10
|
||||
IS Angle,ISA110x110x12,L,110,110,12
|
||||
IS Angle,ISA110x110x16,L,110,110,16
|
||||
IS Angle,ISA130x130x8,L,130,130,8
|
||||
IS Angle,ISA130x130x10,L,130,130,10
|
||||
IS Angle,ISA130x130x12,L,130,130,12
|
||||
IS Angle,ISA130x130x16,L,130,130,16
|
||||
IS Angle,ISA150x150x10,L,150,150,10
|
||||
IS Angle,ISA150x150x12,L,150,150,12
|
||||
IS Angle,ISA150x150x16,L,150,150,16
|
||||
IS Angle,ISA150x150x20,L,150,150,20
|
||||
IS Angle,ISA200x200x10,L,200,200,10
|
||||
IS Angle,ISA200x200x12,L,200,200,12
|
||||
IS Angle,ISA200x200x16,L,200,200,16
|
||||
IS Angle,ISA200x200x20,L,200,200,20
|
||||
|
||||
|
||||
# T-profiles
|
||||
|
||||
# Category,Name,H,width,height,web thickness,flange thickness
|
||||
|
||||
|
||||
# Indian Standard Tee Bar Sections (T profiles)
|
||||
|
||||
IS Tee,ISNT 20,T,20,20,4,4
|
||||
IS Tee,ISNT 30,T,30,30,4,4
|
||||
IS Tee,ISNT 40,T,40,40,6,6
|
||||
IS Tee,ISNT 50,T,50,50,6,6
|
||||
IS Tee,ISNT 60,T,60,60,6,6
|
||||
IS Tee,ISNT 75,T,75,75,9,9
|
||||
IS Tee,ISNT 100,T,100,100,10,10
|
||||
IS Tee,ISNT 150,T,150,150,10,10
|
||||
IS Tee,ISDT 100,T,50,100,5.8,10
|
||||
IS Tee,ISDT 150,T,75,100,8,11.6
|
||||
IS Tee,ISLT 200,T,165,200,8,12.5
|
||||
IS Tee,ISLT 250,T,180,250,9.2,14.1
|
||||
IS Tee,ISMT 50,T,70,50,4.5,7.5
|
||||
IS Tee,ISMT 62.5,T,70,62.5,5,8
|
||||
IS Tee,ISMT 75,T,75,75,5,8
|
||||
IS Tee,ISMT 87.5,T,85,87.5,5.8,9
|
||||
IS Tee,ISMT 100,T,100,100,5.7,10.8
|
||||
IS Tee,ISHT 75,T,150,75,8.4,9
|
||||
IS Tee,ISHT 100,T,200,100,7.8,9
|
||||
IS Tee,ISHT 125,T,250,125,8.8,9.7
|
||||
IS Tee,ISHT 150,T,250,150,7.6,10.6
|
||||
|
||||
|
Reference in New Issue
Block a user