diff --git a/src/Mod/BIM/Arch.py b/src/Mod/BIM/Arch.py index e41d9b77a4..4a4163d612 100644 --- a/src/Mod/BIM/Arch.py +++ b/src/Mod/BIM/Arch.py @@ -858,6 +858,8 @@ def makeProfile(profile=[0, 'REC', 'REC100x100', 'R', 100, 100]): ArchProfile._ProfileL(obj, profile) case "T": ArchProfile._ProfileT(obj, profile) + case "T-s": + ArchProfile._ProfileTSLOT(obj, profile) case _: print("Profile not supported") diff --git a/src/Mod/BIM/ArchProfile.py b/src/Mod/BIM/ArchProfile.py index 51b976797d..136784958a 100644 --- a/src/Mod/BIM/ArchProfile.py +++ b/src/Mod/BIM/ArchProfile.py @@ -323,6 +323,77 @@ class _ProfileT(_Profile): obj.Placement = pl +class _ProfileTSLOT(_Profile): + + '''T slot profile common made of aluminum''' + + def __init__(self, obj, profile): + self.cleanProperties(obj) + obj.addProperty("App::PropertyLength","size","Draft",QT_TRANSLATE_NOOP("App::Property","side size"), locked=True).size = profile[4] + obj.addProperty("App::PropertyLength","slot_size","Draft",QT_TRANSLATE_NOOP("App::Property","Slot size"), locked=True).slot_size = profile[5] + obj.addProperty("App::PropertyLength","wall_thickness","Draft",QT_TRANSLATE_NOOP("App::Property","Thickness of the wall"), locked=True).wall_thickness = profile[6] + obj.addProperty("App::PropertyLength","tnut_slot_width","Draft",QT_TRANSLATE_NOOP("App::Property","t-nut slot width"), locked=True).tnut_slot_width = profile[7] + obj.addProperty("App::PropertyLength","tnut_slot_depth","Draft",QT_TRANSLATE_NOOP("App::Property","t-nut slot depth"), locked=True).tnut_slot_depth = profile[8] + obj.addProperty("App::PropertyLength","core_size","Draft",QT_TRANSLATE_NOOP("App::Property","Internal core size"), locked=True).core_size = profile[9] + obj.addProperty("App::PropertyLength","hole_diameter","Draft",QT_TRANSLATE_NOOP("App::Property","Internal core size"), locked=True).hole_diameter = profile[10] + obj.addProperty("App::PropertyLength","rd","Draft",QT_TRANSLATE_NOOP("App::Property","fillet radius"), locked=True).rd = profile[11] + _Profile.__init__(self,obj,profile) + + def execute(self,obj): + import Part + import math + # import DraftGeomUtils + pl = obj.Placement + nut_depth = obj.core_size/2-(obj.wall_thickness/math.sqrt(2)) + core_dim = obj.core_size/2 + wall_dim = obj.wall_thickness + slot_dim = obj.slot_size/2 + nut_width_dim = obj.tnut_slot_width/2 + templist = list() + templist.append(Vector(nut_depth, core_dim, 0.0)) + templist.append(Vector(nut_width_dim, nut_width_dim+(wall_dim/math.sqrt(2)), 0.0)) + templist.append(Vector(nut_width_dim, obj.size/2-wall_dim, 0.0)) + templist.append(Vector(slot_dim, obj.size/2-wall_dim, 0.0)) + templist.append(Vector(slot_dim, obj.size/2, 0.0)) + templist.append(Vector(obj.size/2, obj.size/2, 0.0)) + #TODO: + # add fillet four profile corners + # sub_poly1 = Part.makePolygon(templist) + # rd1=Vector(obj.size/2-(obj.rd),obj.size,0) + # rd2=Vector(obj.size/2-(obj.rd-obj.rd*math.sin(math.pi/4)),obj.size/2-(obj.rd-obj.rd*math.sin(math.pi/4)),0) + # rd3=Vector(obj.size,obj.size/2-(obj.rd),0) + # templist.append(Part.Arc(rd1,rd2,rd3)) + templist.append(Vector(obj.size/2, slot_dim, 0.0)) + templist.append(Vector(obj.size/2-wall_dim, slot_dim, 0.0)) + templist.append(Vector(obj.size/2-wall_dim, nut_width_dim, 0.0)) + templist.append(Vector(nut_width_dim+(wall_dim/math.sqrt(2)), nut_width_dim, 0.0)) + templist.append(Vector(core_dim, nut_depth, 0.0)) + # sub_poly2 = Part.makePolygon(templist3) + # l1=Part.LineSegment(Vector(obj.slot_size/2, obj.size/2, 0.0),Vector(obj.size/2, obj.size/2, 0.0)) + # l2=Part.LineSegment(Vector(obj.size/2, obj.size/2, 0.0),Vector(obj.size/2, 2.7500000000022977, 0.0)) + # round=DraftGeomUtils.fillet([l2.toShape(),l1.toShape()],obj.rd) + # wire=Part.Wire(round) + # p = Part.Shape([sub_poly1,round,sub_poly2]) + # p=Part.Face(Shape.Edges) + templist2 = list() + for vec in reversed(templist): + templist2.append(Vector(vec.x,vec.y*-1,vec.z)) + templist = templist + templist2 + templist2.clear() + for vec in reversed(templist): + templist2.append(Vector(vec.x*-1,vec.y,vec.z)) + templist = templist + templist2 + templist.append(templist[0]) + poly = Part.makePolygon(templist) + pf = Part.Face(poly) + orificio = Part.makeCircle(obj.hole_diameter/2, FreeCAD.Vector(0, 0, 0)) + cf=Part.Face(Part.Wire(orificio)) + p=pf.cut(cf) + #p.reverse() + obj.Shape = p + obj.Placement = pl + + class ViewProviderProfile(Draft._ViewProviderDraft): '''General view provider for Profile classes''' @@ -376,6 +447,8 @@ class ProfileTaskPanel: self.type = "L" elif isinstance(self.obj.Proxy,_ProfileT): self.type = "T" + elif isinstance(self.obj.Proxy,_ProfileTSLOT): + self.type = "TSLOT" else: self.type = "Building Element Proxy" self.form = QtGui.QWidget() @@ -454,6 +527,8 @@ class ProfileTaskPanel: _ProfileL(self.obj, self.Profile) elif self.Profile[3]=="T": _ProfileT(self.obj, self.Profile) + elif self.Profile[3]=="TSLOT": + _ProfileTSLOT(self.obj, self.Profile) else: print("Profile not supported") diff --git a/src/Mod/BIM/Presets/profiles.csv b/src/Mod/BIM/Presets/profiles.csv index 198c822c49..c97d9aa1b6 100644 --- a/src/Mod/BIM/Presets/profiles.csv +++ b/src/Mod/BIM/Presets/profiles.csv @@ -1372,3 +1372,15 @@ 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 + + +#T-slot + +#Category,Name,TSLOT,size,slot_size,wall_thickness,tnut_slot_width,tnut_slot_depth,core_size,hole_diameter,rd + +#square T-slot profile with four open T-slots + +T-slot,t-slot20x20,TSLOT,20,5.26,1.5,11.99,4.84,7.32,4.19,1.5 +T-slot,t-slot25x25,TSLOT,25,6.5,2.13,14.69,5.84,8.76,5,1.5 +T-slot,t-slot30x30,TSLOT,30,8.13,2.21,16.51,6.8,11.64,6.65,1.5 +T-slot,t-slot40x40,TSLOT,40,8.13,4.32,20.57,8,14.85,6.81,1.5