That’s a shame. The send_action feature definitely feels like a bit of a bodge.
My final code is as follows (if it happens to help somebody in the future).
eye = [0, -300, 0]
target = [0, 0, 0]
up = [0, 0, 1]
cam = Sketchup::Camera.new eye, target, up, perspective = false
view = Sketchup.active_model.active_view
view.camera = cam
model = Sketchup.active_model
result = Sketchup.send_action 21237
UI.messagebox("You've Saved A Front View")
eye = [-300, 0, 0]
target = [0, 0, 0]
up = [0, 0, 1]
cam = Sketchup::Camera.new eye, target, up, perspective = false
view = Sketchup.active_model.active_view
view.camera = cam
model = Sketchup.active_model
result = Sketchup.send_action 21237
UI.messagebox("You've Saved A Left View")
eye = [300, 0, 0]
target = [0, 0, 0]
up = [0, 0, 1]
cam = Sketchup::Camera.new eye, target, up, perspective = false
view = Sketchup.active_model.active_view
view.camera = cam
model = Sketchup.active_model
result = Sketchup.send_action 21237
UI.messagebox("You've Saved A Right View")
eye = [0, 300, 0]
target = [0, 0, 0]
up = [0, 0, 1]
cam = Sketchup::Camera.new eye, target, up, perspective = false
view = Sketchup.active_model.active_view
view.camera = cam
model = Sketchup.active_model
result = Sketchup.send_action 21237
UI.messagebox("You've Saved A Back View")
eye = [0, 0, 300]
target = [0, 0, 0]
up = [0, 1, 0]
cam = Sketchup::Camera.new eye, target, up, perspective = false
view = Sketchup.active_model.active_view
view.camera = cam
model = Sketchup.active_model
result = Sketchup.send_action 21237
UI.messagebox("You've Saved A Top View")
I have to manually add the extension on the filename but saves a fair bit of time setting up the camera angles. The popup boxes are also annoying, but supposedly it’s required to stop the send_action command from bugging out:
The first line opens the 2D export dialog (then the user has to save the file manually). Unfortunately the send_action method is asynchronous which was messing up my script, but creating a messagebox on the next line successfully blocks the script until the save dialog closes.
Weirdly my script seems to work fine on 22.0.354, not sure why!
Thanks again for all your help and input.