예제 #1
0
def calc_center(product, ifcfile):
    productIfc = ifcfile.by_id(product.pid)
    try:
        productShape = get_shape(productIfc)
        center = Common.center_boundingbox(productShape)
        pnt = Pnt(X=center.Coord()[0],
                  Y=center.Coord()[1],
                  Z=center.Coord()[2])
        pnt.save()
        product.center.add(pnt)
        product.save()

    except:
        pass
예제 #2
0
def get_centre_bbox(occtopology):
    """
    This function calculates the centre of the bounding box of the OCCtopology.
 
    Parameters
    ----------
    occtopology : OCCtopology
        The OCCtopology to be analysed.
        OCCtopology includes: OCCshape, OCCcompound, OCCcompsolid, OCCsolid, OCCshell, OCCface, OCCwire, OCCedge, OCCvertex 
        
    Returns
    -------
    centre point : pypt
        The centre point of the OCCtopology's bounding box.
    """
    occ_midpt = Common.center_boundingbox(occtopology)
    return (occ_midpt.X(), occ_midpt.Y(), occ_midpt.Z())
예제 #3
0
def get_centre_bbox(occtopology):
    """
    This function calculates the centre of the bounding box of the OCCtopology.
 
    Parameters
    ----------
    occtopology : OCCtopology
        The OCCtopology to be analysed.
        OCCtopology includes: OCCshape, OCCcompound, OCCcompsolid, OCCsolid, OCCshell, OCCface, OCCwire, OCCedge, OCCvertex 
        
    Returns
    -------
    centre point : pypt
        The centre point of the OCCtopology's bounding box.
    """
    occ_midpt = Common.center_boundingbox(occtopology)
    return (occ_midpt.X(), occ_midpt.Y(), occ_midpt.Z())
예제 #4
0
def get_centre_bbox(occ_shape):
    occ_midpt = Common.center_boundingbox(occ_shape)
    return (occ_midpt.X(), occ_midpt.Y(), occ_midpt.Z())