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!
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: About PDM for FreeCAD

Post by dan-miel »

@grd
I’m going to give up on this project because I don’t know much about setting up data bases, but I have some other comments.
1. FreePDM: If this is the SolidWorks PDM it depends on the file extensions as discussed before. It is not a data base instead it searches through text files. A company that I worked at used it and we found that all the files get dumped into one folder. The searches and file retrieval became slower as the folder became larger. We eventually moved to SW Professional PDM.

2. File properties: I think something like the program I made above would work to store need properties in the file, but I think it would be beneficial to have the properties object in a new file or be able to select which property object is added to the file, depending on whether it is a drawing, part etc. or by project. These properties would be needed for a database PDM.

3. Databases getting too large when saving files: I would guess that this is because the entire assembly is being saved to the database. Only text should be going in the database, the file should be saved elsewhere and only the location/path of the file in the database. See the picture below.

4. Files saved by version: By going through an A2+ file and looking for a sourcefile property, I was able to determine which files were subparts. Instead of saving an entire assembly file and its subparts each time a subpart is modified some companies, if form, fit and function stay the same, will give the sub-part a new version, rebuild the assembly and save that at the same revision.

5. I think Toponaming is going to be a big problem with a database PDM. Depending on the company, where and how often a subpart is used, broken constraints could cause headaches. At least this is true in A2+. In this post https://forum.freecadweb.org/viewtopic.php?f=20&t=73395 updating a part caused 4 broken constraints and 49 errors.
Attachments
databaseInfo.JPG
databaseInfo.JPG (28.32 KiB) Viewed 1500 times
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: About PDM for FreeCAD

Post by grd »

dan-miel wrote: Thu Nov 24, 2022 6:59 pm @grd
I’m going to give up on this project because I don’t know much about setting up data bases, but I have some other comments.
1. FreePDM: If this is the SolidWorks PDM it depends on the file extensions as discussed before. It is not a data base instead it searches through text files. A company that I worked at used it and we found that all the files get dumped into one folder. The searches and file retrieval became slower as the folder became larger. We eventually moved to SW Professional PDM.
The argument that I highlighted is what I said before and in the end everyone needs to realize that. Optionally of course! But I think that it is necessary when you work with a PDM. An XML file is not a PDF and that is it! A drawing is not an assy! Embedding everything into one massive file is not clever design. Yes, it works but it is not clever! Just look at the code inside a Document.xml

I am sorry that you gave up but I understand because databases are not my thing too and databases are necessary.
2. File properties: I think something like the program I made above would work to store need properties in the file, but I think it would be beneficial to have the properties object in a new file or be able to select which property object is added to the file, depending on whether it is a drawing, part etc. or by project. These properties would be needed for a database PDM.
I thought about that too and I made it work (-able) for your code. But, and here comes the but... I think that these attributes belong inside each FC file, because you can use the button and then it works, but what fields are being used in other parts of FC? Drawings for instance needs specific attributes. But I like the part that you can also add other attributes ;-)

In this document there is a list of attributes that we would like inside a FC file https://github.com/grd/FreePDM/blob/mai ... ributes.md

This document also stores info about surface finishing for instance and which file needs what attribute, because a drawing needs other attributes than a part.
3. Databases getting too large when saving files: I would guess that this is because the entire assembly is being saved to the database. Only text should be going in the database, the file should be saved elsewhere and only the location/path of the file in the database. See the picture below.
No, this is wrong. In the database there should only be saved a couple of attributes that are being exported by https://github.com/grd/FreePDM/blob/mai ... tamodel.py

But I also like the idea from Yorik about saving attributes and file info into for instance a CSV file or files inside the .cache directory or somewhere.
4. Files saved by version: By going through an A2+ file and looking for a sourcefile property, I was able to determine which files were subparts. Instead of saving an entire assembly file and its subparts each time a subpart is modified some companies, if form, fit and function stay the same, will give the sub-part a new version, rebuild the assembly and save that at the same revision.
Yes I agree and I am familiar with FFF.
5. I think Toponaming is going to be a big problem with a database PDM. Depending on the company, where and how often a subpart is used, broken constraints could cause headaches. At least this is true in A2+. In this post https://forum.freecadweb.org/viewtopic.php?f=20&t=73395 updating a part caused 4 broken constraints and 49 errors.
To be completely honest I think that A2+ needs to update their assembly to A3 because that looks better in my eyes. I like their ideas but ... ;-)
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: About PDM for FreeCAD

Post by dan-miel »

grd wrote: Thu Nov 24, 2022 7:54 pm I thought about that too and I made it work (-able) for your code. But, and here comes the but... I think that these attributes belong inside each FC file, because you can use the button and then it works, but what fields are being used in other parts of FC? Drawings for instance needs specific attributes. But I like the part that you can also add other attributes
To clarify: I think I meant templates. At present FreeCAD has one template for new parts. If a user could set up a part, assembly, purchased part template with the correct property object they could then open the template with the correct properties or a couple buttons on my tool would allow a user to add the proper attributes.
I was the CAD Admin for the last place I worked. I could add any attributes to PDM I wanted. PDM only pulled the attributes from the files that matched the PDM attributes. Using their workflow I was able to create a separate section that kept track of approved purchased parts, their RoHS and other files.
Dan
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: About PDM for FreeCAD

