Jelle,

Had a look on your Topo._loop_topo method. Here is your code:

topo_set = set()
    while self.topExp.More():
       topo_item = topoTypes[topologyType]( self.topExp.Current() )
        if topo_item in topo_set:
            pass
        else:
            yield topo_item
            topo_set.add(topo_item)
        self.topExp.Next()


I think that the line 'if topo_item in topo_set' is not safe, ie you 
cannot ensure that this item is really in the set. I suggest you rather 
use a builtin OCC comparison method like IsEqual or IsSame. Extracted 
from TopoDS_Shape.hxx:

"""
The IsEqual() method returns True if two shapes are equal, i.e. if they 
share the same TShape with the same Locations and Orientations.
"""

"""
The IsSame() method returns True if two shapes are same, i.e. if they 
share the same TShape with the same Locations. *Orientations may differ*
"""

Here is a fix to your script (that uses IsEqual). You can see that the 
output is different. Did'nt try the IsSame() method.

topo_set = set()
        while self.topExp.More():
            topo_item = topoTypes[topologyType](self.topExp.Current())
            #
            # Check if already in the set
            #
            EQUAL = False
            for item in topo_set:
                if topo_item.IsEqual(item):
                    EQUAL = True
                    break
            if not EQUAL:
                yield topo_item
                topo_set.add(topo_item)
            self.topExp.Next()

Cheers,

Thomas

Jelle Feringa a écrit :
> Hi,
>
> The topology module has been reworked ( OCC.Utils.topology ).
> Now its easy to find the faces related to a vertex ( & visa versa ), 
> the edges incident to a vertex or a face ( & visa versa ).
> Also you can get the ordered edges or vertices from a wire.
>
> I made a test case showing how to fillet a vertex of a cube.
> See the image attached.
>
> Cheers,
>
> -jelle
>
>
> ------------------------------------------------------------------------
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Pythonocc-users mailing list
> Pythonocc-users@gna.org
> https://mail.gna.org/listinfo/pythonocc-users

_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to