Beispiel #1
0
def intersect_edge_with_edge(occedge1, occedge2, tolerance=1e-06):
    """
    This function intersects two OCCedges and obtain a list of intersection points.
 
    Parameters
    ----------
    occedge1 : OCCedge
        The first edge to be intersected.
        
    occedge2 : OCCedge
        The second edge to be intersected.
        
    tolerance : float, optional
        The minimum distance between the two edges to determine if the edges are intersecting, Default = 1e-06.

    Returns
    -------
    list of intersection points : pyptlist
        The list of points where the two edges intersect.
    """
    interpyptlist = []
    dss = BRepExtrema_DistShapeShape(occedge1, occedge2)
    dss.SetDeflection(tolerance)
    dss.Perform()
    min_dist = dss.Value()
    if min_dist < tolerance:
        npts = dss.NbSolution()
        for i in range(npts):
            gppt = dss.PointOnShape1(i + 1)
            pypt = (gppt.X(), gppt.Y(), gppt.Z())
            interpyptlist.append(pypt)

    return interpyptlist
Beispiel #2
0
def project_shape_on_shape(occtopo_proj, occtopo_projon, tolerance=1e-06):
    """
    This function project the occtopoproj (OCCtopology) onto the occtopoprojon (OCCtopology), and returns the list of projected points.
 
    Parameters
    ----------
    occtopo_proj : OCCtopology
        The OCCtopology to to project.
        OCCtopology includes: OCCshape, OCCcompound, OCCcompsolid, OCCsolid, OCCshell, OCCface, OCCwire, OCCedge, OCCvertex 
        
    occtopo_projon : OCCtopology
        The OCCtopology to be projected on.
        OCCtopology includes: OCCshape, OCCcompound, OCCcompsolid, OCCsolid, OCCshell, OCCface, OCCwire, OCCedge, OCCvertex 
        
    tolerance : float, optional
        The precision of the projection, Default = 1e-06.
        
    Returns
    -------
    list of projected points : pyptlist
        The list of projected points.
    """

    interpyptlist = []
    dss = BRepExtrema_DistShapeShape(occtopo_proj, occtopo_projon)
    dss.SetDeflection(tolerance)
    dss.Perform()
    min_dist = dss.Value()
    npts = dss.NbSolution()
    for i in range(npts):
        gppt = dss.PointOnShape2(i + 1)
        pypt = (gppt.X(), gppt.Y(), gppt.Z())
        interpyptlist.append(pypt)

    return interpyptlist
Beispiel #3
0
def intersect_edge_with_edge(occedge1, occedge2, tolerance=1e-06):
    interpyptlist = []
    dss = BRepExtrema_DistShapeShape(occedge1, occedge2)
    dss.SetDeflection(tolerance)
    dss.Perform()
    min_dist = dss.Value()
    if min_dist < tolerance:
        npts = dss.NbSolution()
        for i in range(npts):
            gppt = dss.PointOnShape1(i + 1)
            pypt = (gppt.X(), gppt.Y(), gppt.Z())
            interpyptlist.append(pypt)

    return interpyptlist
Beispiel #4
0
def project_shape_on_shape(occshape1, occshape2, tolerance=1e-06):
    '''
    occshape1: shape to project
    type: occshape
    
    occshape2: shape to be projected on
    type: occshape
    
    tolerance: precision of the projection
    type: float
    '''
    interpyptlist = []
    dss = BRepExtrema_DistShapeShape(occshape1, occshape2)
    dss.SetDeflection(tolerance)
    dss.Perform()
    min_dist = dss.Value()
    npts = dss.NbSolution()
    for i in range(npts):
        gppt = dss.PointOnShape2(i + 1)
        pypt = (gppt.X(), gppt.Y(), gppt.Z())
        interpyptlist.append(pypt)

    return interpyptlist