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();
}
}
Aggregations