Search in sources :

Example 1 with RevisionMerger

use of org.bimserver.merging.RevisionMerger in project BIMserver by opensourceBIM.

the class Visualise method main.

public static void main(String[] args) {
    PluginManager pluginManager;
    try {
        pluginManager = LocalDevPluginLoader.createPluginManager(Paths.get("home"));
        DeserializerPlugin deserializerPlugin = pluginManager.requireDeserializer("application/ifc");
        Deserializer deserializer = deserializerPlugin.createDeserializer(new PluginConfiguration());
        deserializer.init(pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1"));
        IfcModelInterface model1 = DeserializerUtils.readFromFile(deserializer, TestFile.EXPORT3.getFile());
        IfcModelInterface model1b = DeserializerUtils.readFromFile(deserializer, TestFile.EXPORT3.getFile());
        IfcModelInterface model2 = DeserializerUtils.readFromFile(deserializer, TestFile.EXPORT3.getFile());
        IfcModelInterface model2b = DeserializerUtils.readFromFile(deserializer, TestFile.EXPORT3.getFile());
        model1.setObjectOids();
        model1b.setObjectOids();
        model2.setObjectOids();
        model2b.setObjectOids();
        model1.indexGuids();
        model2.indexGuids();
        model2.fixOids(new IncrementingOidProvider(model1.getHighestOid() + 1));
        IfcModel merged = new RevisionMerger(model1, model2).merge();
        SerializerPlugin serializerPlugin = pluginManager.getSerializerPlugin("org.bimserver.ifc.step.serializer.IfcStepSerializerPlugin", true);
        Serializer serializer = serializerPlugin.createSerializer(new PluginConfiguration());
        serializer.init(merged, null, false);
        SerializerUtils.writeToFile(serializer, Paths.get("merged.ifc"));
        new Visualise().start(model1b, "Model 1");
        new Visualise().start(model2b, "Model 2");
        new Visualise().start(merged, "Merged");
    } catch (PluginException e1) {
        e1.printStackTrace();
    } catch (SerializerException e) {
        e.printStackTrace();
    } catch (DeserializeException e) {
        e.printStackTrace();
    } catch (IfcModelInterfaceException e) {
        e.printStackTrace();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : RevisionMerger(org.bimserver.merging.RevisionMerger) IfcModelInterface(org.bimserver.emf.IfcModelInterface) PluginException(org.bimserver.shared.exceptions.PluginException) DeserializerPlugin(org.bimserver.plugins.deserializers.DeserializerPlugin) FileNotFoundException(java.io.FileNotFoundException) SerializerPlugin(org.bimserver.plugins.serializers.SerializerPlugin) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) IOException(java.io.IOException) SerializerException(org.bimserver.plugins.serializers.SerializerException) PluginManager(org.bimserver.plugins.PluginManager) IfcModel(org.bimserver.ifc.IfcModel) IfcModelInterfaceException(org.bimserver.emf.IfcModelInterfaceException) Deserializer(org.bimserver.plugins.deserializers.Deserializer) PluginConfiguration(org.bimserver.plugins.PluginConfiguration) IncrementingOidProvider(org.bimserver.shared.IncrementingOidProvider) Serializer(org.bimserver.plugins.serializers.Serializer)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 IfcModelInterface (org.bimserver.emf.IfcModelInterface)1 IfcModelInterfaceException (org.bimserver.emf.IfcModelInterfaceException)1 IfcModel (org.bimserver.ifc.IfcModel)1 RevisionMerger (org.bimserver.merging.RevisionMerger)1 PluginConfiguration (org.bimserver.plugins.PluginConfiguration)1 PluginManager (org.bimserver.plugins.PluginManager)1 DeserializeException (org.bimserver.plugins.deserializers.DeserializeException)1 Deserializer (org.bimserver.plugins.deserializers.Deserializer)1 DeserializerPlugin (org.bimserver.plugins.deserializers.DeserializerPlugin)1 Serializer (org.bimserver.plugins.serializers.Serializer)1 SerializerException (org.bimserver.plugins.serializers.SerializerException)1 SerializerPlugin (org.bimserver.plugins.serializers.SerializerPlugin)1 IncrementingOidProvider (org.bimserver.shared.IncrementingOidProvider)1 PluginException (org.bimserver.shared.exceptions.PluginException)1