Exported STEP-File contains surplus PRODUCT

Post here for help on using FreeCAD's graphical user interface (GUI).
SMusche
Posts: 2
Joined: Fri Feb 03, 2017 1:46 pm

Exported STEP-File contains surplus PRODUCT

Postby SMusche » Fri Feb 03, 2017 2:26 pm

Sometimes STEP files exported with 0.16 (or actual 0.17) cause problems when imported to other applications. It could then help to export to STEP with FreeCAD 0.15.

This is because in FreeCAD 0.15 the exported STEP-file includes only the objects which were selected for export before starting the export dialog. In 0.16 / 0.17 the STEP-file contains a "PRODUCT('ASSEMBLY','ASSEMBLY','',(0000008));" in addition to the preselected objects. This additional product 'ASSEMBLY' sometime causes trouble, when importing the 0.16 / 0.17 STEP file into other applications, especially when they expect the STEP file to contain only one PRODUCT.

I checked customer STEP-files I received, which were created with commercial systems (e. g. PRO/ENGINEER) and they did only contain the one PRODUCT which they were supposed to contain.

I filed this as a minor bug under http://freecadweb.org/tracker/view.php?id=2698

My workaround:
I reinstalled 0.15 (in parallel to 0.17 / 0.17 and use this to export to STEP after finishing my work in 0.16 / 0.17. The STEP files exported with 0.15 work fine.

In case I posted this hints in the wrong sub-forum please excuse and shift it to the proper forum.

Let me take this opportunity to send my particular THANKS to everyone involved in the development of FreeCAD. I greatly appreciate your efforts.

Version info:
-----
OS: Windows 7
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
-----
OS: Windows 7
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
-----
OS: Windows 7
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.17.9798 (Git)
Build type: Release
Branch: master
Hash: fdd34efa4356cfe6d83230a333526023356e98e3
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0
-----
wmayer
Site Admin
Posts: 11344
Joined: Thu Feb 19, 2009 10:32 am

Re: Exported STEP-File contains surplus PRODUCT

Postby wmayer » Fri Feb 03, 2017 4:35 pm

At least a workaround is not to use File > Export but loading Part workbench and from there Part > Export CAD. When using the default file filter we internally use the simplified STEP export and this does not seem to create two assemblies.

I can see that the results for v0.15 and v0.16 are different and since it's the same occ version we can exclude occ as the reason. So, it must be a FreeCAD-specific change. When looking through the files then I found this change git commit 854b4be506/git commit f8eb61fdf which might explain the behaviour.
wmayer
Site Admin
Posts: 11344
Joined: Thu Feb 19, 2009 10:32 am

Re: Exported STEP-File contains surplus PRODUCT

Postby wmayer » Fri Feb 03, 2017 5:24 pm

Confirmed. As I said before it's caused by these two changes.
However, the changes were needed to fix another issue: https://forum.freecadweb.org/viewtopic.php?t=10221
User avatar
easyw-fc
Posts: 654
Joined: Thu Jul 09, 2015 9:34 am

Re: Exported STEP-File contains surplus PRODUCT

Postby easyw-fc » Mon Feb 27, 2017 11:52 am

wmayer wrote:At least a workaround is not to use File > Export but loading Part workbench and from there Part > Export CAD. When using the default file filter we internally use the simplified STEP export and this does not seem to create two assemblies.

Hi @wmayer
the workaround works only if STEP is exported without colors...
In case
Export but loading Part workbench and from there Part > Export CAD is used but STEP with colors is selected in the 'Save as' combo box, the result has the extra structure
step-extra-structure.png
step-extra-structure.png (136.72 KiB) Viewed 360 times
step-no-colors-structure.png
step-no-colors-structure.png (139.56 KiB) Viewed 360 times

tested both in FC 016 and FC 017 in windows
Maurice
vejmarie
Posts: 449
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Exported STEP-File contains surplus PRODUCT

Postby vejmarie » Fri Mar 24, 2017 9:25 pm

wmayer wrote:Confirmed. As I said before it's caused by these two changes.
However, the changes were needed to fix another issue: https://forum.freecadweb.org/viewtopic.php?t=10221


Hello,

that is really strange to be forced to define an Assembly into the step file to be able to keep relative positionning. I am not even sure to properly understand the issue reported within https://forum.freecadweb.org/viewtopic.php?t=10221#p83004. Can you just re-explain it as you understood it, as to be sure ?

Will you agree if I move this into an export parameter instead of creating the assembly, as what I expect from a STEP file is that if you select a shape, you do have a shape inside the STEP which becomes a product and not an assembly. If we want keep track of assembly and add one for fixing the initial issue reported, I think a check box at save operation shall be good. Another option might be that the end user define a top level assembly within the Tree and we are able to detect it as the export will have to be done from it instead of the Shape itself, this shall be doable using App::Part new object.

What is your opinion ?

vejmarie
wmayer
Site Admin
Posts: 11344
Joined: Thu Feb 19, 2009 10:32 am

Re: Exported STEP-File contains surplus PRODUCT

Postby wmayer » Sun Mar 26, 2017 2:19 pm

I am not even sure to properly understand the issue reported within https://forum.freecadweb.org/viewtopic. ... 221#p83004. Can you just re-explain it as you understood it, as to be sure ?

For the reporter it is important to keep the explicit placement information of an object. At that time our STEP exporter (from the Import module based on ocaf and the high-level STEPCAFControl_Writer class) lost the placement information and instead exported the transformed geometry (i.e. it implied the placement information). Using the assembly structure did the trick but now other applications complain about the product assembly.

OCC also offers the lower level STEPControl_Writer class and when using that the placement is also kept -- but only when two or more objects are exported.
User avatar
easyw-fc
Posts: 654
Joined: Thu Jul 09, 2015 9:34 am

Re: Exported STEP-File contains surplus PRODUCT

Postby easyw-fc » Sun Mar 26, 2017 3:05 pm

wmayer wrote:OCC also offers the lower level STEPControl_Writer class and when using that the placement is also kept -- but only when two or more objects are exported.

Then I think It would be nice to have an option to select the way to export STEP
1) keep the explicit placement but using ASSEMBLY extra product
2) avoiding extra ASSEMBLY product but removing explicit placement
3) using low level StepControl_Writer class
vejmarie wrote:Will you agree if I move this into an export parameter instead of creating the assembly, as what I expect from a STEP file is that if you select a shape, you do have a shape inside the STEP which becomes a product and not an assembly. If we want keep track of assembly and add one for fixing the initial issue reported, I think a check box at save operation shall be good.

