Improvements to material editor and card handling

A forum to discuss the implementation of a good Materials system in FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
grandcross
Posts: 358
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Improvements to material editor and card handling

Post by grandcross »

I've seen a lot of discussion but not much action on improving the material handling system. From a selfish point of view, the Rocket Workbench needs this to be improved so in the spirit of Open Source I'm attempting to fill the void. I know this has been identified as a Google Summer of Code project and I'm definitely willing to work with whoever takes that on.

Step one is moving the preferences from the FEM workbench to its own preferences page. I've just submitted a pull request that does just that: https://github.com/FreeCAD/FreeCAD/pull/9210

This is intended to be a first step, so I've included no other changes with that PR. Before I make further changes I'd like to discuss with the broader community.

In terms of improving what's there now, I have some suggestions for usability enhancements.

1. It is currently possible to edit a material card without the edits being saved. Selecting OK on the dialog exits, but the user would expect that to save the values. Save however is defined as a separate operation with a separate button. There are two ways that this could be improved. If the user is editing an existing card, this could overwrite with confirmation. If it's a new operation, perform a "Save as..." operation. If this is deemed undesireable, it should at least warn the user that they're exiting with unsaved changes and giving them the option of canceling and saving.

2. Saving defaults to the system materials folder. This is bad for many reasons, including that the materials would become unavailable when upgrading. The defaults should be the user folder when specified, followed by the FreeCAD.getResourceDir() + "Mod/Material" folder.
Last edited by grandcross on Wed Apr 12, 2023 1:08 am, edited 1 time in total.
User avatar
grandcross
Posts: 358
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: Improvements to material handling

Post by grandcross »

In my case, for the Rocket Workbench, what I need is the ability to dynamically add another folder to the materials search path. The workbench creates material cards based on the manufacturer data in its parts database (as obtained from the OpenRocket project) These are currently populated only with density properties except where manually updated.

It doesn't make sense for these to be added to the FreeCAD system materials for several reasons. For example, Balsa as a material would have several variants based on density. Also the parts database is updated more frequently than the FreeCAD core product.

Using the user specified directory is one option, but the user may already have that specified elsewhere for their own reasons.

Hence, there needs to be a mechanism to add one or more directories to the material search path in addition to the ones currently used.
marcin86
Posts: 94
Joined: Fri Dec 20, 2019 1:20 pm
Location: Poznan/Poland

Re: Improvements to material handling

Post by marcin86 »

Hello grandcross,

I'm from 3 years watching development of Freecad and support in translation PL.
I know that TPM probably will be solved but it this 3 years I just was wonder about few things - one is: how to change material in left main tree.
I know that there is Material in FEM and Material in BIM module - I understand now after modification we will be able to change material in main workbench?

There is https://wiki.freecad.org/Macro_CenterOfMass
Maybe it should be merged to main branch?

1) In inventor when you work on assembly and part - you just click on part and you have properties with mass etc.
2) In Inventor also there is on top ball symbol to change material.

I'm just interested how to change material - I never saw Youtube tuorial how to do it.

Best regards
Marcin
User avatar
grandcross
Posts: 358
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: Improvements to material handling

Post by grandcross »

marcin86 wrote: Fri Apr 07, 2023 9:29 am Hello grandcross,

I'm from 3 years watching development of Freecad and support in translation PL.
I know that TPM probably will be solved but it this 3 years I just was wonder about few things - one is: how to change material in left main tree.
I know that there is Material in FEM and Material in BIM module - I understand now after modification we will be able to change material in main workbench?

There is https://wiki.freecad.org/Macro_CenterOfMass
Maybe it should be merged to main branch?

1) In inventor when you work on assembly and part - you just click on part and you have properties with mass etc.
2) In Inventor also there is on top ball symbol to change material.

I'm just interested how to change material - I never saw Youtube tuorial how to do it.

Best regards
Marcin
Excellent questions but I can provide only partial answers. It's certainly not handled consistently.

General handling in the tree is not something that can be done currently and would require pretty substantive changes. It is up to the workbench authors to create and expose those properties, and most just don't. Those that do are inconsistent. Even within the product, "material" refers to the appearance in some contexts, and the physical properties such as density, shear modulus, etc. in others. The material cards can, but are not required to, support both, but it's still up to the workbench to alter the appearance and/or physical properties of an object.

I'm in the process of doing this for the rocket workbench, but that capability isn't in a released version. There will be a property associated with the rocket components that you could change in the properties tab, or in a tab that will be part of the components editor. I hadn't considered putting this in the tree as a right click operation, but perhaps I should.

Doing this in a more generic sense that would be useful for all workbenches is not something I'll be taking on at this time, but is certainly worth considering for the summer of code project. I don't believe it would be a small effort.
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: Improvements to material handling

Post by chrisb »

Material information is also important for Path workbench related things, especially for feed and speed. @dubstar-04, @sliptonic, care to weigh in?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
grandcross
Posts: 358
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: Improvements to material handling

Post by grandcross »

chrisb wrote: Fri Apr 07, 2023 10:54 am Material information is also important for Path workbench related things, especially for feed and speed. @dubstar-04, @sliptonic, care to weigh in?
I'd certainly like to see what they have to say but with one very important caveat: I am not looking to fix all material problems. I'm looking to address a small targeted subset of problems that can be fixed easily, and only as they apply to the use of material cards. I don't believe the Path workbench uses them currently, but if they do the changes I'm proposing shouldn't affect it in any way.
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: Improvements to material handling

Post by chrisb »

grandcross wrote: Fri Apr 07, 2023 11:08 am I'm looking to address a small targeted subset of problems that can be fixed easily, and only as they apply to the use of material cards. I don't believe the Path workbench uses them currently, but if they do the changes I'm proposing shouldn't affect it in any way.
I see, and I think that's a sensible approach. Nevertheless it is often helpful to have a look at the whole picture, even when working on some details.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
grandcross
Posts: 358
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: Improvements to material handling

Post by grandcross »

chrisb wrote: Fri Apr 07, 2023 12:27 pm I see, and I think that's a sensible approach. Nevertheless it is often helpful to have a look at the whole picture, even when working on some details.
Agreed. And if there's something I can do that will help them I will certainly consider doing so. I just don't want perfection to get in the way of progress.

I think the entire system could use some rethinking and work in the core. But that's a very big project, and I already have a very big project. And a day job.
user1234
Veteran
Posts: 3511
Joined: Mon Jul 11, 2016 5:08 pm

Re: Improvements to material handling

Post by user1234 »

When it is still working with FEM, then it is an improvement, can not speak for Arch, never used it (not needed for my usecases). Will test it later.


Greetings
user1234
user1234
Veteran
Posts: 3511
Joined: Mon Jul 11, 2016 5:08 pm

Re: Improvements to material handling

Post by user1234 »

grandcross wrote: Fri Apr 07, 2023 4:22 am Step one is moving the preferences from the FEM workbench to its own preferences page. I've just submitted a pull request that does just that: https://github.com/FreeCAD/FreeCAD/pull/9210
Works fine.

Code: Select all

OS: Debian GNU/Linux 11 (bullseye) (X-Cinnamon/lightdm-xsession)
Word size of FreeCAD: 64-bit
Version: 0.21.0.32775 (Git)
Build type: Release
Branch: Material
Hash: ed6a6b989957e936c43cd30aaffaa971fe48b20d
Python 3.9.2, Qt 5.15.2, Coin 4.0.0, Vtk 9.0.1, OCC 7.7.1
Locale: English/United States (en_US)
Installed mods: 
  * QuickMeasure 2022.10.28


Greetings
user1234
Post Reply