Print at Dec 19, 2025, 6:32:33 AM

Posted by Puybaret at Aug 21, 2011, 10:44:35 AM
Re: How to run a new class in SH3D source
Ok, I think I understood what you want to do now.
If you want to display a home built by program from a derived version of Sweet Home 3D, you should:
- create a subclass of com.eteks.sweethome3d.SweetHome3D application class,
- add a main method that will instantiate and init the application from the arguments
- override the createHome method to return a com.eteks.sweethome3d.model.Home instance initialized the way you want.
Here's a base example:

import com.eteks.sweethome3d.SweetHome3D;
import com.eteks.sweethome3d.model.Home;

public class Test extends SweetHome3D {
public static void main(String [] args) {
new Test().init(args);
}

@Override
public Home createHome() {
Home home = super.createHome();
// Modify home as you wish here
return home;
}
}

Hope this will help you to start. smile
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator