Material improvements

I haven’t had time to clean up and push anything. I’ll see if I get time to at least push something this weekend.

Eivind

:sunglasses:

Related:



Reminder.

eivind …

would you make your latest dev public?

I didn’t go through this entire thread. I jumped from here. Just to clarify some related issue about map accessing. The linked post uses Python code injection for map key retrieval, which has been removed during the big merge for obvious security reason. The current expression parser supports similar list/slice/map accessing syntax as Python. And it accepts expression as index or key. For example, the code in the linked post can be changed to (assuming ‘Density’ is a property of the current object)

Panel014.Material.Material[.Density]

It can even be shortened to the following with some small modification to the ‘Material’ property (I don’t know what type exactly), similar to the modification here to sketch’s PropertyConstraintList.

Panel014.Material[.Density]

Something rebased on current master that compiles, but lacking both testing and features: https://github.com/eivindkv/FreeCAD/tree/Material_rebased

Eivind

very cool :slight_smile: just gave it a try …

had a compile error on gcc on linux debian buster …


hugo@Ahorn:~/build$ make
[  0%] Built target MEFISTO2
[  1%] Built target SMDS
[  1%] Built target SMESHDS
[  1%] Built target Driver
[  2%] Built target DriverSTL
[  2%] Built target DriverDAT
[  2%] Built target DriverUNV
[  3%] Built target SMESH
[  5%] Built target StdMeshers
[  8%] Built target FreeCADBase
[  9%] Generating version_check
git
/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/src/Build/Version.h.out written
[  9%] Generating Version.h
[  9%] Built target fc_version
[  9%] Building CXX object src/App/CMakeFiles/FreeCADApp.dir/MaterialDatabase.cpp.o
/home/hugo/Documents/dev/freecad/freecadbhb_dev/freecad/src/App/MaterialDatabase.cpp: In static member function ‘static boost::any App::MaterialDatabase::python2string(const PyObject*)’:
/home/hugo/Documents/dev/freecad/freecadbhb_dev/freecad/src/App/MaterialDatabase.cpp:150:26: error: ‘PyString_AsString’ was not declared in this scope
     std::string string = PyString_AsString(unicode);
                          ^~~~~~~~~~~~~~~~~
/home/hugo/Documents/dev/freecad/freecadbhb_dev/freecad/src/App/MaterialDatabase.cpp:150:26: note: suggested alternative: ‘PyBytes_AsString’
     std::string string = PyString_AsString(unicode);
                          ^~~~~~~~~~~~~~~~~
                          PyBytes_AsString
make[2]: *** [src/App/CMakeFiles/FreeCADApp.dir/build.make:728: src/App/CMakeFiles/FreeCADApp.dir/MaterialDatabase.cpp.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:789: src/App/CMakeFiles/FreeCADApp.dir/all] Fehler 2
make: *** [Makefile:130: all] Fehler 2
hugo@Ahorn:~/build$

Probably a python 2/3 issue. I’ve made a change so please pull the branch again.

Eivind

done. compiles on Debian Buster with Py3, but on startup …

hugo@Ahorn:~/Documents/dev/freecad/freecadbhb_dev/build$
hugo@Ahorn:~/Documents/dev/freecad/freecadbhb_dev/build$ ./bin/FreeCAD
Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x37840) [0x7f076e0e0840]
#1  /lib/x86_64-linux-gnu/libpython3.7m.so.1.0(PyTuple_New+0xf7) [0x7f0770969fb7]
#2  /lib/x86_64-linux-gnu/libpython3.7m.so.1.0(PyType_Ready+0x1ab2) [0x7f07707cab62]
#3  /lib/x86_64-linux-gnu/libpython3.7m.so.1.0(PyType_Ready+0x1ee8) [0x7f07707caf98]
#4  0x7f0771367f6e in Py::PythonType::readyType() from /home/hugo/Documents/dev/freecad/freecadbhb_dev/build/lib/libFreeCADBase.so+0x1c
#5  0x7f0772115d0b in Py::SolidMaterialArray::init_type() from /home/hugo/Documents/dev/freecad/freecadbhb_dev/build/lib/libFreeCADApp.so+0x46
#6  0x7f07721157b4 in Py::PropertyPartMaterial::init_type() from /home/hugo/Documents/dev/freecad/freecadbhb_dev/build/lib/libFreeCADApp.so+0x16
#7  0x7f077216aa71 in App::Application::initTypes() from /home/hugo/Documents/dev/freecad/freecadbhb_dev/build/lib/libFreeCADApp.so+0x1ff
#8  0x7f077216a82d in App::Application::init(int, char**) from /home/hugo/Documents/dev/freecad/freecadbhb_dev/build/lib/libFreeCADApp.so+0x35
#9  ./bin/FreeCAD(main+0x6ef) [0x556880aa3d29]
#10  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7f076e0cd09b]
#11  ./bin/FreeCAD(_start+0x2a) [0x556880aa34ca]
hugo@Ahorn:~/Documents/dev/freecad/freecadbhb_dev/build$

How about this? Is someone able to start the dev branch of eivind? How about a rebase on latest master?

I’ve been reading this thread with some hope that an update is coming? I’m looking for a way to describe different CTEs at different temperatures for FEM on a material card. I think that this is important enough that it needs to be on someone’s radar. Properties change with temperature. For example, ultimate strength… it may be that your particular material has a higher UTS ultimate tensile strength if its warmer than room temp. Such as refractory materials for example like molybdenum.

Another example is dissimilar CTE bonding of materials. For example soldering two metals with a glass. The glass in this case would melt at low 300-500C while the metal would melt at 1000+C temp. But the glass transition affects the properties of the glass tremendously so it is interesting to investigate the residual stress after the materials have cooled. This is for example used in microchip design, light bulb connectors, vacuum passthroughs, syringe design and really many other use cases where two dissimilar materials are bonded and the temperature is a factor that affects the CTEs.

At the moment, I think the only way is to go into the input file to Calculix and manually add different property changes at different temperatures. It would be nice if that info came from a materials card that I could re-use every time.

This thread seems to have died, so I’m foolishly takin on this task!

I’ll steal where possible, but the result might not be identical. I’ve started a new thread here: https://devtalk.freecad.org/t/material-overhaul/69483/1

I’m on the same page too :smiley:. Just starting out..
Here’s my thread: https://devtalk.freecad.org/t/implementing-a-materials-database/69911/1

Just alerted to your thread. I did read your GSoC proposal.

Right now it looks like materials capabilities will be greatly expanded. I’m prototyping some stuff now for discussion that should be online in my thread shortly.

In the meantime, I’d be happy to do a zoom session so we can spit ball some ideas.