Below is a basic Ruby script that merges the geometry of 2x OSMs:
Both models should be downloaded to the same folder as the script.
require "openstudio"
translator = OpenStudio::OSVersion::VersionTranslator.new
model = OpenStudio::Model::Model.new
fileA = File.join(__dir__, "warehouse.osm")
pathA = OpenStudio::Path.new(fileA)
modlA = translator.loadModel(pathA).get
fileB = File.join(__dir__, "smalloffice.osm")
pathB = OpenStudio::Path.new(fileB)
modlB = translator.loadModel(pathB).get
[modlA, modlB].each_with_index do |modl, i|
modl.getSpaces.each do |sp|
space = OpenStudio::Model::Space.new(model)
space.setDirectionofRelativeNorth(sp.directionofRelativeNorth)
if i.zero?
space.setXOrigin(sp.xOrigin)
space.setYOrigin(sp.yOrigin)
space.setZOrigin(sp.zOrigin)
else
space.setXOrigin(sp.xOrigin + 100)
space.setYOrigin(sp.yOrigin)
space.setZOrigin(sp.zOrigin)
end
sp.surfaces.each do |srf|
surface = OpenStudio::Model::Surface.new(srf.vertices, model)
surface.setSpace(space)
surface.setOutsideBoundaryCondition(srf.outsideBoundaryCondition)
surface.setSurfaceType(srf.surfaceType)
surface.setSunExposure(srf.sunExposure)
surface.setWindExposure(srf.windExposure)
srf.subSurfaces.each do |sb|
sub = OpenStudio::Model::SubSurface.new(sb.vertices, model)
sub.setSurface(surface)
sub.setSubSurfaceType(sb.subSurfaceType)
end
end
zone = OpenStudio::Model::ThermalZone.new(model)
space.setThermalZone(zone)
sys = OpenStudio::Model::ZoneHVACIdealLoadsAirSystem.new(model)
sys.addToThermalZone(zone)
end
end
spaces = OpenStudio::Model::SpaceVector.new(model.getSpaces)
OpenStudio::Model.intersectSurfaces(spaces)
OpenStudio::Model.matchSurfaces(spaces)
file = File.join(__dir__, "final.osm")
model.save(file, true)
Running the script generates a "final.osm".

No errors running a test simulation using the App. You do need to first assign a (complete) default construction set to the building to actually run a test simulation. You can adapt the script to your needs (e.g. use your own OSMs). If needed, you can email me the (zipped) OSMs - I'll merge the zipped OSMs using the very same script.
The script is just a demo. You can further develop the script so it copies/pastes other items (e.g. loads, schedules). I also suggest going over past related UMH posts (such as this one) - plenty of caveats to consider when dealing with an OSM holding multiple pavilions (e.g. separate meters, shared plant/systems).
You need to be a bit more specific on your OpenStudio toolkit and workflow. Are you mainly working with the OpenStudio Application (App)? Are you using the SketchUp Plugin? Have you tried interacting with the SDK yet?
I'm pretty sure one can't merge multiple OSM geometries using the App or Plugin. Do-able with the SDK (e.g. a single Ruby or Python script). This involves opening existing OSMs (as an array), looping through the array and copy/pasting their zones, spaces, surfaces, subsurfaces over to a newly instantiated OSM (series of loops).
Thank you for your answer Denis, Yes I am using the SketchUp Plugin to define the geometry of each building, my goal is to design a village (cluster of buildings) and then pass the .osm file to OpenStudio (APK) for the simulation, but the problem is that I have them (buildings) in separate .osm files !
APK? You may have already tried running simulations with the OpenStudio CLI, using e.g. PowerShell (Windows) or Terminal (MacOS). Taking advantage of the SDK (e.g. API), either interactively or via scripting (e.g. Ruby, Python), opens the door wide open for customization and automation (see below) ... although there's definitely a learning curve.
Thank you so much Denis for taking the time to answer my question . I truly appreciate your support and the clarity of your explanation. I will definitely try out the solution you suggested and see how it works out for me. Thanks again for your guidance.
Best regards.