Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 5
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 2986 times and has 4 replies Next Thread
ilaria_123
Newbie




Joined: Sep 26, 2018
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Import room from .json

Hello,

I am new to the whole MVC paradigm and it's been a while since I've used Java. I am trying to write a plug-in where I can read a set of vertices from a .json file and draw a room with those vertices in SH3D (ideally I'd like to draw it in 2D and in 3D). It should be something extremely easy to do, so I've implemented the whole thing (I used the VolumePlugin example and I changed what happens in the execute() method) and it works up to the point where I try to actually add a wall (or a room) to the home. In fact, what happens is that the wall/room are simply not showed on the screen; the home stays empty. So I stripped the method out of everything else and simply added a couple of lines where I just add a wall to the home, and still I can't manage to see the new wall on the screen. This is the code I'm using:

Wall new_wall = new Wall(0.0, 0.0, 3.0, 0.0, 0.01, 2.5);
getHome().addWall(new_wall);


I read in the plug-in guide that because of the way the Plugin class has been implemented, all changes should be immediately reflected on the screen; however, now I'm thinking I'm missing something. Should I use HomeController or View or something else and refresh/redraw? I'm sorry if this is a dumb question but I spent the whole afternoon yesterday trying to figure it out and couldn't. Any help would be appreciated.

Thanks,
Ilaria
----------------------------------------
[Edit 1 times, last edit by Puybaret at Sep 26, 2018, 4:12:19 PM]
[Sep 26, 2018, 11:57:31 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9172
Status: Offline
Reply to this Post  Reply with Quote 
Re: Import room from .json

This should work but with the values you gave it will make a tiny wall, because the unit used in Sweet Home 3D is the centimeter.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Sep 26, 2018, 4:14:45 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
ilaria_123
Newbie




Joined: Sep 26, 2018
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Import room from .json

It does indeed! I figured it out right after posting the thread, but for some reasons I couldn't see what I posted and couldn't delete it. Thanks for your answer anyway!
[Sep 27, 2018, 4:16:22 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
okh
Advanced Member




Joined: May 12, 2013
Post Count: 1545
Status: Offline
Reply to this Post  Reply with Quote 
Re: Import room from .json

Intrigued. Is this a private plugin or something you plan on sharing? It sounds as if it is a plugin that would be interesting to know more about. Good luck. ok
[Sep 28, 2018, 9:08:30 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
ilaria_123
Newbie




Joined: Sep 26, 2018
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Import room from .json

I am developing it for myself, but if someone is interested I can certainly share it :)
[Sep 28, 2018, 3:36:39 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved