def coords_from_vert(vert_shape):
    """
    Return tuple representing coordinates of one vertex
    """
    brt = BRep_Tool()
    pnt = brt.Pnt(topods_Vertex(vert_shape))
    return (pnt.X(), pnt.Y(), pnt.Z())
Exemple #2
0
def topo2topotype(occtopology):
    """
    This function converts the original OCCtopology of the given topology. e.g. an OCCcompound that is originally an OCCface etc.
 
    Parameters
    ----------
    occtopology : OCCtopology 
        The OCCtopology to be converted. 
        OCCtopology includes: OCCshape, OCCcompound, OCCcompsolid, OCCsolid, OCCshell, OCCface, OCCwire, OCCedge, OCCvertex 
        
    Returns
    -------
    original topology : OCCtopology
        The original OCCtopology of the input.
    """
    shapetype = occtopology.ShapeType()
    if shapetype == TopAbs_COMPOUND:#compound
        orig_topo = topods_Compound(occtopology)
    if shapetype == TopAbs_COMPSOLID:#compsolid
        orig_topo = topods_CompSolid(occtopology)
    if shapetype == TopAbs_SOLID:#solid
        orig_topo = topods_Solid(occtopology)
    if shapetype == TopAbs_SHELL:#shell
        orig_topo = topods_Shell(occtopology)
    if shapetype == TopAbs_FACE:#face
        orig_topo = topods_Face(occtopology)
    if shapetype == TopAbs_WIRE:#wire
        orig_topo = topods_Wire(occtopology)
    if shapetype == TopAbs_EDGE:#edge
        orig_topo = topods_Edge(occtopology)
    if shapetype == TopAbs_VERTEX:#vertex
        orig_topo = topods_Vertex(occtopology)
    return orig_topo
Exemple #3
0
def format_wire_for_roboDK(wire, is_reverse=False):
    vertices = sweeper.get_ordered_vertices_from_wire(wire)
    brt = BRep_Tool()
    wire = []
    last_path_direction = None
    for i in range(len(vertices)):
        index = i
        next_index = index + 1
        if is_reverse:
            index = len(vertices) - 1 - i
            next_index = index - 1
        v = vertices[index]
        pnt = brt.Pnt(topods_Vertex(v))
        normal = get_vertex_normal(v, front_face)
        if not ((index == 0 and is_reverse) or
                (index == len(vertices) - 1 and not is_reverse)):
            pnt_next = brt.Pnt(topods_Vertex(vertices[next_index]))
            mat_pnt = numpy.mat([pnt.X(), pnt.Y(), pnt.Z()])
            mat_pnt_next = numpy.mat(
                [pnt_next.X(), pnt_next.Y(),
                 pnt_next.Z()])
            path_direction = mat_pnt_next - mat_pnt
            path_direction = path_direction / scipy.linalg.norm(path_direction)
            last_path_direction = path_direction
        else:
            path_direction = last_path_direction
        #direction should be away from base_position
        p1 = [pnt.X() + normal.X(), pnt.Y() + normal.Y(), pnt.Z() + normal.Z()]
        p2 = [pnt.X() - normal.X(), pnt.Y() - normal.Y(), pnt.Z() - normal.Z()]
        #normal vector should point towards base_position
        if sweeper.get_distance_points(
                p1, sweeper.base_position) < sweeper.get_distance_points(
                    p2, sweeper.base_position):
            direction = [normal.X(), normal.Y(), normal.Z()]
        else:
            direction = [-normal.X(), -normal.Y(), -normal.Z()]
        wire.append({
            "location": [pnt.X(), pnt.Y(), pnt.Z()],
            "direction":
            direction,
            "path_direction": [
                path_direction.item(0),
                path_direction.item(1),
                path_direction.item(2)
            ]
        })
    return wire
