|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: Import room from .json |
|
| Print at Dec 19, 2025, 6:59:01 AM | View all posts in this thread on one page |
| Posted by ilaria_123 at Sep 26, 2018, 11:57:31 AM |
|
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);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 |
| Posted by Puybaret at Sep 26, 2018, 4:14:45 PM |
|
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 |
| Posted by ilaria_123 at Sep 27, 2018, 4:16:22 PM |
|
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! |
| Posted by okh at Sep 28, 2018, 9:08:30 AM |
|
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 |
| Posted by ilaria_123 at Sep 28, 2018, 3:36:39 PM |
|
Re: Import room from .json I am developing it for myself, but if someone is interested I can certainly share it :) |
|
|
Current timezone is GMT Dec 19, 2025, 6:59:01 AM |