Script to Switch viewport to Default Camera?

I frequently like to switch between the top, back and perspective views in Daz while working on my main camera angle, tho while it is handy to have shortcuts for views I would like to make a small script that would find the "Default Camera" in scene and switch to it immediately.
Have tried tinkering with Mcj's scripts to "find and select a camera" but not switch view to that camera
var vmgr = MainWindow.getViewportMgr();
var vport = vmgr.getActiveViewport().get3DViewport();
var cam = vport.getCamera();
if( Scene.findNode( cam.name ) ) //must be in the scene
{
Scene.selectAllNodes( false );
cam.select( true ); //selects but doesnt switch
cam......Switch to selected cam in viewport HERE!?
}
Sorry incredibly amatuer question but been looking thru the Api and can seem to find means to "switch" viewport to the selected camera via script.
Any ideas ?
Comments
vport.setCamera( cam );
Thanks! tho doesnt seem to do quite what I was expecting, selects the camera but still wont switch to the Default Camera if I am in any other viewpoert mode ie Perspective, Front, etc
hmm, not sure why
.
This works, except for the UV view (which I suspect is because it isn't a 3d view no, it doesn't fail at getting the 3D Viewport so I'm not quite sure what it is tripping on):
You Sir, are a hero!
That works perfectly I can bind to a shortcut and have my own icon for quick flipping now !
Many, Many Thanks !
PS Are there any other good daz scripting resources / texts other than the API guide ? It's quite cumbersome to work thru
Have you looked at Rob's samples? They are release under the CC Attribution Unported license. http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/start
Thanks I had a look at that area already; was more the actual API docs I found to be a bit tricky to find what I was looking for - Guess it's time to study !
Is there a way to switch viewport to one of the view cameras like "Perspective View"? Couldn't find out how to do that.