Joined: Sep 26, 2018
Post Count: 4
Status:
Offline
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:
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]
France
Joined: Nov 7, 2005
Post Count: 9425
Status:
Offline
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 creator
Joined: Sep 26, 2018
Post Count: 4
Status:
Offline
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!
Joined: May 12, 2013
Post Count: 1545
Status:
Offline
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