Exemple #4
0
def topo_explorer(occtopo2explore, topotype2find):
    """
    This function explores and fetches the specified topological type from the given OCCtopology.
    e.g. find a list of OCCfaces in an OCCcompound.
 
    Parameters
    ----------
    occtopo2explore : OCCtopology 
        The OCCtopology to be explored.
        OCCtopology includes: OCCshape, OCCcompound, OCCcompsolid, OCCsolid, OCCshell, OCCface, OCCwire, OCCedge, OCCvertex 
        
    topotype2find : str 
        The string describing the topology to find. 
        The strings can be e.g. "compound", "compsolid", "solid", "shell", "face", "wire", "edge", "vertex". 
        
    Returns
    -------
    list of topology : list of OCCtopology
        The list of OCCtopology found in the specified OCCtopology.
    """
    geom_list = []
    if topotype2find == "compound":
        shapetype2find_topABS = TopAbs_COMPOUND
    if topotype2find == "compsolid":
        shapetype2find_topABS = TopAbs_COMPSOLID
    if topotype2find == "solid":
        shapetype2find_topABS = TopAbs_SOLID
    if topotype2find == "shell":
        shapetype2find_topABS = TopAbs_SHELL
    if topotype2find == "face":
        shapetype2find_topABS = TopAbs_FACE
    if topotype2find == "wire":
        shapetype2find_topABS = TopAbs_WIRE
    if topotype2find == "edge":
        shapetype2find_topABS = TopAbs_EDGE
    if topotype2find == "vertex":
        shapetype2find_topABS = TopAbs_VERTEX
        
    ex = TopExp_Explorer(occtopo2explore, shapetype2find_topABS)
    while ex.More():
        if shapetype2find_topABS == 0:
            geom = topods_Compound(ex.Current())
        if shapetype2find_topABS == 1:
            geom = topods_CompSolid(ex.Current())
        if shapetype2find_topABS == 2:
            geom = topods_Solid(ex.Current())
        if shapetype2find_topABS == 3:
            geom = topods_Shell(ex.Current())
        if shapetype2find_topABS == 4:
            geom = topods_Face(ex.Current())
        if shapetype2find_topABS == 5:
            geom = topods_Wire(ex.Current())
        if shapetype2find_topABS == 6:
            geom = topods_Edge(ex.Current())
        if shapetype2find_topABS == 7:
            geom = topods_Vertex(ex.Current())
        geom_list.append(geom)
        ex.Next()
    return geom_list
def points_of_face(face_shape):
    """
    Return sorted tuple of face points
    """
    face_traverse = traverse.Topo(face_shape)
    vertices = face_traverse.vertices_from_face(face_shape)
    points = []
    brt = BRep_Tool()
    for vert in vertices:
        pnt = brt.Pnt(topods_Vertex(vert))
        points.append((pnt.X(), pnt.Y(), pnt.Z()))
    return tuple(sorted(points))
Exemple #6
0
def vertex_clicked(shp, *kwargs):
    """ This function is called whenever a vertex is selected
    """
    for shape in shp:  # this should be a TopoDS_Vertex
        print("Face selected: ", shape)
        v = topods_Vertex(shape)
        pnt = BRep_Tool.Pnt(v)
        print("3d gp_Pnt selected coordinates : X=", pnt.X(), "Y=", pnt.Y(),
              "Z=", pnt.Z())
        # then convert to screen coordinates
        screen_coord = display.View.Convert(pnt.X(), pnt.Y(), pnt.Z())
        print("2d screen coordinates : ", screen_coord)
Exemple #7
0
 def __init__(self, pnt):
     if isinstance(pnt, (list, tuple)):
         gp_Pnt.__init__(self, *pnt)
     elif isinstance(pnt, vec):
         gp_Pnt.__init__(self, *pnt)
     elif isinstance(pnt, gp_Pnt):
         gp_Pnt.__init__(self, pnt)
     elif isinstance(pnt, TopoDS_Vertex):
         # convert to type "gp_Pnt"
         gp_Pnt.__init__(self, BRep_Tool.Pnt(pnt))
     elif isinstance(pnt, TopoDS_Shape):
         self.brt = BRep_Tool()
         self.pnt1 = self.brt.Pnt(topods_Vertex(pnt))
         gp_Pnt.__init__(self, self.pnt1.XYZ())
     else:
         raise TypeError
Exemple #8
0
def dumpTopology(shape, level=0):
    """
     Print the details of an object from the top down
    """
    brt = BRep_Tool()
    s = shape.ShapeType()
    if s == TopAbs_VERTEX:
        pnt = brt.Pnt(topods_Vertex(shape))
        print(".." * level  + "<Vertex %i: %s %s %s>" % (hash(shape), pnt.X(), pnt.Y(), pnt.Z()))
    else:
        print(".." * level, end="")
        print(shapeTypeString(shape))
    it = TopoDS_Iterator(shape)
    while it.More():
        shp = it.Value()
        it.Next()
        dumpTopology(shp, level + 1)
