Example #1
0
def gen_ellipsoid(axs=gp_Ax3(), rxyz=[10, 20, 30]):
    sphere = BRepPrimAPI_MakeSphere(gp_Ax2(), 1).Solid()
    loc = set_loc(gp_Ax3(), axs)
    mat = gp_Mat(rxyz[0], 0, 0, 0, rxyz[1], 0, 0, 0, rxyz[2])
    gtrf = gp_GTrsf(mat, gp_XYZ(0, 0, 0))
    ellips = BRepBuilderAPI_GTransform(sphere, gtrf).Shape()
    ellips.Location(loc)
    return ellips
Example #2
0
def gen_ellipsoid_geom(axs=gp_Ax3(), rxyz=[10, 20, 30]):
    sphere = gp_Sphere(axs, 1)
    api = Geom_SphericalSurface(sphere)
    api.Continuity()
    api.Transform()
    print(api.Area())

    loc = set_loc(gp_Ax3(), axs)
    mat = gp_Mat(rxyz[0], 0, 0, 0, rxyz[1], 0, 0, 0, rxyz[2])
    gtrf = gp_GTrsf(mat, gp_XYZ(0, 0, 0))
    ellips = BRepBuilderAPI_GTransform(sphere, gtrf).Shape()
    ellips.Location(loc)
    return ellips