Print at Dec 21, 2025, 2:05:16 AM

Posted by Puybaret at May 29, 2013, 10:00:49 AM
Re: How to add more properties to a wall?
In the current version 4.0, the only method which let you add some private data in a home from a plug-in is setVisualProperty method in Home class. Normally, it's used to store some visual values, like the location and size of the main window, but you can store there whatever you want as long it uses some serializable classes of Java API or Sweet Home 3D API (not classes of your plug-in otherwise I don't think you would be able to open the file again).

If you don't choose the plug-in path, you could create a subclass of Wall that you'll instantiate in a createWall method overridden in a subclass of PlanController (PlanController instance is instantiated itself in HomeController#getPlanController that you can override too, etc... up to a subclass of SweetHome3D). This way of doing would avoid you to change existing source code, and will greatly simplify the maintenance of the future versions of your program.

In which context do you have to program this project?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator