I have already implemented this feature in my branch. I plan to merge this in near future. You can save the project into a directory without compression and fully text based suitable for version control. Not all of them are XML though, because FC uses a lot of external libraries, not all of them support XML output.foadsf wrote: ↑Sat Oct 12, 2019 10:20 am hmmm, both have their own benefits. The current version is fast to load, especially if your design is really big and complicated. But the XML version is small. I wouldn't consider it as a form of compression or a huge advantage though. The main advantage IMO is the fact that one can use conventional version control such a git, mercurial, subversion ... which seems to be a huge feature lacking in the FC ecosystem at the moment. besides if there is any possibility to import/include/nest XMLs recursively into one another and if there are any possibilities to define parameters across the scop of an XML file, then theoretically one should be able to achieve full programmatic CAD using just XMLs.
I would say there should be an option in the FreeCAD settings to save files as it is right now or pure XML format. Also, this should be added to the import-export instead of the peculiar Tools → Project utility.
[solved] Creating a new .FCStd from Document.xml
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: [solved] Creating a new .FCStd from Document.xml
Re: [solved] Creating a new .FCStd from Document.xml
so I came here from this post: https://forum.freecadweb.org/viewtopic. ... 49#p340949
according to what foadsf described, I should be able to recover a file just from Document.xml? I doubt that and the error message I get seems to be pretty clear:
What I did: Create some object (attached), unpack it, delete everything except Document.xml, try to use Project utility to create a document.
Does Project Utility does something different when extracting the document? It does not look like it.
Another question is, if the changes of realthunder are already in master (It looks like it) - I'm running:
according to what foadsf described, I should be able to recover a file just from Document.xml? I doubt that and the error message I get seems to be pretty clear:
Code: Select all
Traceback (most recent call last):
File "<string>", line 66, in <module>
File "<string>", line 51, in createDocument
File "/usr/lib/python3.7/zipfile.py", line 1713, in write
zinfo = ZipInfo.from_file(filename, arcname)
File "/usr/lib/python3.7/zipfile.py", line 506, in from_file
st = os.stat(filename)
<class 'FileNotFoundError'>: [Errno 2] No such file or directory: '/home/reox/CAD/tmp/PartShape.brp'
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: [Errno 2] No such file or directory: '/home/reox/CAD/tmp/PartShape.brp'
Does Project Utility does something different when extracting the document? It does not look like it.
Another question is, if the changes of realthunder are already in master (It looks like it) - I'm running:
Code: Select all
OS: Debian GNU/Linux bullseye/sid (i3/i3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18527 (Git)
Build type: Release
Branch: master
Hash: 1f5f00e655b573489c3e897efd5d87e93cf77f15
Python version: 3.7.5rc1
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: C/Default (C)
- Attachments
-
- foobar.FCStd
- (60.1 KiB) Downloaded 43 times
Re: [solved] Creating a new .FCStd from Document.xml
except for some small issues, it worked pretty well for me!
my environment is
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16131 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: 3129ae4296e40ed20e7b3d460b86e6969acbe1c3
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Last edited by foadsf on Tue Oct 15, 2019 10:01 am, edited 1 time in total.
Re: [solved] Creating a new .FCStd from Document.xml
Have you tested that with the file I attached?
Is the brep code inserted into the Document.xml or how does this work?
Is the brep code inserted into the Document.xml or how does this work?
Re: [solved] Creating a new .FCStd from Document.xml
Sorry, the embedded gif link was broken. I uploaded a new one. please see the steps as I did it. I unarchived your file, deleted everything except Document.XML and then the above steps.
Re: [solved] Creating a new .FCStd from Document.xml
Ah you get the same error - look in the status bar.
So, this error means success then
So, this error means success then
Re: [solved] Creating a new .FCStd from Document.xml
I tried this on my mac and I now notice the error message. It works after recomputing the subparts but not as smoothly as on Windows and stable version:
OS: macOS Mojave (10.14)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18403 (Git)
Build type: Release
Branch: master
Hash: 0717b4fc23ef1db70964c3977d25e2fe46a739d1
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
This actually could be a bug report.
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: [solved] Creating a new .FCStd from Document.xml
I don't think that counts as a bug. The Document.xml contains the essential recipe for building all the objects, but you are leaving out all the built result and visual setting. So when you reload it, you are expected to do a full recomputation. So while loading is faster, it is not really useful until you recompute everything, which will be much slower than a full loading. Moreover, depending on the original version the file is authored, and the version you loading this 'partial' project file, you may get recomputation error, because of different versions of libraries used to create all the intermediate results.
My patch (not in upstream yet) offers several saving options. One of them allows you to store everything (including the intermediate results) into two xml files, Document.xml and GuiDocument.xml. So no recomputation required when loading. But the size of the file will be big. The intention is for version control, not space saving.