Fuge Posted January 19 Share Posted January 19 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 Quote Link to comment
Pat Stanford Posted January 20 Share Posted January 20 Take a Look at GetViewMatrix and SetViewMatrix. They can get the. view of a viewport, but they don't seem to return the same info as a camera. 1 Quote Link to comment
Pat Stanford Posted January 21 Share Posted January 21 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. Quote Link to comment
Fuge Posted January 22 Author Share Posted January 22 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); 2 Quote Link to comment
Recommended Posts
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.