import FreeCAD, Part from FreeCAD import Base # ====================== # Paramètres serre # ====================== length = 8.0 # longueur width = 3.5 # largeur height = 2.2 # hauteur arceaux n_frames = 8 # nombre d'arceaux spacing = length/(n_frames-1) tube_radius = 0.02 # rayon des tubes doc = FreeCAD.newDocument("Serre3D") # ====================== # Fonction pour créer un arceau # ====================== def create_arch(y_pos): points = [] n_pts = 20 for i in range(n_pts+1): x = -width/2 + i*(width/n_pts) z = height*(1 - (x/(width/2))**2) # demi-parabole points.append(Base.Vector(x, y_pos, z)) spline = Part.BSplineCurve() spline.interpolate(points) edge = spline.toShape() return edge # ====================== # Créer tous les arceaux # ====================== arches = [] for i in range(n_frames): y_pos = i*spacing arch_edge = create_arch(y_pos) Part.show(arch_edge) arches.append(arch_edge) # ====================== # Créer bâche loft entre arceaux # ====================== loft_wires = [] for arch in arches: wire = Part.makePolygon([Base.Vector(-width/2, arch.Vertexes[0].Point.y, height), Base.Vector(width/2, arch.Vertexes[-1].Point.y, height)]) loft_wires.append(wire) bache_loft = Part.makeLoft(loft_wires) Part.show(bache_loft) # ====================== # Export STEP pour SimScale # ====================== Part.export(doc.Objects, "C:/Users/Public/serre3D_simscale.step") print("STEP exporté ! Prêt pour SimScale")
by simscalesimscale
dcomic created this project
14 days ago