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.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
easyw-fc
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

how to add STEP import/export FC check

Post by easyw-fc »

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
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: how to add STEP import/export FC check

Post by wmayer »

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
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: how to add STEP import/export FC check

Post by easyw-fc »

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
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: how to add STEP import/export FC check

Post by wmayer »

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

Re: how to add STEP import/export FC check

Post by easyw-fc »

wmayer wrote: Mon Apr 16, 2018 8:57 pmSounds 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
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: how to add STEP import/export FC check

Post by sgrogan »

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.
"fight the good fight"
User avatar
easyw-fc
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: how to add STEP import/export FC check

Post by easyw-fc »

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
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: how to add STEP import/export FC check

Post by wmayer »

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
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: how to add STEP import/export FC check

Post by easyw-fc »

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
Post Reply