Part module preference option not activated at startup ?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- vejmarie
- Posts: 713
- Joined: Mon Jan 04, 2016 4:52 pm
- Location: Somewhere between France, USA and Taiwan
- Contact:
Part module preference option not activated at startup ?
Hi,
As to enhance the STEP importer/exporter, I need to add a user variable parameter, and wanted to make it happen into the Part modules parameter, but I am currently unable to enable it at FreeCAD startup which is frustrating. Is there any specific reason for that ? I am lost into the way we activate/deactivate options into the preferences menu for file format importer/exporter. Looks like each module is deciding when to activate them when the end user is moving through them.
I tried to change the CMakeLists.txt to get the right ui into the Mod/Part/Gui directory during build but without any success. My idea was to activate the stuff using example from Yorik into draft
and doing a call like this FreeCADGui.addPreferencePage(":/ui/preferences-dxf.ui","Import-Export") just after Part initialization to force ui init but Part is definitly not designed that way.
I must admit I don't know anything about Python and CMake (boooo), and got the feeling I need to learn now which is fine, but I will appreciate some help on just trying to find a way to have preferences options activated at FreeCAD startup and perhaps not at module startup at least for the file format at Importer/Exporter level.
vejmarie
As to enhance the STEP importer/exporter, I need to add a user variable parameter, and wanted to make it happen into the Part modules parameter, but I am currently unable to enable it at FreeCAD startup which is frustrating. Is there any specific reason for that ? I am lost into the way we activate/deactivate options into the preferences menu for file format importer/exporter. Looks like each module is deciding when to activate them when the end user is moving through them.
I tried to change the CMakeLists.txt to get the right ui into the Mod/Part/Gui directory during build but without any success. My idea was to activate the stuff using example from Yorik into draft
and doing a call like this FreeCADGui.addPreferencePage(":/ui/preferences-dxf.ui","Import-Export") just after Part initialization to force ui init but Part is definitly not designed that way.
I must admit I don't know anything about Python and CMake (boooo), and got the feeling I need to learn now which is fine, but I will appreciate some help on just trying to find a way to have preferences options activated at FreeCAD startup and perhaps not at module startup at least for the file format at Importer/Exporter level.
vejmarie
Re: Part module preference option not activated at startup ?
Have you seen this thread? https://forum.freecadweb.org/viewtopic.php?f=8&t=14211
I think having all the import/export stuff available at start-up would be very convenient.
"fight the good fight"
Re: Part module preference option not activated at startup ?
Hi vejmarie.
As for the more general issue. Workbench name and icon is available when FreeCAD starts. No resource files are involved and nothing needs to be loaded. Therefore Preferences sidebar could be turned into a workbench switcher. That is all workbenches would be listed and when user clicks on an icon corresponding workbench gets loaded. Things like workbench specific preferences page therefore gets loaded. That would resolve the confusion for new users as now you have to first load the workbench to see the corresponding workbench icon/name in Preferences. I never tackled this as it would involve C++ and i somehow settled for Python for now.
As for your problem. I have a feeling it's a different one. Variable/parameter gets set in Preferences and after it is stored as parameter. You can therefore always check for the value set at FreeCAD start. Regardless of the fact if STEP importer/exporter preferences page was already loaded or not. Look under Tools -> Edit parameters ... All sorts of stored settings are located there. And the same can be done for your (user set) STEP importer/exporter related variable.
As for the more general issue. Workbench name and icon is available when FreeCAD starts. No resource files are involved and nothing needs to be loaded. Therefore Preferences sidebar could be turned into a workbench switcher. That is all workbenches would be listed and when user clicks on an icon corresponding workbench gets loaded. Things like workbench specific preferences page therefore gets loaded. That would resolve the confusion for new users as now you have to first load the workbench to see the corresponding workbench icon/name in Preferences. I never tackled this as it would involve C++ and i somehow settled for Python for now.
As for your problem. I have a feeling it's a different one. Variable/parameter gets set in Preferences and after it is stored as parameter. You can therefore always check for the value set at FreeCAD start. Regardless of the fact if STEP importer/exporter preferences page was already loaded or not. Look under Tools -> Edit parameters ... All sorts of stored settings are located there. And the same can be done for your (user set) STEP importer/exporter related variable.
- vejmarie
- Posts: 713
- Joined: Mon Jan 04, 2016 4:52 pm
- Location: Somewhere between France, USA and Taiwan
- Contact:
Re: Part module preference option not activated at startup ?
I was not aware of the thread, and it does correspond exactly to what I face as an issue. I really think we shall find a way to expose import/export stuff at startup as you mention, because it is quite disturbing to the end user to activate Part module which is a design module to import or use FreeCAD as a pure viewer. I will try to see if I can find a way to make it happens.sgrogan wrote: ↑Wed Jul 12, 2017 9:07 pmHave you seen this thread? https://forum.freecadweb.org/viewtopic.php?f=8&t=14211
I think having all the import/export stuff available at start-up would be very convenient.
Re: Part module preference option not activated at startup ?
Hi @triplus
is there a way to create a var that can be changed at running time i.e. for "UseVBO" and not that would need a FC restart as per "WriteSurfaceCurveMode"?
It is enough to expose the var to Gui?
reference discussion here
https://forum.freecadweb.org/viewtopic. ... 10#p142185
Thx
Maurice
- vejmarie
- Posts: 713
- Joined: Mon Jan 04, 2016 4:52 pm
- Location: Somewhere between France, USA and Taiwan
- Contact:
Re: Part module preference option not activated at startup ?
I am in a mix of all of that, as I need to keep the parameter between FreeCAD restart, but I also need to expose an easy way to the end user to change the valuetriplus wrote: ↑Wed Jul 12, 2017 9:44 pm Hi vejmarie.
As for the more general issue. Workbench name and icon is available when FreeCAD starts. No resource files are involved and nothing needs to be loaded. Therefore Preferences sidebar could be turned into a workbench switcher. That is all workbenches would be listed and when user clicks on an icon corresponding workbench gets loaded. Things like workbench specific preferences page therefore gets loaded. That would resolve the confusion for new users as now you have to first load the workbench to see the corresponding workbench icon/name in Preferences. I never tackled this as it would involve C++ and i somehow settled for Python for now.
As for your problem. I have a feeling it's a different one. Variable/parameter gets set in Preferences and after it is stored as parameter. You can therefore always check for the value set at FreeCAD start. Regardless of the fact if STEP importer/exporter preferences page was already loaded or not. Look under Tools -> Edit parameters ... All sorts of stored settings are located there. And the same can be done for your (user set) STEP importer/exporter related variable.
Re: Part module preference option not activated at startup ?
In FreeCAD terms that comes down to:
- User: Load Part workbench and by doing that STEP preferences will be made available in Preferences. A way to set a value is therefore added there.
- Developer: User made setting is stored as parameter. And therefore you check for that (on STEP import/export) and don't care about availability of Preferences at all.
https://www.freecadweb.org/tracker/view.php?id=2744
Yorik bypassed this and made some of the preferences always available. By adding them on FreeCAD start and not when Draft/Arch workbench gets loaded.
https://github.com/yorikvanhavre/FreeCA ... 810e546517
That is why they are there on FreeCAD start. Before you needed to load corresponding workbench to get them. Now i won't judge on what should or shouldn't be done. I only described the situation. Current guidelines suggests it is not OK to load workbench specific functionality on FreeCAD start by default. Import/Export related settings could likely be treated as corner case scenarios. As they are scattered among different workbenches and centralized in Preferences. Some available by default and others not.
Re: Part module preference option not activated at startup ?
The class ParameterGrp is derived from the class Base::Subject and thus it's possible to register observers to a group that get notified for each changed parameter inside the group.is there a way to create a var that can be changed at running time i.e. for "UseVBO" and not that would need a FC restart as per "WriteSurfaceCurveMode"?
It is enough to expose the var to Gui?
The observer class must derive from ParameterGrp::ObserverType and re-implement the method OnChange. As a reference have a look at the class AbstractSplitView
To listen to the changes of a group the method Attach of the group must be called.