Jump to content
Developer Wiki and Function Reference Links ×

Get Camera View of Viewport


Recommended Posts

Hey Fellas...

 

Has anyone figured out how to get the camera view of a viewport and save it as a saved view with a script? 

 

Steps to script..   I was thinking we're. 

 

1.  ActLayerName:=GetLName(ActLayer);  { Set the active layer name as a string }

 

2.  Edit Camera of selected Viewport..  - This is where I don't see a solution.  Get the View of the Camera View - GetVPGroup() Nothing for Camera... or any other hook..  Need          some way to navigate to the Design Layer with the view of the viewport.    Some way to Edit Camera >   Save The View >  Return To Viewport...

 

3. Save View VSave('Test VP View');

 

4. Return to the  Layer(ActLayerName);

 

Any insight is appreciated...  There's always something you're not aware of.. 😆

Thanks!

Dave

Link to comment

The Camera is buried relatively deeply in the Aux list of the Viewport.  There is no "simple" way to get it using standard VS functions.  

 

If you really need to get it, we can probably work out a way to pull the name (and maybe the handle) out of the Aux list. Easier if you are using Python than if you are using VS.

 

Going to require a fair amount of spelunking and experimentation to make something that works consistently.

 

Let me know if you you want help in figuring this out.

Link to comment

Thanks for the direction Pat...

 

Did a quick test...  this does what I was looking for...  The design layer is always the same in our template..

 

So this works....  Posted for others...

 

-----------------------

PROCEDURE VPView;
VAR
  offsetX,offsetY,offsetZ   :REAL;
  rotationXAng,rotationYAng,rotationZAng: REAL;
  result: BOOLEAN;
  objectHandle,LayerHandle :HANDLE;

 

BEGIN

 

  objectHandle:= LSActLayer; { Selected Viewport }

 

  result:= GetViewMatrix( objectHandle, offsetX,offsetY,offsetZ, rotationXAng, rotationYAng, rotationZAng ); { Get the viewport matrix }

 

  Layer('Design Layer-1'); { Go to the Layer design layer with the 3d model }
 
  SetView( rotationXAng, rotationYAng, rotationZAng, offsetX,offsetY,offsetZ); { Set the view with the ViewMatrix variables from the viewport }
 
  VSave('The View');  { Save the view }
 
END;
Run(VPView);

  • Like 2
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...