(pvol)
return dict(uv=surflist_uv, uw=surflist_uw, vw=surflist_vw)
Extracts surfaces from a volume.

    :param pvol: input volume
    :type pvol: abstract.Volume
    :return: extracted surface
    :rtype: dict
Extracts surfaces from a volume.
Extracts surfaces from a volume .
def extract_surfaces(pvol):
    """ Extracts surfaces from a volume.

    :param pvol: input volume
    :type pvol: abstract.Volume
    :return: extracted surface
    :rtype: dict
    """
    if pvol.pdimension != 3:
        raise GeomdlException("The input should be a spline volume")
    if len(pvol) != 1:
        raise GeomdlException("Can only operate on single spline volumes")

    # Get data from the volume object
    vol_data = pvol.data
    rational = vol_data['rational']
    degree_u = vol_data['degree'][0]
    degree_v = vol_data['degree'][1]
    degree_w = vol_data['degree'][2]
    kv_u = vol_data['knotvector'][0]
    kv_v = vol_data['knotvector'][1]
    kv_w = vol_data['knotvector'][2]
    size_u = vol_data['size'][0]
    size_v = vol_data['size'][1]
    size_w = vol_data['size'][2]
    cpts = vol_data['control_points']

    # Determine object type
    obj = shortcuts.generate_surface(rational)

    # u-v plane
    surflist_uv = []
    for w in range(size_w):
        surf = obj.__class__()
        surf.degree_u = degree_u
        surf.degree_v = degree_v
        surf.ctrlpts_size_u = size_u
        surf.ctrlpts_size_v = size_v
        surf.ctrlpts2d = [[cpts[v + (size_v * (u + (size_u * w)))] for v in range(size_v)] for u in range(size_u)]
        surf.knotvector_u = kv_u
        surf.knotvector_v = kv_v
        surflist_uv.append(surf)

    # u-w plane
    surflist_uw = []
    for v in range(size_v):
        surf = obj.__class__()
        surf.degree_u = degree_u
        surf.degree_v = degree_w
        surf.ctrlpts_size_u = size_u
        surf.ctrlpts_size_v = size_w
        surf.ctrlpts2d = [[cpts[v + (size_v * (u + (size_u * w)))] for w in range(size_w)] for u in range(size_u)]
        surf.knotvector_u = kv_u
        surf.knotvector_v = kv_w
        surflist_uw.append(surf)

    # v-w plane
    surflist_vw = []
    for u in range(size_u):
        surf = obj.__class__()
        surf.degree_u = degree_v
        surf.degree_v = degree_w
        surf.ctrlpts_size_u = size_v
        surf.ctrlpts_size_v = size_w
        surf.ctrlpts2d = [[cpts[v + (size_v * (u + (size_u * w)))] for w in range(size_w)] for v in range(size_v)]
        surf.knotvector_u = kv_v
        surf.knotvector_v = kv_w
        surflist_vw.append(surf)

    # Return shapes as a dict object
    return dict(uv=surflist_uv, uw=surflist_uw, vw=surflist_vw)
def extract_surfaces ( pvol ) : if pvol . pdimension != 3 : raise GeomdlException ( "The input should be a spline volume" ) if len ( pvol ) != 1 : raise GeomdlException ( "Can only operate on single spline volumes" ) # Get data from the volume object vol_data = pvol . data rational = vol_data [ 'rational' ] degree_u = vol_data [ 'degree' ] [ 0 ] degree_v = vol_data [ 'degree' ] [ 1 ] degree_w = vol_data [ 'degree' ] [ 2 ] kv_u = vol_data [ 'knotvector' ] [ 0 ] kv_v = vol_data [ 'knotvector' ] [ 1 ] kv_w = vol_data [ 'knotvector' ] [ 2 ] size_u = vol_data [ 'size' ] [ 0 ] size_v = vol_data [ 'size' ] [ 1 ] size_w = vol_data [ 'size' ] [ 2 ] cpts = vol_data [ 'control_points' ] # Determine object type obj = shortcuts . generate_surface ( rational ) # u-v plane surflist_uv = [ ] for w in range ( size_w ) : surf = obj . __class__ ( ) surf . degree_u = degree_u surf . degree_v = degree_v surf . ctrlpts_size_u = size_u surf . ctrlpts_size_v = size_v surf . ctrlpts2d = [ [ cpts [ v + ( size_v * ( u + ( size_u * w ) ) ) ] for v in range ( size_v ) ] for u in range ( size_u ) ] surf . knotvector_u = kv_u surf . knotvector_v = kv_v surflist_uv . append ( surf ) # u-w plane surflist_uw = [ ] for v in range ( size_v ) : surf = obj . __class__ ( ) surf . degree_u = degree_u surf . degree_v = degree_w surf . ctrlpts_size_u = size_u surf . ctrlpts_size_v = size_w surf . ctrlpts2d = [ [ cpts [ v + ( size_v * ( u + ( size_u * w ) ) ) ] for w in range ( size_w ) ] for u in range ( size_u ) ] surf . knotvector_u = kv_u surf . knotvector_v = kv_w surflist_uw . append ( surf ) # v-w plane surflist_vw = [ ] for u in range ( size_u ) : surf = obj . __class__ ( ) surf . degree_u = degree_v surf . degree_v = degree_w surf . ctrlpts_size_u = size_v surf . ctrlpts_size_v = size_w surf . ctrlpts2d = [ [ cpts [ v + ( size_v * ( u + ( size_u * w ) ) ) ] for w in range ( size_w ) ] for v in range ( size_v ) ] surf . knotvector_u = kv_v surf . knotvector_v = kv_w surflist_vw . append ( surf ) # Return shapes as a dict object return dict ( uv = surflist_uv , uw = surflist_uw , vw = surflist_vw )