|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: how to get selected drawing to another swing interface |
|
| Print at Dec 20, 2025, 1:41:37 PM | |
| Posted by bandara at Jun 5, 2011, 8:06:59 PM |
how to get selected drawing to another swing interfacehi, 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. |
| Posted by Puybaret at Jun 6, 2011, 6:54:01 AM |
|
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! ![]() ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by bandara at Jun 6, 2011, 4:30:01 PM |
|
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. |
| Posted by bandara at Jun 21, 2011, 6:22:43 PM |
|
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.? |
| Posted by Puybaret at Jun 21, 2011, 7:13:39 PM |
|
Re: how to get selected drawing to another swing interface Hum, since when a line has an area??? ![]() ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by bandara at Jun 21, 2011, 7:40:34 PM |
|
Re: how to get selected drawing to another swing interface getArea() returns a float, not float array. So, how can i get it? |
|
|
Current timezone is GMT Dec 20, 2025, 1:41:37 PM |