Joined: Jan 15, 2013
Post Count: 17
Status:
Offline
Room size in java code
Hi,
I am a beginner in this area and this is my first plugin. I am trying to develop a plugin to allow users to enter a bathroom template. There is a function where they have to enter the room size or choose automatically. how do i add size of lets say 2400mm x 2500mm into java code. Also how do i position objects into a certain area?
Poland
Joined: Nov 10, 2010
Post Count: 50
Status:
Offline
Re: Room size in java code
If your models are already imported try:
// first you need to retrieve a model e.g. PieceOfFurniture pof =getUserPreferences() .getFurnitureCatalog() .getCategory(3) // category e.g. 3 .getPieceOfFurniture(2); // model 2 within the category
// Now you can display the model within current home HomePieceOfFurniture hpof = new HomePieceOfFurniture(pof);
// and set locations etc. hpof.setX(300); hpof.setY(700); hpof.setElevation(0); hpof.setAngle(30);
Joined: Jan 15, 2013
Post Count: 17
Status:
Offline
Re: Room size in java code
Hi,
Thank you so much for you help. The code looks good. I understand how to get object from current library using category and number in that category. What i don't understand is how do i size my house/room to lets say 2700mm x 2500mm.
And also how to I add new piece of furniture/furnitures in the current library. Do i have to add the object to Eclipse project? if so how can i do that?
Poland
Joined: Nov 10, 2010
Post Count: 50
Status:
Offline
Re: Room size in java code
Home refers in SweetHome to an open project. Walls are walls. Room refers to a polygon drawn on ground/level (and the ceiling is associated with the polygon as well).
You can also create a room just by drawing walls - without floor (our Room). It might be misleading, but I am sure that after playing a bit with user interface you will understand the underlying Java classes.
Joined: Jan 15, 2013
Post Count: 17
Status:
Offline
Re: Room size in java code
To make things easier to understand, i have pasted my code.
if (validateHouse()){
// if both house and bedroom dimension are unknown then speciry the hardcoded values. if (cbUnknownHouseDimension.isSelected()){ bathroomLength = 1000f; bathroomBreadth = 600f; //bedroomLength = 250f; //bedroomBreadth = 200f; }
So as you can see from the code, if the user doesnt know the measurements, it clicks on the checkbox and i want the house size to appear with default values. Hope you understand what i mean.
Joined: Jan 15, 2013
Post Count: 17
Status:
Offline
Re: Room size in java code
Thank you so much for you help. I really do appreciate it. I will just paste a screenshot so you know what i am trying to get here.
User clicks on the option
WIndow will pop up asking for measurements
And then a template will come up.
as you can see from the screenshot, that it allows you to add railings as well. I have created a new object but it will not show up. below is code for one of them.
So now i want to add a new furniture library so users can access those furniture without importing. And i want to arrange those object properly as you can see that they are not. Please help!!!