[solved] "All"-File management / database with text files in the directory tree for linux

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
thomas-neemann
Veteran
Posts: 11915
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

[solved] "All"-File management / database with text files in the directory tree for linux

Post by thomas-neemann »

i am trying to create a database for freecad files. an editor with roughly this template

1.png
1.png (23.23 KiB) Viewed 2495 times


should appear when saving

a text file will automatically be created with the same name as the freecad file. For example: 20210001a.fcstd and 20210001a.txt

there will be a search command, e.g. with this entry Staus: E Name: thne show all files with paths in which all conditions are met.

If you have any further ideas or suggestions, please post here

Greetings Thomas
Last edited by thomas-neemann on Wed Nov 17, 2021 7:43 am, edited 2 times in total.
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
User avatar
thomas-neemann
Veteran
Posts: 11915
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: File management / database with text files in the directory tree for linux

Post by thomas-neemann »

there is a nice search program: recoll.

ubuntu-installation: sudo apt-get install recoll python xsltproc unzip

this allows you to enter several search terms and filter them very well. here's an example.

t1.png
t1.png (5.79 KiB) Viewed 2418 times
t2.png
t2.png (6.05 KiB) Viewed 2418 times
recoll-ok.png
recoll-ok.png (73.25 KiB) Viewed 2418 times
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
User avatar
onekk
Veteran
Posts: 6205
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: File management / database with text files in the directory tree for linux

Post by onekk »

Ok for text files (I'm a UNIX user so "plain text files, human readable" are the best in my opinion).

But what you will intend to do?

A sort of indexing system for FreeCAD files, or something like a Macro that will scan some directories to find a "category of files" that "have same features"?

Maybe FreeCAD has some abilities to store Metadata on the file, had a discussion with Yorick about them some time ago, and there is a place on which you could put some metedata.

Obviously scanning for text file maybe with a pattern or a precise extension like (.FCmd) (FreeCAD meta data) will be something that Python could do even using the FileOpen windows of Qt in case of a rudimental GUI.

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.

Blog: https://okkmkblog.wordpress.com/
User avatar
thomas-neemann
Veteran
Posts: 11915
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: File management / database with text files in the directory tree for linux

Post by thomas-neemann »

onekk wrote: Tue Nov 16, 2021 9:46 am
in my opinion it is easier because recoll already has this function
3.png
3.png (57.49 KiB) Viewed 2393 times


edit

5.png
5.png (14.52 KiB) Viewed 2351 times

quelle:

https://www.heise.de/ct/artikel/Toolbox ... 15658.html
Last edited by thomas-neemann on Tue Nov 16, 2021 10:13 am, edited 1 time in total.
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
User avatar
onekk
Veteran
Posts: 6205
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: File management / database with text files in the directory tree for linux

Post by onekk »

Ok but what is the "scope" of this thing, make a sort of "project management"?

Let me explain better, if you intend to model a complex thing, you have to do many drawings so maybe you wnato to have a mean to "keep trace" of "drawing version", "creation date", "author" and so on?

Only to "focus" on the matter.

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.

Blog: https://okkmkblog.wordpress.com/
User avatar
thomas-neemann
Veteran
Posts: 11915
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: File management / database with text files in the directory tree for linux

Post by thomas-neemann »

onekk wrote: Tue Nov 16, 2021 10:02 am
yes, that's exactly what the macro is supposed to do. combined searches for creator, status, version etc. just like a professional cad database
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
User avatar
onekk
Veteran
Posts: 6205
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: File management / database with text files in the directory tree for linux

Post by onekk »

It wil be a good addition.

but for a sort of this thing, I could suggest to use maybe a different approach.

As sqlite3 is a "on board" facility of Python, maybe using a squlite3 database to hold all the information if the project is big, it could be a more quick and "professional way".

sqlite3 database files are " a single file" that could be opened and processed, as it sqlite format could contain also binary blobs, images and other things could be added, like manuals, drawings, and so on.

It could be lead to some security problems, (as I was told when I have tried to suggest this format for some part of FreeCAD) but it wil be a thing that could be very handy.

Searches are simply text string containing "SQL Queries" and making complex things like:

I wanto to have all the document created by "person A" with the scope of "drawings" from date 01/01/1970 to date 01/01/1980 is simple as to write:

"SELECT drawing_file, author, drawing_number FROM FcData WHERE author = 'person A' AND date(creation_date)
BETWEEN date('1970-01-01') AND date('1980-01-01') AND scope="drawings" ;"

all without having to rely on "external libraries" as they are part of Standard Python see: https://docs.python.org/3/library/sqlite3.html

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.

Blog: https://okkmkblog.wordpress.com/
User avatar
thomas-neemann
Veteran
Posts: 11915
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: File management / database with text files in the directory tree for linux

Post by thomas-neemann »

onekk wrote: Tue Nov 16, 2021 10:29 am
yes i have seen that often. The problem is, however, that when major software changes are made, the databases no longer work and all effort and time are lost.

therefore my suggestion is to work with text files that are named like the feecad files. i will make a video to explain it.
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
User avatar
thomas-neemann
Veteran
Posts: 11915
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: File management / database with text files in the directory tree for linux

Post by thomas-neemann »

onekk wrote: Tue Nov 16, 2021 10:29 am
here is a video simulation of what the workflow could look like


https://www.youtube.com/watch?v=8uBSU_ncp5w


phpBB [video]




edit

additions: variant management, open with data sheet.


edit 2

file locking


edit 3

Can be expanded as required: revision management, proof of use, etc.
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
user1234
Veteran
Posts: 3502
Joined: Mon Jul 11, 2016 5:08 pm

Re: File management / database with text files in the directory tree for linux

Post by user1234 »

As onekk wrote, a sql database is the way to go. But i would use postgresql, because sqlite is only a single file and will be to big in notime.

Also with a sql database you can solve the issue with locking a part. With sql someone can check out a part and give only the person the writing permission. Other people also can load the part (for example for assemblies), modify it, but have no writing permission.

Greetings
user1234
Post Reply