Post by grd »

... and add them to any part, any body and any assembly, any etc... I like that, but how can you make sure that the file attributes only stick to one body, one part, one whatever?
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: About PDM for FreeCAD

Post by dan-miel »

grd wrote: Thu Nov 24, 2022 9:47 pm ... and add them to any part, any body and any assembly, any etc... I like that, but how can you make sure that the file attributes only stick to one body, one part, one whatever?
The file properties program creates an object in the file. The body is also an object. In the attached picture you can see the properties object highlighted. In the data view below it you can see the properties. If you highlight the file name you can see built in properties but I’m not sure how to get them or if they can be added to. This properties object stays with the file. The object is actually gray, not blue. You can copy paste it to another file if you wish and that file would have all of the same properties. I don’t think the name will update with you version of the program but the latest version I have attached will update the file name.
When an A2+ assembly file is entered into the database program I check all the objects in the file and open them in the background to get the object and read the properties to add them to the database so the transfer of properties to database is automatic.
Dan
Attachments
FileProperties Ver2.zip
(94.91 KiB) Downloaded 26 times
properties object.JPG
properties object.JPG (31.9 KiB) Viewed 1376 times
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: About PDM for FreeCAD

Post by grd »

Dan, is it okay if I contact you privately? Because I think we have enough to talk and think about.

Gerard
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: About PDM for FreeCAD

Post by dan-miel »

grd wrote: Fri Nov 25, 2022 8:08 am Dan, is it okay if I contact you privately? Because I think we have enough to talk and think about.
Feel free to pm.
Dan
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: About PDM for FreeCAD

Post by dan-miel »

I recently worked at a PDM for FreeCAD project, here are some of my thoughts.

One of the nice things of PDM is that when a file is saved, only the file needs to be saved to a disk. All of information for the file, such as Version, version date, designed by, project, where the file is saved, etc. is saved to a database and is searchable in the database.
Assembly3 and Assembly4 files would take up more space on a disk because one file holds most or all of the information but I can see why people use them.

A2plus files would save more disk space because when a change in a small part is made, only the part file needs to be saved at the new version and perhaps some assembly files rebuilt.

In my mind, the toponaming would be a serious hindrance because after a few version changes the broken constraints would need fixing and in a big assembly, built by someone else, it could take a while.

The other thing with A2plus is that you cannot rename files in the assembly. A database, like a folder should have one file name in it. Imagine five engineers designing cabinets with electrical components inside They all have redundant names, a top, side left, side right, door, etc. After the designs are approved, they pull out a bunch of part numbers and now they need to rename all their parts and rebuild all assembly files.

Lastly, Properties: FreeCAD files have properties and a user can change the value by highlighting them and using the Data Tab but I haven’t seen any way to add new properties or change the name except through programing. I’m not sure how many Companies use the Comment or the Company field. There should be an easy way to add Description or Drafter fields. The drawing templates have Editable text controlled by xml files and python dictionaries but they don’t seem to be connected to the file properties, such as changing the Comment property in the files properties doesn’t make any updates in the drawing. What I mean to say is all of these need to talk together and with other databases using changeable names and minimal programing.
I think some cleanup will be necessary before FreeCAD is PDM ready.
Just my thoughts.
Dan
User avatar
flachyjoe
Veteran
Posts: 1869
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: About PDM for FreeCAD

Post by flachyjoe »

Hi,
dan-miel wrote: Mon Nov 28, 2022 10:07 pm I haven’t seen any way to add new properties
In the properties widget :
RMB, Show all
Then RMB, Add property
Capture d’écran_2022-11-30_22-42-08.png
Capture d’écran_2022-11-30_22-42-08.png (31.95 KiB) Viewed 1124 times
- 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 »

A small update about the progress of https://github.com/grd/FreePDM

A long time I have thought about what Dan said that a PDM is only a storage of files. He is right. But you still need to access those files. So how can you access those files in a multi-user / multi-platform and centralized environment? That problem was something that I struggled with for a long time, because also you want to have a secure session and also not limited to a LAN.

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 ;)

So I went on with SFTP. I used my "old" Rpi4 and start to configure it with Ubuntu Server. It is ridiculously slow so I am gonna to use a SSD (and probably also boot with that). Then I created two users, user1 with password passwd1 and user2 with passwd2, and I also created a "vault" group in which both users belong to and also a directory "/vault" for the storage of the files.

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!

What is my ToDo list?

* The Filesystem: https://github.com/grd/FreePDM/tree/main/src/filesystem
* Dealing with the assembly structure
* Implement Dan's ideas about file properties.
* Make a WB
* PySide6
* Rewrite it in Nim (Name it NextPDM)

I want to thank everybody who helped me.
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