Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TopTools_DataMapIteratorOfDataMapOfShapeShape not in OCP.TopTools #20

Closed
bragostin opened this issue Jun 9, 2020 · 6 comments
Closed

Comments

@bragostin
Copy link

I am trying to import TopTools_DataMapIteratorOfDataMapOfShapeShape (https://www.opencascade.com/doc/occt-7.4.0/refman/html/_top_tools___data_map_of_shape_shape_8hxx.html#a61da0422c6bddef13d54239baf54be23)

from OCP.TopTools import TopTools_DataMapIteratorOfDataMapOfShapeShape

but it does not seem to be there:
ImportError: cannot import name 'TopTools_DataMapIteratorOfDataMapOfShapeShape' from 'OCP.TopTools' (unknown location)

Is it to be expected?

@adam-urbanczyk
Copy link
Member

I'd need to dig a little to be sure, but these kind of typdefs were often omitted due to compilation issues. How/where would you like to use such an interator?

@bragostin
Copy link
Author

@adam-urbanczyk
OCP 7.4 has already solved a lot of issues for me, and it opens new perspectives. Now I am trying to union triply periodic fins with straights walls in the most efficient way. Here is what I tried:

  • standard union now works quite fast, if I shave the sides of the fins to be flush with the walls (with OCC 6.9 the shaving stage was already crashing)
  • with these flush surfaces gluing is mush faster, but later I have issues with cuts, which I don't get with standard union
  • in FreeCAD there is a JoinConnect function that performs this union successfully without the need to have flush surfaces. From what I understand it performs a General Fusion first to isolate the intersecting elements and after performs a union. It works nicely with my weird fins, so now I am trying to implement this in CadQuery.

TopTools_DataMapIteratorOfDataMapOfShapeShape allows to iterate these intersecting elements.
That said, I don't think I will need to use it. I can isolate the intersections by number of common faces with other objects or even by volume.

@adam-urbanczyk
Copy link
Member

Could you paste a link to the JoinConnect implementation? Maybe it can be done without the offending iterator.

@bragostin
Copy link
Author

It's there: https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/BOPTools/JoinAPI.py
I am quite convinced it can be done without TopTools_DataMapIteratorOfDataMapOfShapeShape now.

@adam-urbanczyk
Copy link
Member

Here, I think, is the underlying C++ part https://github.com/FreeCAD/FreeCAD/blob/da4baa74efeac8cd1eb6008c3c549c7d06afbf11/src/Mod/Part/App/TopoShape.cpp#L1950 .
Looks like they are using BRepAlgoAPI_BuilderAlgo. It has an API just like any other bool op. You need the TopTools_ListOfShape class which can be iterated over in the normal python way (i.e. for el in X:).

@bragostin
Copy link
Author

@adam-urbanczyk thank you, that's very helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants