1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| import java.io.File;
import javax.swing.JFrame;
import org.jcae.viewer3d.View;
import org.jcae.viewer3d.cad.ViewableCAD;
import org.jcae.viewer3d.cad.occ.OCCProvider;
/** Exemple pour le viewer 3D */
public class Example1
{
public static void main(String[] args)
{
try
{
// The swing frame where we will put the view
JFrame feFrame=new JFrame();
feFrame.setSize(800,600);
// Put it all in a view
View feView=new View(feFrame);
feFrame.addWindowListener(new EcouteurFenetre());
// let's add a CAD viewable loaded from a STEP file.
File f = new File("src\\linkrods.step");
System.out.println(f.getAbsolutePath());
ViewableCAD fcad=new ViewableCAD(new OCCProvider(f.getAbsolutePath()));
feView.add(fcad);
// Fit the view to the object
feView.fitAll();
// Put it all in a Swing frame
feFrame.getContentPane().add(feView);
feFrame.setVisible(true);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
} |
Partager