1 Answers
A:
Use ApplicationEvents.OnSaveDocument with Filtering
You can hook into the global OnSaveDocument event and check whether the document being saved is a part, even if the save was triggered from an assembly.
VB.NET Add-In Example
Private Sub m_ApplicationEvents_OnSaveDocument( _
ByVal DocumentObject As Inventor.Document, _
ByVal BeforeOrAfter As Inventor.EventTimingEnum, _
ByVal Context As Inventor.NameValueMap, _
ByRef HandlingCode As Inventor.HandlingCodeEnum) _
Handles m_ApplicationEvents.OnSaveDocument
If BeforeOrAfter = EventTimingEnum.kBefore Then
If TypeOf DocumentObject Is PartDocument Then
' Optional: Check if this is being saved as part of an assembly save
' You can compare with ActiveDocument or use Context map
Dim partDoc As PartDocument = CType(DocumentObject, PartDocument)
' Run your logic here
End If
End If
End Sub
Find the Best CAD Software
Explore all products with features, pricing, reviews and more
View All SoftwareHelp the community
Be the First to Answer these questions
Disclaimer
Techjockey’s software industry experts offer advice for educational and informational purposes only. A category or product query or issue posted, created, or compiled by Techjockey is not meant to replace your independent judgment.
20,000+ Software Listed
Best
Price Guaranteed
Free Expert
Consultation
2M+
Happy Customers