Exemple #9
0
def dumpTopology(shape, level=0):
    """
     Print the details of an object from the top down
    """
    brt = BRep_Tool()
    s = shape.ShapeType()
    if s == TopAbs_VERTEX:
        pnt = brt.Pnt(topods_Vertex(shape))
        print(".." * level  + "<Vertex %i: %s %s %s>" % (hash(shape), pnt.X(), pnt.Y(), pnt.Z()))
    else:
        print(".." * level, end="")
        print(shapeTypeString(shape))
    it = TopoDS_Iterator(shape)
    while it.More():
        shp = it.Value()
        it.Next()
        dumpTopology(shp, level + 1)
def dump_topology_to_string(shape, level=0, buffer=""):
    """
    Reutnrs the details of an object from the top down
    """
    brt = BRep_Tool()
    s = shape.ShapeType()
    if s == TopAbs_VERTEX:
        pnt = brt.Pnt(topods_Vertex(shape))
        print(".." * level + "<Vertex %i: %s %s %s>\n" %
              (hash(shape), pnt.X(), pnt.Y(), pnt.Z()))
    else:
        print(".." * level, end="")
        print(shape_type_string(shape))
    it = TopoDS_Iterator(shape)
    while it.More() and level < 5:  # LEVEL MAX
        shp = it.Value()
        it.Next()
        print(dump_topology_to_string(shp, level + 1, buffer))
Exemple #11
0
def shape2shapetype(occ_shape):
    shapetype = occ_shape.ShapeType()
    if shapetype == TopAbs_COMPOUND:  #compound
        orig_topo = topods_Compound(occ_shape)
    if shapetype == TopAbs_COMPSOLID:  #compsolid
        orig_topo = topods_CompSolid(occ_shape)
    if shapetype == TopAbs_SOLID:  #solid
        orig_topo = topods_Solid(occ_shape)
    if shapetype == TopAbs_SHELL:  #shell
        orig_topo = topods_Shell(occ_shape)
    if shapetype == TopAbs_FACE:  #face
        orig_topo = topods_Face(occ_shape)
    if shapetype == TopAbs_WIRE:  #wire
        orig_topo = topods_Wire(occ_shape)
    if shapetype == TopAbs_EDGE:  #edge
        orig_topo = topods_Edge(occ_shape)
    if shapetype == TopAbs_VERTEX:  #vertex
        orig_topo = topods_Vertex(occ_shape)
    return orig_topo
def test_update_ApexPoint():
    """Tests that Build is triggered on updating Apex Point"""
    # Create example airliner wing
    P = (0, 0, 0)
    wing = LiftingSurface(P, mySweepAngleFunctionAirliner,
                          myDihedralFunctionAirliner,
                          myTwistFunctionAirliner,
                          myChordFunctionAirliner,
                          myAirfoilFunctionAirliner)

    # By adding a point to the wing, we will see if the move transformation
    # has been performed when the ApexPoint attribute is changed:
    from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeVertex
    v = BRepBuilderAPI_MakeVertex(gp_Pnt(0, 0, 0)).Vertex()
    wing['test_pnt'] = v

    # Updating the apex should move the surface (and test vertex) through
    # the vector newApex - oldApex
    wing.ApexPoint = gp_Pnt(10, 10, 10)

    # Retrieve the vertex and point from the translated shape
    from OCC.TopoDS import topods_Vertex
    from OCC.BRep import BRep_Tool_Pnt
    vout = topods_Vertex(wing['test_pnt'])
    p = BRep_Tool_Pnt(vout)

    # Check that the vertex was correctly transformed
    xyz = [p.X(), p.Y(), p.Z()]
    assert(xyz == [10, 10, 10])


# def test_Fit_BlendedTipDevice(simple_wing):
#     # Fit a blended winglet to this wing and test the output
#     wing = simple_wing

#     wing.Fit_BlendedTipDevice(rootchord_norm=0.8, spanfraction=0.1, cant=40,
#                              transition=0.1, sweep=40, taper=0.7)

#     # Test the (theoretical) tip chord equals the winglet root chord:
#     assert((Wing.ChordFunct(1) * Wing.ScaleFactor * Wing.ChordFactor) ==
#         Winglet.ChordFunct(0) * Winglet.ScaleFactor * Winglet.ChordFactor)

