def make_true_para(FL, rmin, rmax): """ makes a parabloid, with rotation axis along Z and focus at the origin """ ax = gp.gp_Ax2(gp.gp_Pnt(0.,0.,-FL), #origin gp.gp_Dir(1.,0.,0.), #main direction is Z gp.gp_Dir(0.,0.,1.)) #X Direction is X para = Geom.Geom_Parabola(ax, FL) h_para = Geom.Handle_Geom_Parabola(para) ax2 = gp.gp_Ax2(gp.gp_Pnt(0,0,0), #origin gp.gp_Dir(0.,0.,1.), #main direction is Z gp.gp_Dir(1.,0.,0.)) #X Direction is X pbl_shape = BRepPrimAPI.BRepPrimAPI_MakeRevolution(ax2, h_para, rmin, rmax) return pbl_shape.Shape()
para = Geom.Geom_Parabola(ax, FL) h_para = Geom.Handle_Geom_Parabola(para) radius = 25.4 outside = EFL + radius length = (outside**2) / (4. * FL) ax2 = gp.gp_Ax2( gp.gp_Pnt(0, 0, 0), #origin gp.gp_Dir(0., 0., 1.), #main direction is X gp.gp_Dir(1., 0., 0.)) #X Direction is Z pbl_shape = BRepPrimAPI.BRepPrimAPI_MakeRevolution(ax2, h_para, 1.0, outside) ax3 = gp.gp_Ax2( gp.gp_Pnt(EFL, 0, 0), #origin gp.gp_Dir(0., 0., 1.), #main direction is X gp.gp_Dir(0., 1., 0.)) #X Direction is Y cyl_solid = BRepPrimAPI.BRepPrimAPI_MakeCylinder(ax3, radius, length) nurb = BRepBuilderAPI.BRepBuilderAPI_NurbsConvert(pbl_shape.Shape()) cut = BRepAlgoAPI.BRepAlgoAPI_Cut(cyl_solid.Shape(), nurb.Shape()) #view(wire.Shape(), cyl_solid.Shape(), pbl_shape.Shape()) #view(cyl_solid.Shape(), pbl_shape.Shape()) view(cut.Shape())