Ticket #6131 - Can't save color

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
johnwang
Veteran
Posts: 1339
Joined: Sun Jan 27, 2019 12:41 am

Ticket #6131 - Can't save color

Post by johnwang »

Hi,

Using this code to generate a FemMesh object with two triangle elements. Then changed the color of one element. But after saving and reopen, the color is lost.

Regards,

John

Code: Select all

import Fem

a = Fem.FemMesh()

a.addNode(0,    0,    0,    1)
a.addNode(10,    0,    0,    2)
a.addNode(5,    10,    0,    3)
a.addNode(15,    15,    0,    4)

a.addFace([1,2,3], 1)
a.addFace([2,4,3], 2)
obj = FreeCAD.ActiveDocument.addObject("Fem::FemMeshObject")
#obj.Placement.Base = FreeCAD.Vector(2, 0, 0)
obj.FemMesh = a

obj.ViewObject.ElementColor = {1:(1,0,0)}
tc.jpg
tc.jpg (23.16 KiB) Viewed 2719 times
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20839 (Git)
Build type: Release
Branch: master
Hash: 09005766f10539dfe32314c33c2cd3efe9141d0b
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
Last edited by Kunda1 on Tue Mar 15, 2022 3:50 pm, edited 2 times in total.
Reason: updated ticket to GH migrated ticket number
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
kisolre
Veteran
Posts: 4159
Joined: Wed Nov 21, 2018 1:13 pm

Re: Can't save color

Post by kisolre »

Please retry with latest build. There are some 2200 commits since your version. Might be fixed already...
User avatar
johnwang
Veteran
Posts: 1339
Joined: Sun Jan 27, 2019 12:41 am

Re: Can't save color

Post by johnwang »

kisolre wrote: Fri Nov 20, 2020 8:20 am Please retry with latest build. There are some 2200 commits since your version. Might be fixed already...
Not working in 22900 either.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Can't save color

Post by bernd »

moved to FEM to not miss it
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Can't save color

Post by bernd »

How did you changed the color? By python too? Would you provide this code as well?

bernd
User avatar
johnwang
Veteran
Posts: 1339
Joined: Sun Jan 27, 2019 12:41 am

Re: Can't save color

Post by johnwang »

the last sentence.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Can't save color

Post by bernd »

johnwang wrote: Tue Nov 24, 2020 7:32 am the last sentence.
ahh I missed this. BTW if you add a new line at the end of code blocks the last line is executed without pressing another time enter after copy past.

confirmed for

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22960 (Git)
Build type: Release
Branch: master
Hash: c5a4b01d2e4218bcc0eb6650337650a6c65ef0e4
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Switzerland (de_CH)


ATM I have no idea why. You said you filled a bug report. would you post the link. I allready deleted the pm :oops:
User avatar
johnwang
Veteran
Posts: 1339
Joined: Sun Jan 27, 2019 12:41 am

Re: Can't save color

Post by johnwang »

hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Can't save color

Post by bernd »

AFAIK this method is used to set the colors:

https://github.com/FreeCAD/FreeCAD/blob ... h.cpp#L651

this only sets the scene graph, but the colors are not saved anywhere AFAIKT
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Can't save color

Post by bernd »

johnwang wrote: Tue Nov 24, 2020 9:04 am a bug report at:
https://tracker.freecadweb.org/view.php?id=4499
better to use the but icon in the forum ... issue #4499
Post Reply