#     # Test the length of the LE curve is the correct spanfraction
def test_update_ApexPoint():
    """Tests that Build is triggered on updating Apex Point"""
    # Create example airliner wing
    P = (0, 0, 0)
    wing = LiftingSurface(P, mySweepAngleFunctionAirliner,
                          myDihedralFunctionAirliner, myTwistFunctionAirliner,
                          myChordFunctionAirliner, myAirfoilFunctionAirliner)

    # By adding a point to the wing, we will see if the move transformation
    # has been performed when the ApexPoint attribute is changed:
    from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeVertex
    v = BRepBuilderAPI_MakeVertex(gp_Pnt(0, 0, 0)).Vertex()
    wing['test_pnt'] = v

    # Updating the apex should move the surface (and test vertex) through
    # the vector newApex - oldApex
    wing.ApexPoint = gp_Pnt(10, 10, 10)

    # Retrieve the vertex and point from the translated shape
    from OCC.TopoDS import topods_Vertex
    from OCC.BRep import BRep_Tool_Pnt
    vout = topods_Vertex(wing['test_pnt'])
    p = BRep_Tool_Pnt(vout)

    # Check that the vertex was correctly transformed
    xyz = [p.X(), p.Y(), p.Z()]
    assert (xyz == [10, 10, 10])


# def test_Fit_BlendedTipDevice(simple_wing):
#     # Fit a blended winglet to this wing and test the output
#     wing = simple_wing

#     wing.Fit_BlendedTipDevice(rootchord_norm=0.8, spanfraction=0.1, cant=40,
#                              transition=0.1, sweep=40, taper=0.7)

#     # Test the (theoretical) tip chord equals the winglet root chord:
#     assert((Wing.ChordFunct(1) * Wing.ScaleFactor * Wing.ChordFactor) ==
#         Winglet.ChordFunct(0) * Winglet.ScaleFactor * Winglet.ChordFactor)

#     # Test the length of the LE curve is the correct spanfraction
Exemple #14
0
 def DumpTop(self, shape, level=0):
     """
     Print the details of an object from the top down
     """
     brt = BRep_Tool()
     s = shape.ShapeType()
     if s == TopAbs_VERTEX:
         pnt = brt.Pnt(topods_Vertex(shape))
         dmp = " " * level
         dmp += "%s - " % shapeTypeString(shape)
         dmp += "%.5e %.5e %.5e" % (pnt.X(), pnt.Y(), pnt.Z())
         print(dmp)
     else:
         dmp = " " * level
         dmp += shapeTypeString(shape)
         print(dmp)
     it = TopoDS_Iterator(shape)
     while it.More():
         shp = it.Value()
         it.Next()
         self.DumpTop(shp, level + 1)
Exemple #15
0
def corners(house):
    d = {}
    iface = -1
    topo = Topo(house['volume'])
    house['boundaries'] = {'walls': [], 'windows': [], 'heats': []}
    house['faces'] = []
    for f in topo.wires():
        iface += 1
        key = 'face' + str(iface)
        print 'new_face'
        edges = []
        d[key] = []
        topof = Topo(f)
        for e in topof.edges():
            vts = Topo(e)
            print 'edge'
            edge = []
            for i, v in enumerate(vts.vertices()):
                brt = BRep_Tool()
                pnt = brt.Pnt(topods_Vertex(v))
                edge.append([pnt.X(), pnt.Y(), pnt.Z()])
            edges.append(edge)
        print len(edges)
        first_edge = edges.pop(0)
        point_array = [first_edge[0], first_edge[1]]
        print 'edges   :'
        for e in edges:
            print e
        print '-------'
        while len(edges) > 0:
            for i, e in enumerate(edges):
                if point_array[-1] in e:
                    ed = edges.pop(i)
                    print point_array[-1]
                    if ed[0] == point_array[-1]: point_array.append(ed[1])
                    elif ed[1] == point_array[-1]: point_array.append(ed[0])
                    break
        d[key] = point_array
        house['faces'].append(point_array)
    return d
