Folder Structure for Macros?

Need help, or want to share a macro? Post here!
User avatar
onekk
Veteran
Posts: 2150
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Folder Structure for Macros?

Post by onekk »

probably it will suffice that macro folder could be made viewed as a "tree", i.e I will specify a macro folder and then if there are subdfolders in this folder macro are searched also in subfolders.

In Linux and other OS subfolders could be "symlinks" so the real locations could be across an entire disk or even on a network (if the OS could link net mounted dir and make them appear as sub folders).

For WB it isi working, as on Linux I have a multiple places and some symlinks in "/Mod/" and they are working across different FC versions at least 0.19.3 and 0.20 dev (miniconda install).


Regards

Carlo D.
My English and Italian Scripting Guide https://github.com/onekk/freecad-doc.
My Blog: https://onekk-maker.blogspot.com/

To help development see on GitHub Page

For enquiry on consultancy on FC Scripting or Personal Teaching PM me.
chrisb
Veteran
Posts: 42490
Joined: Tue Mar 17, 2015 9:14 am

Re: Folder Structure for Macros?

Post by chrisb »

chennes wrote: Thu May 12, 2022 3:06 pm I want to be able to find macros in each installed mod's directory, rather than having to copy them all to a central directory.
if i understand it correctly then I don't like it very much, because it would mean that the macros vanish as soon as I replace my current version or a new version added in parallel would not have the macros.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
edwilliams16
Veteran
Posts: 1006
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Folder Structure for Macros?

Post by edwilliams16 »

I'd just like to be able to drill down into subdirectories in the current Macro directories.
User avatar
johnwang
Veteran
Posts: 1028
Joined: Sun Jan 27, 2019 12:41 am

Re: Folder Structure for Macros?

Post by johnwang »

chennes wrote: Fri May 13, 2022 1:17 pm finding macros in multiple locations.
I just use Gui::FileDialog::getOpenFileName to find a py file and run it. Throw out Macro.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
chennes
Veteran
Posts: 2065
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Folder Structure for Macros?

Post by chennes »

chrisb wrote: Fri May 13, 2022 10:58 pm if i understand it correctly then I don't like it very much, because it would mean that the macros vanish as soon as I replace my current version or a new version added in parallel would not have the macros.
I don’t follow — why would a macro vanish? What I am describing isn’t all that different a storage strategy from what we currently have, except macros don’t have to be copied out of their mod directory to be run, and we don’t run the risk of name collisions during that copy. You will still have your normal user macro directory, plus possibly any number of other directories you want to have.
Chris Hennes
Pioneer Library System
User avatar
chennes
Veteran
Posts: 2065
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Folder Structure for Macros?

Post by chennes »

edwilliams16 wrote: Sat May 14, 2022 12:42 am I'd just like to be able to drill down into subdirectories in the current Macro directories.
You will be able to: the key change I am proposing is to stop hardcoding a single location for macros, and instead allow any arbitrary directories to be visible in the macro manager.
Chris Hennes
Pioneer Library System
User avatar
onekk
Veteran
Posts: 2150
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Folder Structure for Macros?

Post by onekk »

Good also if when I specify a directory in the list even his subdir where searched for Macro.

To avoid possible conflicts a full path name could be used, or the name and a tooltip showing "full path".

It won't be difficult to implement as from what I remember about QListWidget it is possible to set some properties for items.

Regards

Carlo D.
My English and Italian Scripting Guide https://github.com/onekk/freecad-doc.
My Blog: https://onekk-maker.blogspot.com/

To help development see on GitHub Page

For enquiry on consultancy on FC Scripting or Personal Teaching PM me.
chrisb
Veteran
Posts: 42490
Joined: Tue Mar 17, 2015 9:14 am

Re: Folder Structure for Macros?

Post by chrisb »

chennes wrote: Sat May 14, 2022 3:05 pm I don’t follow — why would a macro vanish?
I'm afraid I misunderstand something:
In the installation package there is among others the Mod directory. If macros are stored below that directory they will be lost if I change the installation and remove the old one.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
chennes
Veteran
Posts: 2065
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Folder Structure for Macros?

Post by chennes »

Oh, I see, sorry to not be clear: I mean the directory where the add on manager installs user mods. Really, I mean the individual subdirectories where those Addons are installed. Not in the Mod directory that is part of the core installation.
Chris Hennes
Pioneer Library System
chrisb
Veteran
Posts: 42490
Joined: Tue Mar 17, 2015 9:14 am

Re: Folder Structure for Macros?

Post by chrisb »

chennes wrote: Sat May 14, 2022 11:20 pm I mean the directory where the add on manager installs user mods.
Aah; sorry for not having seen this. That's something different.

Thinking about my projects I had several times certain macros for that very project. During the development it would be nice if I could just add the path to the project directory, which is usually outside the Mod directory.
If there would be a parameter controlling in/exclusion of subdirectories would be of further help.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply