View Issue Details

IDProjectCategoryView StatusLast Update
0003165FreeCADBugpublic2018-09-28 09:59
ReporterBatteries Included Assigned Towmayer  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformMacOSOSXOS Version10.12.6
Product Version0.17 
Target Version0.18Fixed in Version0.18 
Summary0003165: Color information lost in STEP export
DescriptionExporting a coloured model using either of these approaches


Part.export([PART],'a.step')
or

App.ActiveDocument.PART.Shape.exportStep('b.step')

Results in a step file that has no colour information.

Color is included if the step file is written using

import ImportGui
ImportGui.export([FreeCAD.getDocument("test").getObject("PART")],u"c.step")

Unfortunately this 3rd approach cannot be used from freecadcmd, and that is all I have available for reasons of running on a headless Linux box in the cloud, and for performance reasons.

Steps To Reproduce
# Save the attached trivial OpenSCAD file test.scad somewhere handy and use this script
import importCSG
import Part

# Read in the OpenSCAD file to get a colored part
importCSG.open(u"test.scad")
App.setActiveDocument("test")

# Write out STEP
Part.export([App.ActiveDocument.getObject('Group')],'a.step')
App.ActiveDocument.Group.Shape.exportStep('b.step')

# Observe there is no color information in the step file by confirming the absence of any STYLED_ITEM('color' constructs in the file or by using your favourite step viewer.
Additional InformationOS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11797 (Git)
Build type: Release
Branch: (detached from a508032)
Hash: a5080329d8da6653495df686efbda62e73ac950a
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedKingdom (en_GB)
Tagscolors, STEP
FreeCAD Information

Activities

Batteries Included

2017-08-18 06:49

reporter  

test.scad (127 bytes)

Kunda1

2017-08-18 10:27

administrator   ~0009947

Last edited: 2017-08-18 10:27

@Batteries_Included please open a forum thread to discuss with community. Thanks!

Batteries Included

2017-08-18 11:10

reporter   ~0009952

Hi Kunda1

I did start with the forums back in July
https://forum.freecadweb.org/viewtopic.php?f=22&t=23494&p=183093#p183093

Some suggestions arrived as private messages which I tried, and ended up with just a better example to show the problem. The final suggestion was 0.17 and then file a bug report.

Thanks.

wmayer

2017-08-19 09:30

administrator   ~0009953

It's of course possible to create a STEP file with color information from the command line only. See: https://forum.freecadweb.org/viewtopic.php?f=22&t=23494&p=187294#p187294

Batteries Included

2017-08-19 14:51

reporter   ~0009957

Following wmayers post we have a working solution. So personally this loss of color information no longer matters. I would like to drop the severity to minor or less, but I do not see any way to edit my bug report.

wmayer

2017-08-19 15:22

administrator   ~0009958

Is there still something left that must be fixed/implemented? Otherwise the ticket can be closed.

Batteries Included

2017-08-19 15:59

reporter   ~0009961

I would expect that when a coloured model is read in, when its exported the colour would be included, export format permitting.

We know FreeCAD can write coloured STEP files now, so it still strikes me as a bug that it doesn't use the colour information it has, either from the import or from the view.

However as you have been kind enough to give me a way forward I am happy with what ever you choose to do with this bug.

keithsloan52

2017-08-19 18:53

developer   ~0009962

My understanding is that @vejmarie did the latest STEP developments. Maybe he/she could look at adding support for colour.

vejmarie

2017-08-19 18:59

developer   ~0009963

I can have a look, but have a big todo list right now. The ImportGUI code is the one I worked on lately. The Part code is older, and more basic implementation of STEP Import/Export. I will check why it doesn't export Color, but give me a few weeks.

Kunda1

2017-08-19 19:31

administrator   ~0009964

assigning to vejmarie

Kunda1

2017-11-21 16:14

administrator   ~0010451

@vejmarie we're starting to go through vet which tickets are relevant to 0.17 release and which should be bumped. Care to weigh in on this one?

wmayer

2018-09-28 09:59

administrator   ~0011866

With https://github.com/FreeCAD/FreeCAD/commit/02ab1c9424944bbf289931ac31045efbce0b1e0d the STEP import on the command line has been improved to return a list of part object/colors pairs.

It's up to the caller to decide what to do with the color information. When running the command line version of STEP import in GUI mode you can e.g. do this:


import Import

parts=Import.open("file.step")
for i in parts:
  i[0].ViewObject.DiffuseColor = i[1]

If a user only uses the command line version of FreeCAD it's up to him to save the color information in his own data structure.


Btw, the STEP export in the Part module is not supposed to handle colors as here the simplified class of OCCT is used which doesn't support. That's the reason why the Import module has been created where the OCAF framework can be used with extended support of color and names.

Issue History

Date Modified Username Field Change
2017-08-18 06:49 Batteries Included New Issue
2017-08-18 06:49 Batteries Included File Added: test.scad
2017-08-18 06:49 Batteries Included Tag Attached: colors
2017-08-18 06:49 Batteries Included Tag Attached: STEP
2017-08-18 10:27 Kunda1 Note Added: 0009947
2017-08-18 10:27 Kunda1 Note Edited: 0009947
2017-08-18 10:27 Kunda1 Note Edited: 0009947
2017-08-18 10:28 Kunda1 Tag Attached: #post-to-forum
2017-08-18 10:29 Kunda1 Description Updated
2017-08-18 10:29 Kunda1 Steps to Reproduce Updated
2017-08-18 10:30 Kunda1 Description Updated
2017-08-18 11:10 Batteries Included Note Added: 0009952
2017-08-19 09:30 wmayer Note Added: 0009953
2017-08-19 14:51 Batteries Included Note Added: 0009957
2017-08-19 15:22 wmayer Note Added: 0009958
2017-08-19 15:59 Batteries Included Note Added: 0009961
2017-08-19 18:53 keithsloan52 Note Added: 0009962
2017-08-19 18:59 vejmarie Note Added: 0009963
2017-08-19 19:30 Kunda1 Assigned To => vejmarie
2017-08-19 19:30 Kunda1 Status new => assigned
2017-08-19 19:31 Kunda1 Note Added: 0009964
2017-08-19 19:31 Kunda1 Target Version => 0.17
2017-08-19 19:31 Kunda1 Tag Detached: #post-to-forum
2017-11-21 16:14 Kunda1 Note Added: 0010451
2017-11-26 15:08 wmayer Target Version 0.17 => 0.18
2018-09-28 09:59 wmayer Assigned To vejmarie => wmayer
2018-09-28 09:59 wmayer Status assigned => closed
2018-09-28 09:59 wmayer Resolution open => fixed
2018-09-28 09:59 wmayer Fixed in Version => 0.18
2018-09-28 09:59 wmayer Note Added: 0011866