Exemple #16
0
def geom_explorer(geom2explore, shapetype2find):
    geom_list = []
    if shapetype2find == "compound":
        shapetype2find_topABS = TopAbs_COMPOUND
    if shapetype2find == "compsolid":
        shapetype2find_topABS = TopAbs_COMPSOLID
    if shapetype2find == "solid":
        shapetype2find_topABS = TopAbs_SOLID
    if shapetype2find == "shell":
        shapetype2find_topABS = TopAbs_SHELL
    if shapetype2find == "face":
        shapetype2find_topABS = TopAbs_FACE
    if shapetype2find == "wire":
        shapetype2find_topABS = TopAbs_WIRE
    if shapetype2find == "edge":
        shapetype2find_topABS = TopAbs_EDGE
    if shapetype2find == "vertex":
        shapetype2find_topABS = TopAbs_VERTEX

    ex = TopExp_Explorer(geom2explore, shapetype2find_topABS)
    while ex.More():
        if shapetype2find_topABS == 0:
            geom = topods_Compound(ex.Current())
        if shapetype2find_topABS == 1:
            geom = topods_CompSolid(ex.Current())
        if shapetype2find_topABS == 2:
            geom = topods_Solid(ex.Current())
        if shapetype2find_topABS == 3:
            geom = topods_Shell(ex.Current())
        if shapetype2find_topABS == 4:
            geom = topods_Face(ex.Current())
        if shapetype2find_topABS == 5:
            geom = topods_Wire(ex.Current())
        if shapetype2find_topABS == 6:
            geom = topods_Edge(ex.Current())
        if shapetype2find_topABS == 7:
            geom = topods_Vertex(ex.Current())
        geom_list.append(geom)
        ex.Next()
    return geom_list
#!/usr/bin/env python
##Copyright 2008-2015 Jelle Feringa ([email protected])
##
##This file is part of pythonOCC.
##
##pythonOCC is free software: you can redistribute it and/or modify
##it under the terms of the GNU Lesser General Public License as published by
##the Free Software Foundation, either version 3 of the License, or
##(at your option) any later version.
##
##pythonOCC is distributed in the hope that it will be useful,
##but WITHOUT ANY WARRANTY; without even the implied warranty of
##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##GNU Lesser General Public License for more details.
##
##You should have received a copy of the GNU Lesser General Public License
##along with pythonOCC.  If not, see <http://www.gnu.org/licenses/>.
# A sample that shows how to generate the gear geometry according
# to knowledge
from OCC.BRepFilletAPI import BRepFilletAPI_MakeFillet
from OCC.BRep import BRep_Tool
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
from OCC.TopExp import (TopExp_Explorer,
                        topexp_MapShapesAndAncestors,
                        topexp_FirstVertex,
                        topexp_LastVertex)
from OCC.TopAbs import TopAbs_VERTEX, TopAbs_EDGE
from OCC.TopTools import (TopTools_IndexedDataMapOfShapeListOfShape,
                          TopTools_ListIteratorOfListOfShape)
from OCC.TopoDS import topods_Vertex, topods_Edge
Exemple #18
0
#!/usr/bin/env python
##Copyright 2008-2015 Jelle Feringa ([email protected])
##
##This file is part of pythonOCC.
##
##pythonOCC is free software: you can redistribute it and/or modify
##it under the terms of the GNU Lesser General Public License as published by
##the Free Software Foundation, either version 3 of the License, or
##(at your option) any later version.
##
##pythonOCC is distributed in the hope that it will be useful,
##but WITHOUT ANY WARRANTY; without even the implied warranty of
##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##GNU Lesser General Public License for more details.
##
##You should have received a copy of the GNU Lesser General Public License
##along with pythonOCC.  If not, see <http://www.gnu.org/licenses/>.
# A sample that shows how to generate the gear geometry according
# to knowledge
from OCC.BRepFilletAPI import BRepFilletAPI_MakeFillet
from OCC.BRep import BRep_Tool
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
from OCC.TopExp import (TopExp_Explorer, topexp_MapShapesAndAncestors,
                        topexp_FirstVertex, topexp_LastVertex)
from OCC.TopAbs import TopAbs_VERTEX, TopAbs_EDGE
from OCC.TopTools import (TopTools_IndexedDataMapOfShapeListOfShape,
                          TopTools_ListIteratorOfListOfShape)
