About PDM for FreeCAD

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Lonfor
Posts: 133
Joined: Wed Mar 23, 2022 2:32 am

Re: About PDM for FreeCAD

Post by Lonfor »

grd wrote: Thu Mar 16, 2023 9:09 am ...
A quick question related to PDM. Does FreeCAD's file format have an UID (unique identifier) to differentiate files with the same name?
User avatar
flachyjoe
Veteran
Posts: 1891
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: About PDM for FreeCAD

Post by flachyjoe »

Lonfor wrote: Fri Mar 17, 2023 3:21 am Does FreeCAD's file format have an UID (unique identifier) to differentiate files with the same name?

Code: Select all

>>> App.ActiveDocument.Uid
'568b453a-9be1-46c9-acb8-405a95dbf39c'
>>> 
- Flachy Joe -
Image
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: About PDM for FreeCAD

Post by grd »

Lonfor wrote: Fri Mar 17, 2023 3:21 am A quick question related to PDM. Does FreeCAD's file format have an UID (unique identifier) to differentiate files with the same name?
Why do you want to know?
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
Lonfor
Posts: 133
Joined: Wed Mar 23, 2022 2:32 am

Re: About PDM for FreeCAD

Post by Lonfor »

flachyjoe wrote: Fri Mar 17, 2023 7:16 am

Code: Select all

>>> App.ActiveDocument.Uid 
Noted. Thank you.
grd wrote: Fri Mar 17, 2023 7:24 am Why do you want to know?
I was browsing some snippets of C++ code for reading and writing files and UIDs came up. Anyway, I'm a slow learner and I'm at least a full year away from even be useful in some minimal way.
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: About PDM for FreeCAD

Post by grd »

Lonfor wrote: Fri Mar 17, 2023 7:55 am I was browsing some snippets of C++ code for reading and writing files and UIDs came up. Anyway, I'm a slow learner and I'm at least a full year away from even be useful in some minimal way.
Please stay on topic.

About this problem:
It is working! I can upload and download files from the PDM. And also deleting files from the other user. I am having a bit of struggle with when I upload a directory from user1 and try to delete it with user2. So I need to chown (to 'vault') a directory, I think. I haven't worked that out yet. But so far it's a success!
I solved it. It was indeed a "chgrp vault directory" and "chrgp vault file" that I need to do after I place a new directory or file. So it works!

Edit: I still don't get an answer to this question:
grd wrote: Fri Mar 17, 2023 9:03 am
And then it hit me. Normally when I want to access my server I do it with SSH. That server has also been secured with certbot. So how can I access those files? With SFTP! At first I thought about sshfs because then I don't need to rewrite a lot of my already written code, but sshfs has the problem that you first need to mount the filesystem. For me that is easy but I don't know how easy it is on other platforms (Windows) and also the connection is rather permanent. I still don't know really what is the best solution: SFTP or sshfs. If someone can give me a hint then I can maybe accept that ;)
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: About PDM for FreeCAD

Post by grd »

So no answer to that question... I choose SFTP and it works.

The storage of the files is simple. Each file that I import or copy gets a new file extension with a number behind the original file. So when I import file "blah.FCStd", the new file gets the name "blah.FCStd.000" and after I increase the file file number it gets the number "blah.FCStd.001". I think that ATM three digits is plenty and when the time comes to deal with "blah.FCStd.999" we only need to copy that file to a new file.

But having this new filesystem causes quite a few problems with the original program and that is why ATM it doesn't compile. The only thing to me that compiles is the filesystem on its own.

So... lots of work to do. ;)
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: About PDM for FreeCAD

Post by Zolko »

grd wrote: Tue Mar 21, 2023 10:24 am Each file that I import or copy gets a new file extension with a number behind the original file. So when I import file "blah.FCStd", the new file gets the name "blah.FCStd.000" and after I increase the file file number it gets the number "blah.FCStd.001"
Aren't you re-inventing the wheel ? This looks very much like any version control software. Why don't you choose an existing one and make a front-end for it ? I'd suggest SVN, it has Python bindings, and Python has Qt bindings. And it does everything that you seem to re-implement. Did you look at it ?
try the Assembly4 workbench for FreCAD — tutorials here and here
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: About PDM for FreeCAD

Post by grd »

Zolko wrote: Tue Mar 21, 2023 10:56 am Aren't you re-inventing the wheel ? This looks very much like any version control software. Why don't you choose an existing one and make a front-end for it ? I'd suggest SVN, it has Python bindings, and Python has Qt bindings. And it does everything that you seem to re-implement. Did you look at it ?
Of course I did. Maybe I can use SVN, but that is not the problem. ATM the main() program it doesn't compile, that is the problem. The back-end is only a tool. I don't care about SVN or git or whatever. But I like to store the files as a file storage and also I want to see the files and manipulate them whenever necessary. With SSH I can see the file storage and that is a big plus. Accessing the files with SFTP also works (take a look at the program filezilla for instance), and I need to code anyway, so I don't see many benefits for SVN.

I the future maybe I can use SVN.
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: About PDM for FreeCAD

Post by Zolko »

grd wrote: Tue Mar 21, 2023 12:04 pm ATM the main() program it doesn't compile, that is the problem
you're not doing this in Python ?
try the Assembly4 workbench for FreCAD — tutorials here and here
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: About PDM for FreeCAD

Post by grd »

Zolko wrote: Tue Mar 21, 2023 12:19 pm you're not doing this in Python ?
Yes, i am using Python. Have a look at https://github.com/grd/FreePDM

@Jee-Bee and I created this all with a little bit of help from others. If you are interested then maybe you can look at the FileSystem https://github.com/grd/FreePDM/tree/main/src/filesystem

There is no interaction with FreeCAD. But it is necessary to make it happen with a WB.
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
Post Reply