How to export model part above the ground plane only

I want to export sketchup model in obj format, but not the whole model. I want to export the part which is
located above the ground plane(red-green plane).
I have tried to create a section plane on the ground plane, but it didn’t the trick because after setting section plane and exporting the model I could see that the whole model was exported.
Is there a way to achieve this, without changing the model much ?

Here is what I’ve tried

  model = Sketchup.active_model
  entities = model.entities
    
    origin = model.axes.origin

    if origin.z!=0
      sp = entities.add_section_plane([0, 0, origin.z], [0, 0, origin.z])
      #sp = entities.add_section_plane([xaxis, yaxis, zaxis], [xaxis+10, yaxis+10, zaxis])
      sp.activate
      
      sp
    end

  status = model.export(outpath, true)

This has been asked for and discussed in the past …


API Feature Request logged …

1 Like

you will need to change the model. export and then ‘undo’ the changes…

if you link in to Zoro2 from your ruby it will erase all the ‘hidden’ geometry, then you export and then revert…

# this would be a more concise test
model.bounds.corner(0).x == 0.0
# and you can use the constant
 entities.add_section_plane(ORIGIN, [0, 0, 1]).activate

john