Move View to Set Zoom

Is there a way (in assembly and part mode) to change the zoom to a set distance?  Im trying to create a "To actually scale" view for part and assembly modes.  I use the GetCamera, but when I use the SetCamera my model disappears.  Even if you use 'Fit' after, the model is still invisable.  Not sure whats the issue.  Any ideas?




Re: Move View to Set Zoom

You might first get the actual scale of your part or assembly view using the GetCamera method, manipulate the scale factor only and finally pass all the same parameters again to the SetCamera method with only the updated scale factor.

This worked for me:

Dim objDoc As SolidEdgeFramework.SolidEdgeDocument = objApp.ActiveDocument
Dim objWin As SolidEdgeFramework.Window = objDoc.Windows.Item(1)
Dim objView As SolidEdgeFramework.View = objWin.View
Dim eye(2) As Double
Dim target(2) As Double
Dim up(2) As Double
Dim isPerspective As Boolean = False
Dim scale As Double
objView.GetCamera(eye(0), eye(1), eye(2), target(0), target(1), target(2), up(0), up(1), up(2), isPerspective, scale)
objView.SetCamera(eye(0), eye(1), eye(2), target(0), target(1), target(2), up(0), up(1), up(2), isPerspective, scale * 0.5)


Re: Move View to Set Zoom

I tried this, but I tried entering a set value.  When I do that, the model disappears and even using the fit command doesnt bring it back.  I'll keep looking into it and see if I can find anything.

Re: Move View to Set Zoom

Which scale value did you use to set?

The scale factor depends on your model's size and can be in the range of multiple of thousands, so setting it to 1, for example, would make it very, very small.

But it should always be possible to set it back to normal using the Fit command.

I have seen the behaviour you have described, if I set the camera to perspective with a 90 deg angle (Math.PI/2). After that, any FIt command does NOT bring the object back. You have to switch off perspective again and then call Fit.

Re: Move View to Set Zoom

In my quick and dirty testing I used a form of MartinBernhard's code but after the GET, I read the scale value (as you said, a number in the thousands).  I then used that number for the SET method.  Thats when it would disappear.  All of this is while having the same part model open.  It's looking like every model will have a different scale value, so setting the view to a predefined value wont happen.  So wondering if this "view to scale" function wont be a possiblity.

Re: Move View to Set Zoom

Maybe it's a bug in your version of ST. I am already on ST7 and do not see your problems.

I would file an IR, if my code from the first post does NOT work in orthographic mode!!