from OCC.TopoDS import topods_Vertex, topods_Edge
from OCC.Display.SimpleGui import init_display
display, start_display, add_menu, add_function_to_menu = init_display()
def find_intersected_faces(face, volume1, volume2, hint_face, tolerance=0.00001):
    """
    Try to find bordering faces
    """

    # Get bordering points from face
    primitives0 = brep_explorer.shape_disassembly(face)
    brt = BRep_Tool()
    border_points = []
    for vert_shape in primitives0[7].values():
        vert = topods_Vertex(vert_shape)
        pnt = brt.Pnt(topods_Vertex(vert))
        border_points.append(pnt)

    # Get curves from edges of face
    brt = BRep_Tool()
    curves = []
    for edge_shape in primitives0[6].values():
        edge = topods_Edge(edge_shape)
        curve_handle = brt.Curve(edge)[0]
        curve = curve_handle.GetObject()
        curves.append(curve)

    # Get candidate points from hint_face
    primitives2 = brep_explorer.shape_disassembly(hint_face)
    brt = BRep_Tool()
    cand_points = []
    for vert_shape in primitives2[7].values():
        vert = topods_Vertex(vert_shape)
        pnt = brt.Pnt(topods_Vertex(vert))
        cand_points.append(pnt)

    # Iterate over all curves and try to find intersection points
    inter_points = []
    for curve in curves:
        distances = {}
        # Compute distances between candidate points and curve
        for point in cand_points:
            proj = GeomAPI_ProjectPointOnCurve(point, curve.GetHandle())
            try:
                low_dist = proj.LowerDistance()
            # I tried to find, where does this exception come from: "StdFail_NotDone"
            # but was not able to find it anywhere. So using this wild catching
            except:
                pass
            else:
                distances[low_dist] = point
        # Try to get candidate with lowest distance
        if len(distances) > 0:
            min_dist = min(distances.keys())
            # When distance is lower then tolerance, then we found point at intersection
            if min_dist <= tolerance:
                inter_points.append(distances[min_dist])

    if len(inter_points) == 0:
        return []

    # When some intersection points was found, then extend list of border points
    # with these intersection points
    border_points.extend(inter_points)

    border_coords = [(pnt.X(), pnt.Y(), pnt.Z()) for pnt in border_points]

    # Get list of all faces in volumes
    primitives3 = brep_explorer.shapes_disassembly((volume1, volume2))
    brt = BRep_Tool()
    border_faces = []
    for face_shape in primitives3[4].values():
        face_traverse = traverse.Topo(face_shape)
        vertices = face_traverse.vertices_from_face(face_shape)
        face_coords = []
        for vert in vertices:
            pnt = brt.Pnt(topods_Vertex(vert))
            face_coords.append((pnt.X(), pnt.Y(), pnt.Z()))
        
        # TODO: use better check in coordinates matches then: `coo in border_coords`
        # e.g.: use some distance and tolerance
        res = [coo in border_coords for coo in face_coords]
        if all(res) is True:
            border_faces.append(face_shape)

    # TODO: Check if these faces covers original face completely

    return border_faces
Exemple #20
0
def shape_to_pts(sh):
    return [BRep_Tool().Pnt(topods_Vertex(v)) for v in Topo(sh).vertices()]
Exemple #21
0
                        topexp_FirstVertex, topexp_LastVertex)
from OCC.TopAbs import TopAbs_VERTEX, TopAbs_EDGE
from OCC.TopTools import (TopTools_IndexedDataMapOfShapeListOfShape,
                          TopTools_ListIteratorOfListOfShape)
from OCC.TopoDS import topods_Vertex, topods_Edge

from OCC.Display.SimpleGui import init_display
display, start_display, add_menu, add_function_to_menu = init_display('wx')

# create shape
cube = BRepPrimAPI_MakeBox(100, 100, 100).Shape()

topExp = TopExp_Explorer()
topExp.Init(cube, TopAbs_VERTEX)
# get two vertices
vertA = topods_Vertex(topExp.Current())
topExp.Next()
vertB = topods_Vertex(topExp.Current())


def vertex_fillet(cube, vert):
    # apply a fillet on incident edges on a vertex
    afillet = BRepFilletAPI_MakeFillet(cube)
    cnt = 0
    # find edges from vertex
    _map = TopTools_IndexedDataMapOfShapeListOfShape()
    topexp_MapShapesAndAncestors(cube, TopAbs_VERTEX, TopAbs_EDGE, _map)
    results = _map.FindFromKey(vert)
    topology_iterator = TopTools_ListIteratorOfListOfShape(results)
    while topology_iterator.More():
        edge = topods_Edge(topology_iterator.Value())