Looks good to me!
Improvements to material editor and card handling
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- oliveroxtoby
- Posts: 812
- Joined: Fri Dec 23, 2016 9:43 am
- Location: South Africa
- grandcross
- Posts: 350
- Joined: Sun Oct 11, 2015 3:08 pm
- Contact:
Re: Improvements to material editor and card handling
Added support for modules specifying their own module folders. Here's what the preference file looks like:
Each workbench will add a new FCParamGroup under "User parameter:BaseApp/Preferences/Mod/Material/Resources/Modules". The name is the name of the workbench, in this case "Rocket". Each group would then have the directory where materials are stored, and an icon to associate with materials defined by the module. I'll add another post to show sample code later.
In the preferences, I've added an option to use or ignore the workbench defined material definitions.
Material cards will then show in the drop down with their preferred icon
No attempt is made to resolve name conflicts. Cards are loaded in sequence, starting from system cards, workbench cards in the order in which they're defined, card in the user's FreeCAD preference directory, followed by cards in any user defined custom directory. If cards have the same name, the one loaded last will be the one used. This allows user modified cards to supersede system cards.
Code: Select all
<FCParamGroup Name="Resources">
<FCBool Name="UseBuiltInMaterials" Value="1"/>
<FCBool Name="UseMaterialsFromConfigDir" Value="1"/>
<FCBool Name="UseMaterialsFromCustomDir" Value="1"/>
<FCText Name="CustomMaterialsDir"/>
<FCBool Name="UseMaterialsFromModules" Value="1"/>
<FCParamGroup Name="Modules">
<FCParamGroup Name="Rocket">
<FCText Name="ModuleIcon">C:/Users/dcarter/AppData/Roaming/FreeCAD/Mod/Rocket/Resources/icons/RocketWorkbench.svg</FCText>
<FCText Name="ModuleDir">C:\Users\dcarter\AppData\Roaming\FreeCAD\Mod\Rocket\Resources\Material</FCText>
</FCParamGroup>
</FCParamGroup>
</FCParamGroup>
In the preferences, I've added an option to use or ignore the workbench defined material definitions.
Material cards will then show in the drop down with their preferred icon
No attempt is made to resolve name conflicts. Cards are loaded in sequence, starting from system cards, workbench cards in the order in which they're defined, card in the user's FreeCAD preference directory, followed by cards in any user defined custom directory. If cards have the same name, the one loaded last will be the one used. This allows user modified cards to supersede system cards.
- grandcross
- Posts: 350
- Joined: Sun Oct 11, 2015 3:08 pm
- Contact:
Re: Improvements to material editor and card handling
Some code to set this from within your workbench:
Code: Select all
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Material/Resources/Modules/Rocket")
p.SetString("ModuleDir", FreeCAD.getUserAppDataDir() + "Mod/Rocket/Resources/Material")
p.SetString("ModuleIcon", FreeCAD.getUserAppDataDir() + "Mod/Rocket/Resources/icons/RocketWorkbench.svg")
Re: Improvements to material editor and card handling
This looks amazing!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
- grandcross
- Posts: 350
- Joined: Sun Oct 11, 2015 3:08 pm
- Contact:
Re: Improvements to material editor and card handling
Thanks!
Maybe post 0.21 I'll look at a more comprehensive material update. Maybe.
Maybe post 0.21 I'll look at a more comprehensive material update. Maybe.
Re: Improvements to material editor and card handling
Yes, please!grandcross wrote: ↑Mon May 08, 2023 11:32 pm Thanks!
Maybe post 0.21 I'll look at a more comprehensive material update. Maybe.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
- grandcross
- Posts: 350
- Joined: Sun Oct 11, 2015 3:08 pm
- Contact:
- grandcross
- Posts: 350
- Joined: Sun Oct 11, 2015 3:08 pm
- Contact:
Re: Improvements to material editor and card handling
It's looking more and more like this PR won't be part of 0.21 despite being ready for months. This is very disappointing. By the time this gets merged it will likely be obsolete, and likely at least another year before any useful changes are made.
To say I'm disappointed is an understatement. I don't like wasting my time.
To say I'm disappointed is an understatement. I don't like wasting my time.