Trying to move the camera to a point in iLogic. What am I doing wrong?

Trying to move the camera to a point in iLogic. What am I doing wrong?

ianteneth
Advocate Advocate
830 Views
3 Replies
Message 1 of 4

Trying to move the camera to a point in iLogic. What am I doing wrong?

ianteneth
Advocate
Advocate

I have a simple iLogic script to move the camera to a point (See code below). This code will look at the origin from 15(cm?) away. In 2020 it works fine and will move to the origin as well as zoom to 15. But in 2021 this same code will only move the camera to the origin, not zoom. There are some screenshots of the results below also.

 

Edit: Just tested 2018 and it also doesn't zoom, just moves to the origin.

 

Question(s): Can anyone reproduce this or am I doing something wrong? Maybe this is a bug?

 

 

 

Dim camera As Camera = ThisApplication.ActiveView.Camera

camera.Target = ThisApplication.TransientGeometry.CreatePoint(0, 0, 0)
camera.Eye = ThisApplication.TransientGeometry.CreatePoint(15, 15, 15)

camera.Apply()

 

 

 

In 2021 the camera doesn't zoom.

Annotation 2020-07-21 173133.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

In 2020 the camera zooms fine.

Annotation 2020-07-21 173134.png

0 Likes
Accepted solutions (1)
831 Views
3 Replies
Replies (3)
Message 2 of 4

marcin_otręba
Advisor
Advisor

Maybe you should use fit method:

 

Dim camera As Camera = ThisApplication.ActiveView.Camera

camera.Target = ThisApplication.TransientGeometry.CreatePoint(0, 0, 0)
camera.Eye = ThisApplication.TransientGeometry.CreatePoint(15, 15, 15)
camera.Fit
camera.Apply()

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 3 of 4

ianteneth
Advocate
Advocate

Hi @marcin_otręba,

 

Thanks for the feedback. I tried adding the Fit method, but, it just fits the entire model into the view, not the target point.

0 Likes
Message 4 of 4

ckeveryga
Advocate
Advocate
Accepted solution

This should work for you. May need to play with extent values. 

Dim camera As Camera = ThisApplication.ActiveView.Camera

camera.Target = ThisApplication.TransientGeometry.CreatePoint(0, 0, 0)
camera.Eye = ThisApplication.TransientGeometry.CreatePoint(15, 15, 15)
camera.SetExtents(15,15)
camera.Apply()