Exit the AEC_Exchange:Environment

Exit the AEC_Exchange:Environment

nooraldeen.saleem
Participant Participant
321 Views
2 Replies
Message 1 of 3

Exit the AEC_Exchange:Environment

nooraldeen.saleem
Participant
Participant

I am hoping that the answer to this is easy, but at the same time, I don't because I will be disappointed in myself that I have put so much time without finding it.

Well this is the problem. 

Sub Main()
	
	'Enter the BIM Content environment
	ThisApplication.CommandManager.ControlDefinitions.Item("AEC_Exchange:Environment").Execute()
	
End Sub

 This code Enters The AEX_Exchange:Environment. But how do i Then Exit it?

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

Michael.Navara
Advisor
Advisor
Accepted solution

Here is short sample how to switch into and exit from AEC Exchange environment without .Execute method

 

Sub Main
	Dim doc As Document = ThisDoc.Document
	Dim envMgr As EnvironmentManager = doc.EnvironmentManager

	'Get current environment
	Dim currEnv As Inventor.Environment
	Dim editTargetId As String
	envMgr.GetCurrentEnvironment(currEnv, editTargetId)
	Logger.Debug("{0} - {1}", currEnv.DisplayName, currEnv.InternalName)
	
	MsgBox("Switch to AEC Exchange environment")
	
	'Set specific environment
	Dim envInternalName = "AEC_Exchange:Environment"
	Dim aecExchangeEnv = ThisApplication.UserInterfaceManager.Environments(envInternalName)
	envMgr.SetCurrentEnvironment(aecExchangeEnv)
	
	MsgBox("Exit AEC Exchange")
	
	'Set base environment (Exit AEC)
	Dim baseEnv As Inventor.Environment = envMgr.BaseEnvironment
	envMgr.SetCurrentEnvironment(baseEnv)
		
End Sub

 

For more info see here

 

Message 3 of 3

nooraldeen.saleem
Participant
Participant
Thank you. This worked perfectly
0 Likes