예제 #1
0
파일: solid.py 프로젝트: mirmik/zencad
def _make_solid(shells):
    if not isinstance(shells, (list, tuple)):
        shells = [shells]

    algo = BRepBuilderAPI_MakeSolid()

    for s in shells:
        algo.Add(s.Shell())

    fixer = ShapeFix_Solid(algo.Solid())
    fixer.Perform()
    return Shape(fixer.Solid())
예제 #2
0
def fix_close_solid(occsolid):
    """
    This function fixes an OCCsolid by making sure all the OCCfaces in the solid have an outward orientation. 
 
    Parameters
    ----------        
    occsolid : OCCsolid
        The OCCsolid to be fixed.

    Returns
    -------
    fixed solid : OCCsolid
        The fixed OCCsolid. If None it means the solid is not fixed.
    """
    shape_fix = ShapeFix_Solid(occsolid)
    shape_fix.Perform()
    fix_solid = shape_fix.Solid()
    fix_solid_list = fetch.topo_explorer(fix_solid, "solid")
    if not fix_solid_list:
        return None
    else:
        fix_solid = fix_solid_list[0]
        breplib.OrientClosedSolid(fix_solid)
        return fix_solid
예제 #3
0
def _shapefix_solid(shp):
    algo2 = ShapeFix_Solid(shp.Shape())
    algo2.Perform()
    return Shape(algo2.Solid())