Re: How to run a new class in SH3D source

by Puybaret » Sun Aug 21, 2011 10:44 am

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:

Code: Select all

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. [:)]