iLogic: turn off ambient shadow if filesize of open file is bigger then XXX

iLogic: turn off ambient shadow if filesize of open file is bigger then XXX

Neuzzo
Advocate Advocate
874 Views
4 Replies
Message 1 of 5

iLogic: turn off ambient shadow if filesize of open file is bigger then XXX

Neuzzo
Advocate
Advocate

Hi all, i'm newbie of iLogic code and if is possible i need an help  with this code:

 

Dim doc As Document
doc = ThisApplication.ActiveDocument

Dim ls As AppAmbientShadowCmd

Dim myFile As New FileInfo(ThisDoc.PathAndFileName(True))
Dim sizeInBytes As Long = myFile.Length
Dim sizeInKB As Long = sizeInBytes / 1024
Dim sizeInMB As Long = sizeInKB / 1024
If sizeInMB > 45
	AppAmbientShadowCmd(False)
	
Else AppAmbientShadowCmd(True)


This is what i want to do:

When i open an assembly or part, if filesize is bigger then 45MB, ilogic shut down ambient shadow.

Else put the shadow on.

Any help is really apreciated.

Danilo "DannyGi" G.
Mechanical design engineer and product developer
Accepted solutions (1)
875 Views
4 Replies
Replies (4)
Message 2 of 5

Thomas_Savage
Advisor
Advisor

Hello @Neuzzo 

 

This post would be better in the inventor customization forum.

 

I have asked this to be moved for you.

 

Hope you find your answer there.

 

Thomas.



Thomas Savage

Design Engineer


0 Likes
Message 3 of 5

Neuzzo
Advocate
Advocate

Thank you and sorry for wrong place

Danilo "DannyGi" G.
Mechanical design engineer and product developer
0 Likes
Message 4 of 5

lmc.engineering
Advocate
Advocate
Accepted solution

Hi @Neuzzo 

 

You were close!

 

This is what you need:

Imports System.IO

 

Dim myFile As New FileInfo(ThisDoc.PathAndFileName(True))
Dim sizeInBytes As Long = myFile.Length
Dim sizeInKB As Long = sizeInBytes / 1024
Dim sizeInMB As Long = sizeInKB / 1024

Dim oView As Inventor.View = ThisApplication.ActiveView
If sizeInMB > 45 Then
	oView.ShowAmbientShadows = False
Else
	oView.ShowAmbientShadows = True
End If  

 

Message 5 of 5

Neuzzo
Advocate
Advocate

@lmc.engineering wrote:

Hi @Neuzzo 

 

You were close!

 

This is what you need:

Imports System.IO

 

Dim myFile As New FileInfo(ThisDoc.PathAndFileName(True))
Dim sizeInBytes As Long = myFile.Length
Dim sizeInKB As Long = sizeInBytes / 1024
Dim sizeInMB As Long = sizeInKB / 1024

Dim oView As Inventor.View = ThisApplication.ActiveView
If sizeInMB > 45 Then
	oView.ShowAmbientShadows = False
Else
	oView.ShowAmbientShadows = True
End If  

 


Omg you're the man! Thank you

Danilo "DannyGi" G.
Mechanical design engineer and product developer
0 Likes