Associatvity state change event?

Associatvity state change event?

Cris-Ideas
Advisor Advisor
797 Views
16 Replies
Message 1 of 17

Associatvity state change event?

Cris-Ideas
Advisor
Advisor

Hi,

I was almost there with my code.

But run on to a serious obstacle.

 

I need to catch when associativity setting for componet's DVR is changed.

 

I did't find any event that would indicate this.

Does anyone know if there is such an event?

 

Cris.

Cris,
https://simply.engineering
0 Likes
798 Views
16 Replies
Replies (16)
Message 2 of 17

bradeneuropeArthur
Mentor
Mentor
Try this command via the manager:
"PartAdaptiveFeatureCtxCmd"

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 17

bradeneuropeArthur
Mentor
Mentor
Public WithEvents UIE As Inventor.UserInputEvents
    
Try
         UIE = _InvApp.CommandManager.UserInputEvents
Catch ex As Exception

End Try

Private Sub UIE_OnActivateCommand(CommandName As String, Context As NameValueMap) Handles UIE.OnActivateCommand
        MsgBox(CommandName)
        
if CommandName = "PartAdaptiveFeatureCtxCmd" then
'DO THIS>>>>>>
end if

    End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 17

Cris-Ideas
Advisor
Advisor

Edited:

Sorry you did already.

Thread did not update.

will look in to it

 

@bradeneuropeArthur

Hi,

Thanks for advice.

But I need much wider context as I am not able to understand what exactly and where and how should I do.

 

Could you provide me with some more detail directions or example maybe?

 

 

Cris

Cris,
https://simply.engineering
0 Likes
Message 5 of 17

bradeneuropeArthur
Mentor
Mentor
Hi,
Don't you understand what and how to program this is your add in?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 6 of 17

Cris-Ideas
Advisor
Advisor

Ok,

I may be able to catch activation of the command window.

 

But how can I than find out if after this command is done component is associative or not?

 

I am looking to find a way to detect when associativity state of DVR of the component changes form True to False.

other direction works fine (so I am able to detect when it is changed from False to True).

 

Cris.

 

Cris,
https://simply.engineering
0 Likes
Message 7 of 17

bradeneuropeArthur
Mentor
Mentor
let's take a look...
keep reading...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 8 of 17

Cris-Ideas
Advisor
Advisor

Hi,

Well it is my add-inn, and I can program only a little bit. 😉

 

So what it is suppos to do is:

Manage visibility of the component to get rid of the annoying thing that is putting components in Master DVR after they are set associative turned off and on again.

 

So far I was able to successfully get this done using windows form application. But components must be turned off by clicking button on the form.

What I would like to get is to link to the visibility event of the component by ComponentOccurecneOnChange Event, but there I have run on to the problem of bug in the event.

When associativity is changed from false to true it is properly indicated in during the Event. But when it is changed from True to False it is wrong as it is indicated as False before and after Event.

 

Also when associative component is being turned off there is a message window informing that associativity will be removed. And this window does not bring up ComponentOccurenceOnChange Event at all, and associative state if obviously changed.

 

So I am looking for a way to monitor associativity state of the componentoccurence DVR in some other way, that would allow me to know whether  component was set to be associative the moment user chooses to switch it off.

 

Cris.

Cris,
https://simply.engineering
0 Likes
Message 9 of 17

bradeneuropeArthur
Mentor
Mentor

Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument

MsgBox oPartDoc.ModelingSettings.AdaptivelyUsedInAssembly

 

What do you mean with "Master DVR"

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 10 of 17

bradeneuropeArthur
Mentor
Mentor

Sorry completely wrong what I understood.
Sorry from my side.
I read It wrong

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 11 of 17

bradeneuropeArthur
Mentor
Mentor

Public Sub main()

Dim a As AssemblyDocument
Set a = ThisApplication.ActiveDocument

Dim b As AssemblyComponentDefinition
Set b = a.ComponentDefinition
Dim occ As ComponentOccurrence

For Each occ In b.Occurrences
MsgBox occ.IsAssociativeToDesignViewRepresentation
Next

End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 12 of 17

Cris-Ideas
Advisor
Advisor

Hi,

Yes this is the property.

But I am not looking for a way to read it but to monitor its state and defectively to catch all changes in its state while user works in the assembly.

Or if not possible than at least state just before user sets component's visibility state to off.

 

there is ComponentOccurrenceOnChahge event but it indicates IsAssociative.. property value not correctly in case of the Event that is raised when visibility is switched off.

Also there is this dialogue window I mentioned which does not rise this event at all, but in the same time it changes IsAssociative... property setting.

 

Cris. 

 

Cris,
https://simply.engineering
0 Likes
Message 13 of 17

bradeneuropeArthur
Mentor
Mentor

Hope this is what ypu need:

Public WithEvents AE As Inventor.AssemblyEvents

AE = _InvApp.AssemblyEvents

Private Sub AE_OnOccurrenceChange(DocumentObject As _AssemblyDocument, Occurrence As ComponentOccurrence, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, ByRef HandlingCode As HandlingCodeEnum) Handles AE.OnOccurrenceChange
        MsgBox(Occurrence.IsAssociativeToDesignViewRepresentation)
End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 14 of 17

Cris-Ideas
Advisor
Advisor

I have tried this approach in the begging, but it does not work.

Do you have any other idea?

 

 

link to download video in better resolution https://autode.sk/2MSyOAA

 

Cris.

Cris,
https://simply.engineering
0 Likes
Message 15 of 17

bradeneuropeArthur
Mentor
Mentor

hi,

 

If the DVR changes back to "Master" when the checkmark is removed, the Value becomes empty.

So:

Public WithEvents AE As Inventor.AssemblyEvents

AE = _InvApp.AssemblyEvents

Private Sub AE_OnOccurrenceChange(DocumentObject As _AssemblyDocument, Occurrence As ComponentOccurrence, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, ByRef HandlingCode As HandlingCodeEnum) Handles AE.OnOccurrenceChange
        MsgBox(Occurrence.ActiveDesignViewRepresentation)
if Occurrence.ActiveDesignViewRepresentation ="" then
'Do this.....
else
'Do this.....
end if End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 16 of 17

Cris-Ideas
Advisor
Advisor

Thanks,

Will investigate this way.

 

Cris.

Cris,
https://simply.engineering
0 Likes
Message 17 of 17

Cris-Ideas
Advisor
Advisor

Hi,

tried latest suggestion.

Unfortunately same problem as before.

 

In case I remove associativity before and after events indicate IsAssociative=False and ActiveDesignViewRepresentation = ""

 

This however works when I assign associativity.

 

Earlier you suggested catching dialogue window.

In case of command windows is there an event raised when dialogue is closed (OK, CANCL) indicating settings of the command?

 

Cris.

 

 

Cris.

Cris,
https://simply.engineering
0 Likes