Inventor Customization

Reply
Member
mziegler
Posts: 5
Registered: ‎10-24-2007
Message 1 of 2 (161 Views)

Dialog on OnSaveDocument

161 Views, 1 Replies
01-31-2013 03:15 AM

I try to open a Form that i create in the OnSaveDocument Event. I tested the Event with some MessageBox, they show up succesfully.

 

The Problem, My Form does not show on Screen.

 

        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
                If DocumentObject.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Or DocumentObject.DocumentType = DocumentTypeEnum.kPartDocumentObject Then

                    CheckCustomiProperty(DocumentObject, "Name englisch", "")
                    CheckCustomiProperty(DocumentObject, "BENKEY", "")

                    Dim oUDProps As PropertySet
                    oUDProps = DocumentObject.PropertySets.Item(4)

                    Dim oProps As PropertySet
                    oProps = DocumentObject.PropertySets.Item(3)

                    If oUDProps.Item("Name englisch").Value = ""

                        MsgBox(oUDProps.Item("Name englisch").Value)
                        MsgBox(oUDProps.Item("BENKEY").Value)
                        MsgBox(oProps.Item(2).Value)

                        MyForm.Show()
                        MyForm.TopMost = True

                    End If

                End If
            End If
        End Sub

 

The Important Part is:

 

'WORKS

                        MsgBox(oUDProps.Item("Name englisch").Value)
                        MsgBox(oUDProps.Item("BENKEY").Value)
                        MsgBox(oProps.Item(2).Value)

'DONT WORK
                        MyForm.Show()
                        MyForm.TopMost = True

 Thank you for your help, is it possible to show the Dialog ?

 

Best Regards Mathias

ADN Support Specialist
Vladimir.Ananyev
Posts: 458
Registered: ‎08-14-2012
Message 2 of 2 (127 Views)

Re: Dialog on OnSaveDocument

02-05-2013 07:15 AM in reply to: mziegler

I think you need to make Inventor the parent for your form.
Will you please look into this discussion:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Can-t-tab-through-Add-in-form/m-p/2528...

 Here is the source text of WindowWrapper class provided by Josh_Petitt

    ''' <summary>
    ''' Used to wrap a Win32 hWnd as a .Net IWind32Window class.
    ''' This is primarily used for parenting a dialog to the Inventor window.
    ''' </summary>
    ''' <remarks>
    ''' For example:
    ''' myForm.Show(New WindowWrapper(m_inventorApplication.MainFrameHWND))
    ''' </remarks>
    Public Class WindowWrapper
        Implements System.Windows.Forms.IWin32Window
        Public Sub New(ByVal handle As IntPtr)
            _hwnd = handle
        End Sub

        Public ReadOnly Property Handle() As IntPtr _
          Implements System.Windows.Forms.IWin32Window.Handle
            Get
                Return _hwnd
            End Get
        End Property

        Private _hwnd As IntPtr
    End Class

Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube