>

Hi Bryan,

We dealt with nearly all memory issues when releasing 0.2, but this is  
something nasty that we haven't been able to work around yet.
We're currently looking into this in order to find a solution.

I've been working pretty extensively on pythonOCC & topology, and so  
far I haven't really found a situation where I couldn't work my way  
around the issue.
( though of course no excuse for the odd behaviour )

Bryan, if you're looking into topology, please have a look at the  
OCC.Utils.Topology.Topo class.
Pretty much any topology iteration is easily accomplished by the module.


> I've started experimenting with TopExp_Explorer in order extract
> sub-shapes from Shapes. When I try to store the results of the  
> iteration
> in a python list, all but the last extracted shapes become invalid. It
> seems that TopExp_Explorer is re-using some part of the data structure
> it outputs as it iterates, so keeping references to the shapes it
> generates doesn't work.
>
> Here's an example:
>
>        from OCC import TopExp, BRepPrimAPI, TopAbs, TopoDS
>
>        box = BRepPrimAPI.BRepPrimAPI_MakeBox(10., 20., 30.)
>        ex = TopExp.TopExp_Explorer(box.Shape(), TopAbs.TopAbs_EDGE)
>
>        results = []
>
>        while ex.More():
>            edge = TopoDS.TopoDS().Edge(ex.Current())
>            print "is null?", bool(edge.IsNull())
>            results.append(edge)
>            ex.Next()
>
>        for edge in results:
>            print "null now?", bool(edge.IsNull())
>
> Inside the while loop, none of the shapes are Null. Once the iteration
> is complete, all the edges become Null.
>
> What's the correct way to store a references to sub-Shapes? I guess I
> need a shallow copy of the shape-object returned by Explorer.Current()
> but I can't figure how to achieve this.


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

Reply via email to