Search in sources :

Example 1 with PluginManagerInterface

use of org.bimserver.plugins.PluginManagerInterface in project BIMserver by opensourceBIM.

the class TestGen method start.

private void start(String[] args) {
    try {
        PluginManagerInterface pluginManager = LocalDevSetup.setupPluginManager(args);
        DeserializerPlugin deserializerPlugin = pluginManager.getFirstDeserializer("ifc", Schema.IFC2X3TC1, true);
        Deserializer deserializer = deserializerPlugin.createDeserializer(null);
        deserializer.init(pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1"));
        RenderEnginePlugin renderEnginePlugin = pluginManager.getRenderEnginePlugin("org.bimserver.ifcengine.JvmRenderEnginePlugin", true);
        RenderEngine renderEngine = renderEnginePlugin.createRenderEngine(null, "ifc2x3tc1");
        renderEngine.init();
        Path path = Paths.get("../TestData/data/AC11-Institute-Var-2-IFC.ifc");
        RenderEngineModel renderEngineModel = renderEngine.openModel(new FileInputStream(path.toFile()), Files.size(path));
        RenderEngineSettings settings = new RenderEngineSettings();
        settings.setPrecision(Precision.SINGLE);
        settings.setIndexFormat(IndexFormat.AUTO_DETECT);
        settings.setGenerateNormals(true);
        settings.setGenerateTriangles(true);
        settings.setGenerateWireFrame(false);
        renderEngineModel.setSettings(settings);
        renderEngineModel.generateGeneralGeometry();
        renderEngineModel.close();
        renderEngine.close();
        long start = System.nanoTime();
        long end = System.nanoTime();
        System.out.println(((end - start) / 1000000) + " ms");
    } catch (PluginException e) {
        e.printStackTrace();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : Path(java.nio.file.Path) PluginException(org.bimserver.shared.exceptions.PluginException) DeserializerPlugin(org.bimserver.plugins.deserializers.DeserializerPlugin) FileNotFoundException(java.io.FileNotFoundException) RenderEnginePlugin(org.bimserver.plugins.renderengine.RenderEnginePlugin) IOException(java.io.IOException) RenderEngineModel(org.bimserver.plugins.renderengine.RenderEngineModel) FileInputStream(java.io.FileInputStream) PluginManagerInterface(org.bimserver.plugins.PluginManagerInterface) Deserializer(org.bimserver.plugins.deserializers.Deserializer) RenderEngineSettings(org.bimserver.plugins.renderengine.RenderEngineSettings) RenderEngine(org.bimserver.plugins.renderengine.RenderEngine)

Aggregations

FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 PluginManagerInterface (org.bimserver.plugins.PluginManagerInterface)1 Deserializer (org.bimserver.plugins.deserializers.Deserializer)1 DeserializerPlugin (org.bimserver.plugins.deserializers.DeserializerPlugin)1 RenderEngine (org.bimserver.plugins.renderengine.RenderEngine)1 RenderEngineModel (org.bimserver.plugins.renderengine.RenderEngineModel)1 RenderEnginePlugin (org.bimserver.plugins.renderengine.RenderEnginePlugin)1 RenderEngineSettings (org.bimserver.plugins.renderengine.RenderEngineSettings)1 PluginException (org.bimserver.shared.exceptions.PluginException)1