Change orthographic to perspective projection using iLogic

Change orthographic to perspective projection using iLogic

Anonymous
Not applicable
1,441 Views
7 Replies
Message 1 of 8

Change orthographic to perspective projection using iLogic

Anonymous
Not applicable

 

Hi,

 

i would like to be able to change the projection type from orthogonal to perspective and vice versa using iLogic code. It is critical for the project I'm working on and the potential users that this can be controlled via an iLogic form. I have seen another post relating to this -

 

"How to change Projection from Orthographic to Perspective View using VB.Net code" - but it didn't work on my computer. I'm really new to iLogic and don't know how to make it work.

 

Can anyone help?

 

0 Likes
Accepted solutions (1)
1,442 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
Accepted solution

Hey there,

 

Did you copy and paste the code from the other post?  That's not iLogic code but it's very close.

 

SyntaxEditor Code Snippet

Dim oCam as Camera
oCam = ThisApplication.ActiveView.Camera

oCam.Perspective = Perspective
oCam.ApplyWithoutTransition()

 

I created a Boolean parameter called Perspective.  Modifying that will change your camera from Perspective to Orthographic.

 

0 Likes
Message 3 of 8

Anonymous
Not applicable

Thank you! I didn't know vb.net codes are different than iLogic (you see how naive  am with this!)

 

Anyway, the code you provided didn't work right away - I think you created a text parameter (not boolean) with one of the multivalue being perspective?

 

I amended the code for boolean and changed the code slightly to make it work - and now it works like a charm! 

 

Thank you very much for your help - the way to call the perspective function under camera is just the pick me up I needed.

 

Here is the amended code:

 

SyntaxEditor Code Snippet

Dim oCam as Camera
oCam = ThisApplication.ActiveView.Camera

If Perspective = True Then
oCam.Perspective = True
ElseIf Perspective = False Then
oCam.Perspective = False
End If

oCam.ApplyWithoutTransition()

 

0 Likes
Message 4 of 8

Anonymous
Not applicable

No, it was a boolean.  It just makes the code cleaner and not as much of it.

 

You'll notice I don't use an If..Then.  Since Perspective was a boolean parameter, you can just set the oCam.Perspective to equal that parameter.

 

Glad you got it to work though.

0 Likes
Message 5 of 8

Anonymous
Not applicable
That's a really helpful little tip - thank you!
0 Likes
Message 6 of 8

Maxim-CADman77
Advisor
Advisor

I wonder if it possible to modify code in order set view mode to "perspective with ortho faces"?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 7 of 8

R.Mabery
Advocate
Advocate

Oh how I wish there was.


Thanks,
Randy Mabery
Applications Expert
IMAGINiT Technologies
0 Likes
Message 8 of 8

Maxim-CADman77
Advisor
Advisor
0 Likes