The best it would be, if possible, if the exporting mode could be select-able through a variable that can be changed in run time.. so it can be used with scripts without the need to close and relaunch FC...
In this way I could check the value and eventually change it to the wanted one during the generation of 3D models, and revert back to user preferences at the end of the script execution...

Thx a lot to all of you for taking care of this STEP behavior
Maurice
wmayer
Site Admin
Posts: 11344
Joined: Thu Feb 19, 2009 10:32 am

Re: Exported STEP-File contains surplus PRODUCT

Postby wmayer » Sun Mar 26, 2017 3:57 pm

Then I think It would be nice to have an option to select the way to export STEP
1) keep the explicit placement but using ASSEMBLY extra product
2) avoiding extra ASSEMBLY product but removing explicit placement
3) using low level StepControl_Writer class

Having an option like this is always a bit problematic because people are unaware of what the behaviour might be and still run into problems when using the wrong one.

I have made a few more tests and I think I found the relevant difference between the low-level and high-level STEP export (i.e. the way how we use it):
  • the low-level method only keeps the explicit placement information when exporting two or more objects. When only one object is selected it also loses the explicit placement information
  • the high-level method always keeps the explicit placement information but if only one object is selected we have the product issue

So, the best would be to make the high-level export behave the same way as the low-level export. This way we avoid both problems and I think it's OK to lose explicit placement for only one object because this is actually not an assembly since it requires several objects.
User avatar
easyw-fc
Posts: 654
Joined: Thu Jul 09, 2015 9:34 am

Re: Exported STEP-File contains surplus PRODUCT

Postby easyw-fc » Sun Mar 26, 2017 4:14 pm

wmayer wrote:Having an option like this is always a bit problematic because people are unaware of what the behaviour might be and still run into problems when using the wrong one.

I have made a few more tests and I think I found the relevant difference between the low-level and high-level STEP export (i.e. the way how we use it):
  • the low-level method only keeps the explicit placement information when exporting two or more objects. When only one object is selected it also loses the explicit placement information
  • the high-level method always keeps the explicit placement information but if only one object is selected we have the product issue

So, the best would be to make the high-level export behave the same way as the low-level export. This way we avoid both problems and I think it's OK to lose explicit placement for only one object because this is actually not an assembly since it requires several objects.

+1 from my side... (I was suggesting just a workaround in case no better method available)
Thx again
Maurice
wmayer
Site Admin
Posts: 11344
Joined: Thu Feb 19, 2009 10:32 am

Re: Exported STEP-File contains surplus PRODUCT

Postby wmayer » Sun Mar 26, 2017 4:31 pm