https://github.com/FreeCAD/FreeCAD/pull/868ezzieyguywuf wrote: ↑Wed Jul 12, 2017 8:32 pm Namely, I'll need to expose the Modified/Deleted/Created faces from any given OpenCascade operation via the TopoShapePy implementation.
Python Topological Namer/Tracker
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Python Topological Namer/Tracker
-
- Posts: 656
- Joined: Tue May 19, 2015 1:11 am
Re: Python Topological Namer/Tracker
Sweet! I'll rework my example to use these
-
- Posts: 656
- Joined: Tue May 19, 2015 1:11 am
Re: Python Topological Namer/Tracker
I have updated my example to use @jnxd's GSoC history framework. It works great now, with no 'cheating'! In other words, in my original example I had to hard-code which faces got modified/deleted etc., but now I am able to do it all programatically.
I realized that it may be helpful to give a step-by-step on how to run my example as well as provide a screenshot that shows what's going on. Here it goes:
I think, for now, I am going to take a break from the PyTopoNamer and begin work on what I'm calling CppTopoNamer. It will be the same as the Python prototype but written from the ground up in C++. This may take me some time, as I am new to unit testing in C++, and I feel it is imperitive that this component have robust unit testing.
I realized that it may be helpful to give a step-by-step on how to run my example as well as provide a screenshot that shows what's going on. Here it goes:
- Download PyTopoNamer
Code: Select all
$> cd ~ $> git clone https://github.com/ezzieyguywuf/PyTopoNamer.git
- Edit the `path` variable in the `~/PyTopoNamer/FreeCAD_scripts/testNamer.FCMacro` test Macro. In our example, it should be set to `'~/PyTopoNamer'`
- Compile a copy of jnxd's tnaming-pr branch
- Open FreeCAD (which you just compiled)
- Run the macro. You can either select it from the gui or perform the following in the Python console. If you do it this way, all the objects will remain available in the python console for further inspection/tinkering.
Code: Select all
>>> myFile = '~/PyTopoNamer/FreeCAD_scripts/testNamer.FCMacro' >>> execfile(myFile)
- The red solids show the current FreeCAD implementation of Topological Naming. You can see that in the second solid (from the left) the Chamfer has moved when FreeCAD recomputed the solid (after the cylinder was shortened)
- The blue solids show the PyTopoNamer implementation of Topological Naming. You can see that in the second solid (from the left) the Chamfer is still on the same Edge. That is because I have a robust way of referencing that Edge
- The third solid for both cases is the fusion object that was used to create the Chamfer. I have included these in order to show that there is no funny business going on: both the red and blue fusion objects will show (via the Report View) that the "edge to be chamfered" is named "Edge3".
The original Edge, in case you are wondering, was named "Edge10". This is why the FreeCAD implementation fails
I think, for now, I am going to take a break from the PyTopoNamer and begin work on what I'm calling CppTopoNamer. It will be the same as the Python prototype but written from the ground up in C++. This may take me some time, as I am new to unit testing in C++, and I feel it is imperitive that this component have robust unit testing.
Re: Python Topological Namer/Tracker
That is very promising!!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Python Topological Namer/Tracker
This is truly awesome! makes me cry when i think of how many hours i have spent fighting issues related to topological naming... Keep it up!
Re: Python Topological Namer/Tracker
Tears in my eye as well, be weary you confused references, @ezzieyguywuf is coming to eradicate you! Your days are numbered.
Need help? Feel free to ask, but please read the guidelines first
-
- Posts: 656
- Joined: Tue May 19, 2015 1:11 am
Re: Python Topological Namer/Tracker
Glad people are excited! The CppTopoNamer is taking form slowly, as i said in an earlier post I'm not familiar at all with C++ and unit tests so it's taking a while to get rolling - I have made progress though. Right now I'm trying to figure out a good way to mock the OpenCascade classes, i.e. TopoDS_Shape.
Re: Python Topological Namer/Tracker
Good to see progress!
Re: Python Topological Namer/Tracker
Hello all,
at the beginning thanks to everybody who is working on FreeCAD an making this wonderful piece of software work...
@ezzieyguywuf i am interested in how you are realizing the unit tests in c++. What framework are you using?
I have no clue how a unit test with c++ should look like for FreeCAD. I would try to use gtest, but i dont know what the commen way in FreeCAD is...
Also i havent found the answer in the forum or the dokumentation....
I hope someone can lead me to the answer...
Thanks...
at the beginning thanks to everybody who is working on FreeCAD an making this wonderful piece of software work...
@ezzieyguywuf i am interested in how you are realizing the unit tests in c++. What framework are you using?
I have no clue how a unit test with c++ should look like for FreeCAD. I would try to use gtest, but i dont know what the commen way in FreeCAD is...
Also i havent found the answer in the forum or the dokumentation....
I hope someone can lead me to the answer...
Thanks...
-
- Posts: 656
- Joined: Tue May 19, 2015 1:11 am
Re: Python Topological Namer/Tracker
I have made some small progress on this. You can see my work here on my github. You'll want to start with SolidManager_PrimitiveTester.cpp which shows some very basic tests for the Topological Namer that I'm working on.
You'll also want to take a look at IEdge.h, IFace.h, and ISolid.h. These three header files describe a generic interface to a topological Edge, Face, and Solid respectively. The idea is that my Topological Namer (and really, any component within FreeCAD in general) does not need to know specifically about TopoDS_Edge, TopoDS_Face, nor TopoDS_Solid from OpenCascade. Rather, what the Topological Namer needs to know is about an interface to these entities.
So, what I have right now is a very very basic interface for these - essentially, only exposing the functionality that I need for a basic Topological Namer test. You'll notice in my test/include folder I've defined some classes (i.e. Mock_Edge.h) which implement these headers. These 'mock' classes implement the respective interfaces in a very naive manner: for example, for checking equality they accept an integer to identify themselves and check if this value is equal. This works well for my basic tests - you can see how I use these mock classes in the MockObjectMaker helper class.
Anywho, hopefully this helps a little bit. Let me know if you have any questions, I haven't really gotten around to documenting this code yet.