how to add STEP import/export FC check

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
User avatar
easyw-fc
Posts: 1961
Joined: Thu Jul 09, 2015 9:34 am

how to add STEP import/export FC check

Postby easyw-fc » Mon Apr 16, 2018 1:44 pm

Hi,
following this recent issue for STEP interchange:
https://freecadweb.org/tracker/view.php?id=3426
I would like to add some example code & macros to enable a sort of automatic check if some basic feature are still available when a new FC release is going to be deployed...
Something similar to FEM testing files and routines...

What I'm going to add it would be:
1) test in loading a simple single object STEP file (checking the objects loaded in FC)
2) test in loading a multiple objects STEP file (checking the objects loaded in FC)
3) test in loading a hierarchy of objects STEP file (checking the objects loaded in FC)

4) test in saving a simple single object STEP file (checking when reloaded, the objects loaded in FC)
5) test in saving a multiple objects STEP file (checking when reloaded, the objects loaded in FC)
6) test in saving a hierarchy of objects STEP file (checking when reloaded, the objects loaded in FC)
7) test in saving a compound of objects STEP file (checking when reloaded, the objects loaded in FC)

In which way these checking could be added to FC checking?

Thx in advance
Maurice
wmayer
Site Admin
Posts: 13182
Joined: Thu Feb 19, 2009 10:32 am

Re: how to add STEP import/export FC check

Postby wmayer » Mon Apr 16, 2018 5:03 pm

In which way these checking could be added to FC checking?
The best would be to create some simple STEP files and put them to the data/examples directory. Then create a file TestImport.py and put it into the Import module.

Write some unit tests to check all these cases. You can look at some other unit tests to see how to do it.
User avatar
easyw-fc
Posts: 1961
Joined: Thu Jul 09, 2015 9:34 am

Re: how to add STEP import/export FC check

Postby easyw-fc » Mon Apr 16, 2018 7:06 pm

wmayer wrote:
Mon Apr 16, 2018 5:03 pm
In which way these checking could be added to FC checking?
The best would be to create some simple STEP files and put them to the data/examples directory. Then create a file TestImport.py and put it into the Import module.

Write some unit tests to check all these cases. You can look at some other unit tests to see how to do it.
Thanks Werner
I will have a look at 'TestFem.py' ...

Then I could:
1) add 'TestImport.py' at 'FreeCAD\Mod\Import' folder
2) add 'steptest' folder with some testing scritps inside
3) add 'testfiles' folder inside 'steptest' folder with some STEP files inside
Does it sound fine?

Thx
Maurice
wmayer
Site Admin
Posts: 13182
Joined: Thu Feb 19, 2009 10:32 am

Re: how to add STEP import/export FC check

Postby wmayer » Mon Apr 16, 2018 8:57 pm

Sounds good.
User avatar
easyw-fc
Posts: 1961
Joined: Thu Jul 09, 2015 9:34 am

Re: how to add STEP import/export FC check

Postby easyw-fc » Fri Apr 20, 2018 1:01 pm

wmayer wrote:
Mon Apr 16, 2018 8:57 pm
Sounds good.
I would need to check also face colors and I was going to add FreeCADGui to testing code...
Is that enabled or should I stay on the FC command interface (no Gui)?
User avatar
sgrogan
Posts: 4499
Joined: Wed Oct 22, 2014 5:02 pm

Re: how to add STEP import/export FC check

Postby sgrogan » Fri Apr 20, 2018 1:09 pm

easyw-fc wrote:
Fri Apr 20, 2018 1:01 pm
I would need to check also face colors and I was going to add FreeCADGui to testing code...
Is that enabled or should I stay on the FC command interface (no Gui)?
There's no GUI on the CI engines, so you would need to only run the test if the GUI is up. I think there are other tests like this, more tests are run from the GUI than the command line.
User avatar
easyw-fc
Posts: 1961
Joined: Thu Jul 09, 2015 9:34 am

Re: how to add STEP import/export FC check

Postby easyw-fc » Fri Apr 20, 2018 1:21 pm

easyw-fc wrote:
Fri Apr 20, 2018 1:01 pm
I would need to check also face colors and I was going to add FreeCADGui to testing code...
sgrogan wrote:
Fri Apr 20, 2018 1:09 pm
There's no GUI on the CI engines, so you would need to only run the test if the GUI is up.
Is there a way to check a Face and a Shape color without the Gui up?
wmayer
Site Admin
Posts: 13182
Joined: Thu Feb 19, 2009 10:32 am

Re: how to add STEP import/export FC check

Postby wmayer » Fri Apr 20, 2018 1:32 pm

You can also use Gui in the unit tests. We do this in a lot of other places, too. However, it would be best to create a file TestImportGui.py to separate GUI stuff from non-GUI stuff.
User avatar
easyw-fc
Posts: 1961
Joined: Thu Jul 09, 2015 9:34 am

Re: how to add STEP import/export FC check

Postby easyw-fc » Fri Apr 20, 2018 1:37 pm

wmayer wrote:
Fri Apr 20, 2018 1:32 pm
You can also use Gui in the unit tests. We do this in a lot of other places, too. However, it would be best to create a file TestImportGui.py to separate GUI stuff from non-GUI stuff.
ok thx :D