Hello,
I would like to enable/suppress certain features in a part or assembly when entering FEA environment.
I have looked at the tips in http://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/discussion/t5/Inventor-Cu...
, but FEA doesn't report as an environment in that context, and i can't find it using the VBA object browser.
Any good tips?
Cheers
Jens
Solved! Go to Solution.
Solved by wayne.brill. Go to Solution.
Hi Jens,
The Inventor API has the UserInterfaceEvents.OnEnvironmentChange Event that may provide a way to do what you need. iLogic has Event Triggers but it does not include any event trigger that would run a rule when the environment changes.
Here is a VBA example to show the idea. (just to show the API). This example is suppressing/unsuppressing components in an assembly when the environment changes. Suppressing features would be similar.
Put this in a Class Module:
Private WithEvents UIE As UserInterfaceEvents
Private Sub Class_Initialize()
Set UIE = ThisApplication.UserInterfaceManager.UserInterfaceEvents
End Sub
Private Sub Class_Terminate()
Set UIE = Nothing
End Sub
Private Sub UIE_OnEnvironmentChange(ByVal Environment As Environment, ByVal EnvironmentState As EnvironmentStateEnum, ByVal BeforeOrAfter As EventTimingEnum, ByVal Context As NameValueMap, HandlingCode As HandlingCodeEnum)
'Debug.Print Environment.DisplayName
'Debug.Print BeforeOrAfter
If Environment.DisplayName = "Assembly" Then
If BeforeOrAfter = kAfter Then
If ThisApplication.ActiveDocument.DocumentType = kAssemblyDocumentObject Then
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument
Dim oCO As ComponentOccurrence
For Each oCO In oAsmDoc.ComponentDefinition.Occurrences
Debug.Print oCO.Name
If oCO.Name = "EndPlate_Simple:1" Then
If oCO.Suppressed = False Then
Call oCO.Suppress
Else
Call oCO.Unsuppress
End If
End If
Next
End If
End If
End If
End Sub
Put this in a Module:
Dim oCls As clsUIE
Sub startE()
Set oCls = New clsUIE
End Sub
Sub stopE()
Set oCls = Nothing
End Sub
Run startE() to enable the event.
Thanks,
Wayne
Hi Wayne,
I'm sorry it took so long for me to see your answer, i don't visit here often, and back then i had to just finish up and deliver.
However, i do appreciate your effort and i will try it out when i get a chance.
Thank you.
Cheers Jens