Exemplo n.º 1
0
def edgeparameter2pt(u, occedge):
    '''
    u: u parameter of the parameterise edge
    type: float
    
    occedge: the edge to be measured
    type: occedge
    '''
    occutil_edge = edge.Edge(occedge)
    gppt = occutil_edge.parameter_to_point(u)
    return (gppt.X(), gppt.Y(), gppt.Z())
Exemplo n.º 2
0
def edgelength(lbound, ubound, occedge):
    '''
    lbound: lower bound of the parameterise edge
    type: float
    
    ubound: upper bound of the parameterise edge
    type: float
    
    occedge: the edge to be measured
    type: occedge
    '''
    occutil_edge = edge.Edge(occedge)
    length = occutil_edge.length(lbound, ubound)
    return length
Exemplo n.º 3
0
def edge_midpt(occedge):
    """
    This function calcuates the midpoint of an OCCedge.
 
    Parameters
    ----------
    occedge : OCCedge
        The edge to be analysed.
        
    Returns
    -------
    midpoint : pypt
        The midpoint of the edge.
    """
    occutil_edge = edge.Edge(occedge)
    mid_parm, midpt = occutil_edge.mid_point()
    return (midpt.X(), midpt.Y(), midpt.Z())
Exemplo n.º 4
0
def edge_domain(occedge):
    """
    This function fetches the domain of an OCCedge.
 
    Parameters
    ----------
    occedge : OCCedge
        The OCCedge to be examined.
        
    Returns
    -------
    lower bound: float
        The lower bound of the OCCedge domain
    upper bound: float
        The upper bound of the OCCedge domain
    """
    occutil_edge = edge.Edge(occedge)
    lbound, ubound = occutil_edge.domain()
    return lbound, ubound
Exemplo n.º 5
0
def edgeparameter2pt(parameter, occedge):
    """
    This function calculates the point on the OCCedge from the given parameter.
 
    Parameters
    ----------
    parameter : float
        The parameter of the OCCedge.
        
    occedge : OCCedge
        The edge to be analysed.

    Returns
    -------
    point on edge : pypt
        The point on the edge based on the parameter.
    """
    occutil_edge = edge.Edge(occedge)
    gppt = occutil_edge.parameter_to_point(parameter)
    return (gppt.X(), gppt.Y(), gppt.Z())
Exemplo n.º 6
0
def pt2edgeparameter(pypt, occedge):
    """
    This function calculates the parameter of the OCCedge from the given point. The length of the edge can be calculated by specifying
    two parameters in the edgelength function.
 
    Parameters
    ----------
    pypt : tuple of floats
        The point on the OCCedge to be converted to the parameter. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z).
        
    occedge : OCCedge
        The edge to be analysed.

    Returns
    -------
    parameter : float
        The parameter of the point on the OCCedge.
    """
    occutil_edge = edge.Edge(occedge)
    gppt = construct.make_gppnt(pypt)
    parameter, nearest_gppt = occutil_edge.project_vertex(gppt)
    return parameter
Exemplo n.º 7
0
def project_point_on_infedge(pypt, occedge):
    """
    This function projects a point towards the OCCedge. The edge is treated as a vector and it stretched through infinity.  
 
    Parameters
    ----------
    pypt : tuple of floats
        The point to be projected. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z)
        
    occedge : OCCedge
        The edge to be projected on.

    Returns
    -------
    Projected point : pypt
        The projected point on the edge.
    """
    gp_pt = gp_Pnt(pypt[0], pypt[1], pypt[2])
    occutil_edge = edge.Edge(occedge)
    u, projpt = occutil_edge.project_vertex(gp_pt)
    proj_pypt = modify.occpt_2_pypt(projpt)
    return proj_pypt
Exemplo n.º 8
0
def edgelength(lbound, ubound, occedge):
    """
    This function calculates the length of the OCCedge between the lower and upper bound.
 
    Parameters
    ----------
    lbound : float
        The lower bound of the OCCedge.
        
    ubound : float
        The upper bound of the OCCedge.
        
    occedge : OCCedge
        The edge to be analysed.

    Returns
    -------
    length : float
        The length of the edge between the upper and lower bound.
    """
    occutil_edge = edge.Edge(occedge)
    length = occutil_edge.length(lbound, ubound)
    return length
Exemplo n.º 9
0
def intersect_edge_with_face(occedge, occface, tolerance=1e-02):
    """
    This function intersects an OCCedge with an OCCface and obtain a list of intersection points.
 
    Parameters
    ----------
    occedge : OCCedge
        The edge to be intersected.
        
    occface : OCCface
        The face to be intersected.
        
    tolerance : float, optional
        The minimum distance between the edge and face to determine if the they are intersecting, Default = 1e-02.

    Returns
    -------
    list of intersection points : pyptlist
        The list of points where the two topologies intersect.
    """
    occutil_edge = edge.Edge(occedge)
    interptlist = occutil_edge.Intersect.intersect(occface, tolerance)
    return interptlist
Exemplo n.º 10
0
def edge_domain(occedge):
    occutil_edge = edge.Edge(occedge)
    lbound, ubound = occutil_edge.domain()
    return lbound, ubound
Exemplo n.º 11
0
def pt2edgeparameter(pypt, occedge):
    occutil_edge = edge.Edge(occedge)
    gppt = construct.make_gppnt(pypt)
    parameter, nearest_gppt = occutil_edge.project_vertex(gppt)
    return parameter
Exemplo n.º 12
0
def intersect_edge_with_face(occ_edge, occ_face):
    occutil_edge = edge.Edge(occ_edge)
    interptlist = occutil_edge.Intersect.intersect(occ_face, 1e-2)
    return interptlist
Exemplo n.º 13
0
def project_point_on_infedge(occ_edge, pypt):
    gp_pt = gp_Pnt(pypt[0], pypt[1], pypt[2])
    occutil_edge = edge.Edge(occ_edge)
    u, projpt = occutil_edge.project_vertex(gp_pt)
    return projpt
Exemplo n.º 14
0
def edge_midpt(occedge):
    occutil_edge = edge.Edge(occedge)
    mid_parm, midpt = occutil_edge.mid_point()
    return (midpt.X(), midpt.Y(), midpt.Z())