Export project that was started while not being logged in (online)

This topic has been viewed 2016 times and has 4 replies
Thread status: Active
How can I do this? [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
nvc60166
Posts: 2
Joined: Wed Dec 06, 2023 2:35 pm

Export project that was started while not being logged in (online)

Post by nvc60166 »

Hi, so I discovered this nice software the other day and thinking I'd just do something very basic didn't bother signing up at first. But now I've done quite a bit of work in that browser window and would like to save it. But as I was not logged in, there is no option to save anything. Or is there a hidden export button???

I'm quite proficient with programming and JavaScript, so if anyone has an idea how I could pull the information from the code that would also work. I already poked around a bit and found that `this.application` seems to contain the entire state, but sadly it's not as simple as `JSON.stringify`ing it in the working browser window and `JSON.parse`ing it in the fresh one where I'm logged in now...

If anyone could help me that'd be amazing! <3
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Export project that was started while not being logged in (online)

Post by Puybaret »

I never thought about this but there must be a trick for sure. Let me think about it…
Meanwhile, I would recommend to take some screenshots of your design to keep a trace of your ideas, just in case your browser decides to reload the page by itself.
Emmanuel Puybaret, Sweet Home 3D creator
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Export project that was started while not being logged in (online)

Post by Puybaret »

Open the JavaScript console of your browser and execute the following script:

Code: Select all

new HomeRecorder().writeHome(application.getHomes()[0], "", { 
  homeSaved: function(home, blob) { 
    var downloadLink = document.createElement('a');
    downloadLink.setAttribute("href", URL.createObjectURL(blob));
    downloadLink.setAttribute("download", "home.sh3x");
    document.body.appendChild(downloadLink);
    downloadLink.click();
  } 
});
This will save the edited home in the file home.sh3x found in your downloads folder.
Emmanuel Puybaret, Sweet Home 3D creator
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Export project that was started while not being logged in (online)

Post by Puybaret »

After doing some more tests, it looks like the previous script won’t work if you accessed the Online version from http: and not https:. If it’s the case, you’ll have to provide also an implementation of window.crypto.subltle.digest method.
Emmanuel Puybaret, Sweet Home 3D creator
nvc60166
Posts: 2
Joined: Wed Dec 06, 2023 2:35 pm

Re: Export project that was started while not being logged in (online)

Post by nvc60166 »

Wow, excellent solution! I pasted the snippet into the console and it worked beautifully. I 'downloaded' the file and was able to import it into my account, where it looks exactly as before. This was less hacky than I expected :D Thanks a lot Emmanuel for realising my feature request, especially so quickly! Great support! :)
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests