def constrained_filling(event=None): # left pts1 = point_list_to_TColgp_Array1OfPnt((gp_Pnt(0, 0, 0.0), gp_Pnt(0, 1, 0.3), gp_Pnt(0, 2, -0.3), gp_Pnt(0, 3, 0.15), gp_Pnt(0, 4, 0))) # front pts2 = point_list_to_TColgp_Array1OfPnt((gp_Pnt(0, 0, 0.0), gp_Pnt(1, 0, -0.3), gp_Pnt(2, 0, 0.15), gp_Pnt(3, 0, 0), gp_Pnt(4, 0, 0))) # back pts3 = point_list_to_TColgp_Array1OfPnt((gp_Pnt(0, 4, 0), gp_Pnt(1, 4, 0.3), gp_Pnt(2, 4, -0.15), gp_Pnt(3, 4, 0), gp_Pnt(4, 4, 1))) # rechts pts4 = point_list_to_TColgp_Array1OfPnt((gp_Pnt(4, 0, 0), gp_Pnt(4, 1, 0), gp_Pnt(4, 2, 2), gp_Pnt(4, 3, -0.15), gp_Pnt(4, 4, 1))) spl1, b1 = get_simple_bound(pts1) spl2, b2 = get_simple_bound(pts2) spl3, b3 = get_simple_bound(pts3) spl4, b4 = get_simple_bound(pts4) # build the constrained surface bConstrainedFilling = GeomFill_ConstrainedFilling(8, 2) bConstrainedFilling.Init(b1, b2, b3, b4, False) srf1 = bConstrainedFilling.Surface() display.EraseAll() for i in [spl1, spl2, spl3, spl4]: edg = BRepBuilderAPI_MakeEdge(i) edg.Build() _edg = edg.Shape() display.DisplayShape(_edg) f = BRepBuilderAPI_MakeFace(srf1, 1e-6) f.Build() shp = f.Shape() return shp
def make_edge(shape): spline = BRepBuilderAPI_MakeEdge(shape) spline.Build() return spline.Shape()