Interfacing FreeCAD with Object Storage solutions

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!
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Interfacing FreeCAD with Object Storage solutions

Postby vejmarie » Sun Aug 04, 2019 5:45 pm

sgrogan wrote:
Tue Jul 30, 2019 8:23 pm
If you can post I link to your branch, I can try. The necessary stuff isn't in the Win Libpack now, but a quick DuckDuckGo suggests it should be possible, in release mode anyway.
Hi sgrogan, you could try from my github account https://github.com/vejmarie/FreeCAD.git -> the branch is named cloud, it does contain an initial writer implementation I liked to push upstream. Roughly libCURL is needed into Base for Writer.cpp where the connection happens now. I created a new Writer class as mentionned by wmayer.
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Interfacing FreeCAD with Object Storage solutions

Postby vejmarie » Sun Aug 04, 2019 6:24 pm

wmayer wrote:
Wed Jun 05, 2019 4:54 pm
If you want to have your custom writer class then simply inherit from Base::Writer or any of its subclasses and re-implement the method writeFiles(). It's up to you to define in the constructor to what kind of storage you want to save.

Then you need a new command class where you can invoke the writer class to save the document into.

Code: Select all

App::Dcoument* doc = ...
MyWriter writer(stream);
writer.putNextEntry("Document.xml");
doc->Save(writer);

// Special handling for Gui document.
doc->signalSaveDocument(writer);

writer.writeFiles();
FYI:
For FreeCAD's autosave/recovery function we use the class RecoveryWriter that doesn't write into a zip file but into a directory that creates an extra file for each touched property.
https://github.com/FreeCAD/FreeCAD/blob ... r.cpp#L161
I made it. Thanks a lot for the guidance ! Any hints for the reader side ? I wrote a writer which I published into the cloud branch of my freecad github account fork ( https://github.com/vejmarie/FreeCAD)
User avatar
DeepSOIC
Posts: 6965
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Interfacing FreeCAD with Object Storage solutions

Postby DeepSOIC » Mon Aug 05, 2019 11:26 pm

realthunder is attacking this territory as well!
https://forum.freecadweb.org/viewtopic.php?f=10&t=38353
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Interfacing FreeCAD with Object Storage solutions

Postby vejmarie » Tue Aug 06, 2019 7:51 am

DeepSOIC wrote:
Mon Aug 05, 2019 11:26 pm
realthunder is attacking this territory as well!
https://forum.freecadweb.org/viewtopic.php?f=10&t=38353
Thanks for the pointer !
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Interfacing FreeCAD with Object Storage solutions

Postby vejmarie » Mon Aug 19, 2019 5:50 pm

Ok, good news, I got a writer / reader which works. I didn't really followed realthunder proposale, but more wmayer's one. The issue is that changing the reader/writeer really needs to be inside the core currently. My only current showstopper to push changes as PoC (other than cleaning up the code), is to be sure we can compile on Windows. @sgrogan what is your opinion ?
User avatar
sgrogan
Posts: 5330
Joined: Wed Oct 22, 2014 5:02 pm

Re: Interfacing FreeCAD with Object Storage solutions

Postby sgrogan » Mon Aug 19, 2019 9:55 pm

vejmarie wrote:
Mon Aug 19, 2019 5:50 pm
@sgrogan what is your opinion ?
I haven't successfully built your branch. I tried quickly with some pre-compiled binaries on-line. I think I need to try to build libcurl with VS?
Time is tight, so progress is slow :oops:
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Interfacing FreeCAD with Object Storage solutions

Postby vejmarie » Tue Aug 20, 2019 7:30 am

Thanks for the update ! Time is tight also on my side. What was the error you met ? Was it with CMake libcurl detection or during build or link phase ? I am jsut curious to see if I could help. You need libCURL and libOpenSSL.
wmayer
Site Admin
Posts: 14782
Joined: Thu Feb 19, 2009 10:32 am

Re: Interfacing FreeCAD with Object Storage solutions

Postby wmayer » Tue Aug 20, 2019 2:20 pm

After having a quick look at your code I think it's better to move all the functionality to its own application module. Especially putting all the functions to the Document class directly makes little sense and only makes the class fatter.

Then the CMake configuration should add a parameter to make the support of saving to a cloud optional as recently a new libpack was built and people maybe don't want to change their setup again.
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Interfacing FreeCAD with Object Storage solutions

Postby vejmarie » Tue Aug 20, 2019 6:30 pm

No problem. I will try to do it. I have updated my branch with the Reader. It works with min.io servers.

I never wrote a FreeCAD workbench, time to learn something new. I still might have to change the Document class as I do not see how to implement some part of the code while being out of the class especially the GUI reader, but I will see.

At least it works currently as a very basic first implementation. The thing is that I have nothing to really display into such module, and believed that cloud storage might have been in some way some unique feature which could be extremely useful for end user data sharing and versioning management.

My worries are more related on the fact that we might be ending up having too much modules. If we manage versioning, cloud storage and additional storage stuff within modules, end user might have to install a lot of add-on to get these new features which are I/O related.

I also understand realthunder argument and the need to keep our dependancy as low as we can, but I am not fully convinced (yet) by the need to split all of these addon within workbenches instead of standard features.
wmayer
Site Admin
Posts: 14782
Joined: Thu Feb 19, 2009 10:32 am

Re: Interfacing FreeCAD with Object Storage solutions

Postby wmayer » Tue Aug 20, 2019 7:47 pm

I never wrote a FreeCAD workbench, time to learn something new.
We have a Python script fcbt.py that simplifies this task a lot. It basically copies the files from the _TEMPLATE_ directory with the specified name.
I still might have to change the Document class as I do not see how to implement some part of the code while being out of the class especially the GUI reader, but I will see.
Hmm, from the quick look I couldn't see where the Document really needs to be touched but maybe I overlooked something.
My worries are more related on the fact that we might be ending up having too much modules.
Actually I want to avoid to clutter up classes with functions that better should go into a separate class. The suggestion to move this to an external is because it's easier to make libcurl and openssl optional. Btw, I wonder if the boost library offers something in this regard.
I also understand realthunder argument and the need to keep our dependancy as low as we can
Avoiding too many dependencies e.g. makes life much easier of packaging for the various Linux distributions. When we just take Ubuntu then we permanently have to support three or four versions at the same time.
And there must be a good reason when adding the dependency to a further library.