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()
from OCC import Geom, gp, GeomAPI, BRepBuilderAPI, BRepPrimAPI, BRepAlgoAPI,\ STEPControl from viewer import view EFL = 50.8 ax = gp.gp_Ax2( gp.gp_Pnt(0., 0., 0.), #origin gp.gp_Dir(1., 0., 0.), #main direction is Z gp.gp_Dir(0., 0., 1.)) #X Direction is X FL = EFL / 2. #focal length 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