Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
RasmusBredal
in reply to: Owner2229

Sorry but I can not translate that to my code.. Smiley Indifferent

This code work when I save the part, but i´t wont run when I save the part from idw. 

 

This code in modifyde from: Sheet Metal Extents Add-In

        Private Sub m_appEvents_OnSaveDocument(ByVal DocumentObject As Inventor._Document, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles m_appEvents.OnSaveDocument
            If BeforeOrAfter = EventTimingEnum.kBefore Then
                
Dim inventorAppType As Type = System.Type.GetTypeFromProgID("Inventor.Application") Dim _InvApplication As Inventor.Application = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application"), Application) Dim oPartDoc As PartDocument
oPartDoc = CType(_InvApplication.ActiveDocument, Inventor.PartDocument) ' Make sure the document is a sheet metal document.
If oPartDoc.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then MsgBox("A sheet metal document must be open.") Exit Sub Else MsgBox("A sheet metal has been save") End If End If End Sub