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: 6
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 3793 times and has 5 replies Next Thread
bandara
Newbie




Joined: Dec 26, 2009
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
confused how to get selected drawing to another swing interface

hi,
I'm a university student, i try to arrange the furniture inside a rectangular room, with use of 2D bin packing algorithms. Its not productively make sense (in real world), but in scope wise, it was approved to develop.
My project have more things to do, like:
*Check area selected larger than selected furniture inside room.
*Add human posture value to furniture before arrangement.
*Arrange them in new interface using 2D First Fit and Next Fit Decreasing Height algorithms.
*Show final arrangement in 3D.

It lot ha...:) but in this case i want to know how to get selected item, which we draw (which we select always rectangular area) to another swing interface.
I tried http://www.sweethome3d.com/pluginDeveloperGuide.jsp
as starting step, but its not work due to following line.
or (PieceOfFurniture piece : getHome().getFurniture()) {
it says there is no getHome() method.
But i called a new swing interface, after click on that created plugin menu.

I tried your API, since i'm not expert with API's i cudnt find good path yet.

Can any one guide me, in this case, like what are the materials or classes i should follow, and more detail on this. How i should start this.

Thankx.
[Jun 5, 2011, 8:06:59 PM] 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: 9426
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get selected drawing to another swing interface

getHome method is coming from com.eteks.sweethome3d.plugin.Plugin class from which VolumePlugin class inherits. If you look at VolumePlugin source code, you'll see that VolumeAction is an inner class that's why it can access to this method available in its VolumePlugin outer class. So, I guess you just defined VolumeAction class in a separate file and not as an inner class. It's not a problem but then, you'll have to store in the VolumeAction class a link to a VolumePlugin instance to access its getHome method.

The current selection in the plan is returned by the getSelectedItems method in Home class. This method returns a list of Selectable objects, and you can test the class of each object to know whether it's a piece of furniture, a wall...

Good luck for your project. It sounds interesting! smile
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
[Jun 6, 2011, 6:54:01 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bandara
Newbie




Joined: Dec 26, 2009
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get selected drawing to another swing interface

Puybaret ; thanx bro.
As you told, i messed with inner class, VolumePlugin worked fine.
I am trying on getSelectedItems method, and selectable. Its implements many objects. I'll give a try first and comment, or ask further. Tx.
[Jun 6, 2011, 4:30:01 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bandara
Newbie




Joined: Dec 26, 2009
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get selected drawing to another swing interface

bro i try to get area of selected room by this code.
float area;
float s1[][]={{1,2},{3,5}};
Room r =new Room(s1);
area=r.getArea();
JOptionPane.showMessageDialog(null,area);

but it always shows 0.0 in result.
Any reason.?
[Jun 21, 2011, 6:22:43 PM] 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: 9426
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get selected drawing to another swing interface

Hum, since when a line has an area??? laughing
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
[Jun 21, 2011, 7:13: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 
bandara
Newbie




Joined: Dec 26, 2009
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get selected drawing to another swing interface

getArea() returns a float, not float array.
So, how can i get it?
[Jun 21, 2011, 7:40:34 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 2024 Space Mushrooms - All rights reserved