Ticket #6131 - Can't save color

About the development of the FEM module/workbench.

Moderator: bernd

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

Re: Ticket #6131 - Can't save color

Post by johnwang »

jnxd wrote: Sat May 07, 2022 8:52 am The .FCStd file is a zip folder (just open with your archive software like winzip, or change the filename to .zip). In that you can see
Thanks, learnt new thing. Never touched FC file structure.
For UNV file, Node is under section 2411. Element under section 2412.
From here https://www.eng-tips.com/viewthread.cfm ... 3ee226a8dc

Code: Select all

Universal Dataset Number 2412

Name:   Elements
Status: Current
Owner:  Simulation
Revision Date: 14-AUG-1992
-----------------------------------------------------------------------
 
Record 1:        FORMAT(6I10)
                 Field 1       -- element label
                 Field 2       -- fe descriptor id
                 Field 3       -- physical property table number
                 Field 4       -- material property table number
                 Field 5       -- color
                 Field 6       -- number of nodes on element
 
Record 2:  *** FOR NON-BEAM ELEMENTS ***
                 FORMAT(8I10)
                 Fields 1-n    -- node labels defining element
 
Record 2:  *** FOR BEAM ELEMENTS ONLY ***
                 FORMAT(3I10)
                 Field 1       -- beam orientation node number
                 Field 2       -- beam fore-end cross section number
                 Field 3       -- beam  aft-end cross section number
 
Record 3:  *** FOR BEAM ELEMENTS ONLY ***
                 FORMAT(8I10)
                 Fields 1-n    -- node labels defining element
 
Records 1 and 2 are repeated for each non-beam element in the model.
Records 1 - 3 are repeated for each beam element in the model.
I opened the UNV file,

Code: Select all

  2412
         1        41         2         1         7         3
         1         2         3
         2        41         2         1         7         3
         2         4         3
    -1
The Field 5 of Record 1 is color. Here = 7. I tried to change it to another value, no effect.
Where in the code write out this unv file? or maybe the import part ignored the color? Or FemMesh obj doesn't store this color?

Cheers,

John
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
jnxd
Posts: 577
Joined: Mon Mar 30, 2015 2:30 pm

Re: Ticket #6131 - Can't save color

Post by jnxd »

johnwang wrote: Sat May 07, 2022 9:52 am The Field 5 of Record 1 is color. Here = 7. I tried to change it to another value, no effect.
The color appears to be stored in GuiDocument.xml. I saved a copy of the file with a "random color" set and compared the contents of the zip folders (see attached; as mentioned before .FCStd files are simply zip folders). Of the three files in each, the UNV file was the same but there was a difference in GuiDocument.xml.

Code: Select all

diff -u --label \#\<buffer\ GuiDocument.xml\<minimal\>\> --label \#\<buffer\ GuiDocument.xml\<minimal-1\>\> /tmp/buffer-content-1L4dZf /tmp/buffer-content-MQreLX
--- #<buffer GuiDocument.xml<minimal>>
+++ #<buffer GuiDocument.xml<minimal-1>>
@@ -38,10 +38,10 @@
                     <Integer value="0"/>
                 </Property>
                 <Property name="ShapeColor" type="App::PropertyColor" status="1">
-                    <PropertyColor value="4289921024"/>
+                    <PropertyColor value="4206535424"/>
                 </Property>
                 <Property name="ShapeMaterial" type="App::PropertyMaterial" status="1">
-                    <PropertyMaterial ambientColor="858993408" diffuseColor="4289921024" specularColor="0" emissiveColor="0" shininess="0.2000000029802322" transparency="0.0000000000000000"/>
+                    <PropertyMaterial ambientColor="858993408" diffuseColor="4206535424" specularColor="0" emissiveColor="0" shininess="0.2000000029802322" transparency="0.0000000000000000"/>
                 </Property>
                 <Property name="ShowInTree" type="App::PropertyBool" status="1">
                     <Bool value="true"/>

There was also a difference in Document.xml but the difference was just in version and timestamps.
Attachments
minimal.FCStd
(2.45 KiB) Downloaded 12 times
minimal-1.FCStd
(2.46 KiB) Downloaded 11 times
User avatar
johnwang
Veteran
Posts: 1089
Joined: Sun Jan 27, 2019 12:41 am

Re: Ticket #6131 - Can't save color

Post by johnwang »

UNV 2412 element data are READ from here into SMESH, seems only element type and node data.
https://github.com/FreeCAD/FreeCAD/blob ... h.cpp#L165

And SMESH data are WRITTEN to UNV 2412 element from here:
https://github.com/FreeCAD/FreeCAD/blob ... h.cpp#L125

How SMESH is colored?
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
Kunda1
Veteran
Posts: 12692
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #6131 - Can't save color

Post by Kunda1 »

Can someone please test git commit a5ff515 and report back?
@johnwang
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
johnwang
Veteran
Posts: 1089
Joined: Sun Jan 27, 2019 12:41 am

Re: Ticket #6131 - Can't save color

Post by johnwang »

Kunda1 wrote: Wed May 25, 2022 7:10 pm Can someone please test git commit a5ff515 and report back?
@johnwang
Still the same.

I downloaded the two changed files and compiled.

Code: Select all

2>ViewProvider.cpp
......
2>MeshSelection.cpp
2>Generating Code...
2>   Creating library H:/bjFreeCAD/src/Mod/Mesh/Gui/Release/MeshGui.lib and object H:/bjFreeCAD/src/Mod/Mesh/Gui/Release/MeshGui.exp
2>MeshGui.vcxproj -> H:\bjFreeCAD\Mod\Mesh\MeshGui.pyd
========== Build: 2 succeeded, 0 failed, 5 up-to-date, 0 skipped ==========
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
Post Reply