Inventor Customization

Reply
Mentor
GVDB
Posts: 215
Registered: ‎01-16-2006
Message 1 of 4 (166 Views)
Accepted Solution

showing form interupt user interaction

166 Views, 3 Replies
01-28-2013 01:37 AM

Hi,

 

I'm writing an automatic ballooning program from out the partlist inside a vb.net 2010 addin. (INV 2013)

I'm nearly there but have just one problem.

When starting the routine a form with only a label (message) in it is showed. Just to inform the user!

Then the ballooning command is started. The user can cancel this piece of ballooning by clicking ESC.

 

But the problem is that the user first must click anywhere in the screen to activate inventor before he can click ESC

Why is that? Has the form still have the focus? How can I solve this problem.

 

Geert

 

Here is a snipset of my code:

  

Public Sub AutomaticBallooning() 

Try

Dim frmPartlistRowMessage AsNewfrmMessage

Dim strPartlistRowText AsString = "TEST  -> press [ESC] to cancel ballooning and for other options!"

frmPartlistRowMessage.Show()

frmPartlistRowMessage.labMessage.Text = strPartlistRowText

modGeneral.AlwaysOnTop(frmPartlistRowMessage, True)

           

'call balloon commando and wait till it's done

Dim oControlDef As Inventor.ControlDefinition

oControlDef = m_inventorApplication.CommandManager.ControlDefinitions.Item(

"DrawingBalloonCmd")

           

Try

      oControlDef.Execute()

Catch ex AsException

EndTry

           

DoWhile m_inventorApplication.CommandManager.ActiveCommand = "DrawingBalloonCmd"Or m_inventorApplication.CommandManager.ActiveCommand = "InteractionEvents"

                m_inventorApplication.UserInterfaceManager.DoEvents()

Loop

       

Catch ex AsException

EndTry

end sub

 

PublicSub AlwaysOnTop(ByVal frmobject As System.Windows.Forms.Form, ByRef Status AsBoolean)

Try

If Status = TrueThen

       frmobject.TopMost = True

Else

        frmobject.TopMost = False

EndIf

       

Catch ex AsException

EndTry

EndSub

 

Employee
nagwani
Posts: 33
Registered: ‎11-17-2011
Message 2 of 4 (153 Views)

Re: showing form interupt user interaction

01-28-2013 09:49 PM in reply to: GVDB

Hi There,

 

Setting the owner of form as Inventor frame window should solve this problem.

 

frmPartlistRowMessage.Show(New WindowWrapper(m_inventorApplicationMainFrameHWND))

 

The WindowWrapper class is given below.

 

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

 

-Ishwar

Mentor
GVDB
Posts: 215
Registered: ‎01-16-2006
Message 3 of 4 (145 Views)

Re: showing form interupt user interaction

01-28-2013 11:39 PM in reply to: nagwani

Hi Ishwar,

 

thanks for your reply.

I already had tried setting owner with this code with no result:

Dim owner AsNew System.Windows.Forms.NativeWindow

owner.AssignHandle(m_inventorApplication.MainFrameHWND)

oFormMessage.Show(owner)

 

I tried your way with the WindowWrapper class but unfortunately also with no result!

It seems that showing a form inactivates Inventor till user clicks into the screen.

 

other suggestions?

 

Geert

 

 

Mentor
GVDB
Posts: 215
Registered: ‎01-16-2006
Message 4 of 4 (137 Views)

Re: showing form interupt user interaction

01-29-2013 02:14 AM in reply to: GVDB

Sometimes the solution is right in front of you but you don't see it.

 

Just put -> AppActivate(m_inventorApplication.Caption) to it and there you go.

 

Problem solved!

 

Geert

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