Print at Dec 18, 2025, 3:02:25 AM

Posted by Puybaret at Mar 20, 2013, 5:33:51 PM
Re: Area calculation and auto dimensions for 2D
A nice start smile

The function that Puybaret told is private so i had to extract it and encapsulate it in the plugin
I pointed to you the getMeasuringDimensionLineAt method to give you hints. Nothing more and it's not a problem you copy it. You'll see that my development strategy is to generally keep many methods private. It's not that I don't want developers to call them, but exposing them as public would make them part of the API and oblige me to spend much more time to specify the best parameters.

The function needed the user preferences and the pixel length, but I couldn't manage to find a way to get them from the Plugin.
You can retrieve preferences with the Plugin#getUserPreferences method and pixel length with Plugin#getHomeController method. The later method returns a HomeController instance on which you can call getPlanController().getView().getPixelLength().

3.- I haven't found a way to separate the outer walls from the inner walls.
Look at RoomController class source code, the way walls surrounding a room are detected should help you. More generally, enumerating points with java.awt.geom.Area methods could be very helpful too.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator