First of all, for those that have been trying to build this, I have updated my cmake stuff as well as the second post. The build should be a lot smoother now, as I’ve level-upped my cMake-fu and incorporated some “find_package” stuff. I’m considering creating one monolithic project with OccWrapper, TopoManagers, and my FreeCAD branch as submodules to reduce the “git clone” and build down to a single step, but I haven’t decided if I want to do that yet or not.
Also, I’ve actually tested the build using fresh git clones. FreeCAD is currently still compiling, but so far no issues!
Thank you for taking the time to look through this! I’ve glanced over your code (I hesitate to say “browsed” since you’ve done a more thorough job looking through my code than I have yours
). While I agree that our approaches are different, I think the implementations have some commonalities. i.e. it seems that we both rely on the Modified/Generated/Deleted methods of the various occ generator classes.
I don’t disagree with this. I would ultimately like to do as you’ve suggested and move the manager into TopoShape. I used the current approach to achieve a short-term “proof of concept” to show how these managers can work.
In keeping with the encapsulation principle, I’m of the opinion that TopoShape should be the only one that ever modifies its own resources, namely its TopoDS_Shape. That’s not really the case right now in FreeCAD. As a step towards “protecting” the TopoDS_Shape, I submitted a pull request (that I think went through) a while back making it a private member variable, but I also added (with wmayer’s help) a getter/setter, so the net impact was zero. But, in the longer term, it’d be great to find every piece of code in freecad that uses the setShape method in TopoShape and eliminate that call.
I did mention this briefley on this post. I have considered it. Essentially, my idea in this regard is to extend the concept of “two faces can be used to identify an edge” in the 3D world to “two edges can be used to define a vertex” in the 2D world.
As such, a “PlanarSurfaceManager” if you will would provide the same function as the “PrimitiveSolidManager”, except with edges and vertices. Now, any time this planar surface is modified, the “PlanarSurfaceManager” would have an “updateSurface” method which would need to know how all the edges have changed.
This “PlanarSurfaceManager” can than be the basis for an “SweptSolidManager”. The “SweptSolidManager” would figure out which faces are generated from which faces and then in essence function like the “PrimitiveSolidManager”. Please note that an extrusion is essentially a swept solid.
We would, of course, need a specific “SolidManager” for any method that could create or modify a solid. It sounds like we’d need an “OffsetSolidManager” as well.
I think you’re talking specificially about CompoundSolidManager. You are correct about how I have encoded each face. However, this three-tuple is only used to initially identify each face in the CompoundSolid, i.e. when the CompoundSolidManager is constructed. This is so that every face in the solid can be uniquely identified by tying it back to whatever face it originated from.
Can you specify an example of when a face originates “from multiple faces from multiple base solids”? I’ve been dealing solely with boolean fuse and cut so far.
I don’t think I follow along here: what complex data structure are you suggesting?
This is by design. During any given operation, a face or edge could be split into two or more constituent faces/edges. Take as an example the second gif I posted in this update. You can see that originally, a single edge was filleted. When that edge is split, the original edge no longer exists. We do know, though, that it was split into two. Therefore, any reference to a particular Edge must return a list rather than a single edge. The same holds true for a reference to a particular face.
I agree with your point that this does not allow a user to unambiguously reference any given edge or face. That was not my intent, though. Rather, I wanted to provide a mechanism by which a topological entity (for now, only edges and faces) could be referenced in such a way that despite geometric changes, the topological reference remains in tact.
Put another way, the intended user of any ISolidManager derived class is not the end-user of the FreeCAD program. Rather, ISolidManager and its derived classes are intended to be used within the FreeCAD code base as a means of managing references to topological entities.
As an example, the naming mechanism that you have focused your efforts on, which provides a unique string ID that uniquely identifies various topological entities would be an ideal “user” of an ISolidManager. This naming mechanism could keep track of whether an edge/face was split (by tracking the length of the vector returned by getEdgeByIndex and getFaceByIndex, respectively) and, say, take an edge that was originally named “Edge1” and rename it to “Edge1a”, “Edge1b”.
I greatly appreciate you taking the time to look through my code and provide your thoughts. I’m looking forward to continuing to work together on this! It’s my turn to take some time to read through your approach ![]()