https://github.com/FreeCAD/FreeCAD/pull/10714
Read my first comment on github for more details.
Basically, we apply both filters sequentially: first the file name filter, and then the file content filter.
In the image I use a regular expression, but simple text is also fine.
Note: all searching/matching is done case-insensitive. Even with the regular expression that calls for only capital letters following an underscore, the lower case matches are found. This is by design (whether good or bad design is debatable). I considered adding a checkbox for case-sensitive searches, but I didn't want to clutter the dialog.
The text is interpreted as a regular expression, but if it is an invalid regular expression, then it gets used as a simple text search.
adding file filtering to macro execute dialog
-
- Veteran
- Posts: 4819
- Joined: Thu Apr 05, 2018 1:53 am
Re: adding file filtering to macro execute dialog
have not tried it, but looks quite useful, thanks.
i have 2 secret wishes, one for this dialogue, and one for macros in general (that i just hope magically will appear in fc at some point in time).
a) icons on the buttons in this dialogue (ought not to be over complicated if one uses system icons)
b) allow for organizing macros in a folder structure (no clue how complicated this would be, but it would be great not to be forced to have more or less all files in the same folder)
i have 2 secret wishes, one for this dialogue, and one for macros in general (that i just hope magically will appear in fc at some point in time).
a) icons on the buttons in this dialogue (ought not to be over complicated if one uses system icons)
b) allow for organizing macros in a folder structure (no clue how complicated this would be, but it would be great not to be forced to have more or less all files in the same folder)
-
- Veteran
- Posts: 4819
- Joined: Thu Apr 05, 2018 1:53 am
Re: adding file filtering to macro execute dialog
There is the system tab already as an option if you want to keep some macros there. Making use of that tab requires putting some macros into a new folder in the home path named Macro.
I recently added instructions to the wiki for doing this. https://wiki.freecad.org/Std_DlgMacroExecute
For me, it's not a good option because of where the folder is located. My installation method is to just extract the latest .zip file into a folder and delete the previous version. Then I make a task bar shortcut to the new bin/FreeCAD.exe file. The system macro folder must be a sibling folder to that bin folder, so it would get zapped every time I update to the next dev version.
I think the concept of system macros was something that never materialized. But the code is in place to make use of the tab in the dialog. Macros in there are nothing special AFAIK, just regular macros that behave like the others.
Edit: one difference that comes to mind is, unlike the users tab, macros in the system tab are only available to that specific FreeCAD installation. If you have multiple versions installed the other versions won't have access to the system macro. This could be a good thing or a bad thing, depending on what you want. I would only put copies of macros in that folder because they are subject to getting zapped when you uninstall and reinstall in another folder.
Re: adding file filtering to macro execute dialog
oke - good to know
the 2nd point was more like...
i.e. allow for organizing macros in sub-folders from whatever location one has as macro-dir.
the 2nd point was more like...
Code: Select all
./Macro
./Macro/how_it_is_now.FCMacro
./Macro/awesome/awesome.FCMacro
-/Macro/awesome/icons/awesomeicon.svg
./Macro/3dMacros/create_cube.FCMacro
./Macro/3dMacros/create_sphere.FCMacro
Re: adding file filtering to macro execute dialog
I have a setting that use different FreeCAD instances, on Linux.
Each one is started with a Script whatever is his mechanics, AppImage or distribution installed version.
I have a Macro directory in my hd and I modify the "user macro Location" to this directory, for every instance.
Probably the only mechanic that is missing is a way to manage subdirectories, but as the Macro dialog seems to be a combobox, it has to be seen if there is a way to:
- descent directory tree
- put in the combobox the proper name
- parse the returned item (probably a string) and retranslate "directory tree" a proper path.
Or probably change the widget to permit to hold a tree.
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.