Execute macro windows popup when starting new SolidEdgeFramework.Command

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

In assemblies files I made a macro that allows user to move zoom and rotate the display but not selecting anything using SolidEdgeFramework.Command.

 

The user still have acess to the command of SolidEdge (RibbonBar)

 

When the user click on a button in the ribbonbar or the quickaccesstoolbar the SolidEdgeFramework.Command is ended then the macro ask him if he want to end the current macro or not.

 

If the user choose to continue we recreate a new SolidEdgeFramework.Command then if the button is a normal command of SolidEdge everything works fine else if the button is link to a macro, after we start the new SolidEdgeFramework.Command a window popup asking to select exe or dll to execute. (See ScreenShot)

 

Execute macro

 

Here is a part of the code :

 

              Dim QuitResult As MsgBoxResult = MessageBox.Show("Do you want to quit the macro ?", "Quit macro ?", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
                If QuitResult = MsgBoxResult.Yes Then
                    command_Terminate()
                Else
                  _command = _application.CreateCommand(CInt(SolidEdgeConstants.seCmdFlag.seNoDeactivate))
                  AddHandler _command.Terminate, AddressOf command_Terminate
                  _command.Start()
                  _application.DisplayAlerts = True
                  _mouse = _command.Mouse
                  _mouse.EnabledMove = True
                  _mouse.LocateMode = SolidEdgeConstants.seLocateModes.seLocateOff
                  _mouse.WindowTypes = 1
                  _mouse.EnabledDrag = False
                  _mouse.DynamicsMode = 0

                End If

 

Do you have any ideas on how to manage this issue.

 

Thanks

 

Romuald


Romuald BERTIN
2 REPLIES

Re: Execute macro windows popup when starting new SolidEdgeFramework.Command

Solution Partner Legend Solution Partner Legend
Solution Partner Legend

Romuald,

 

I'm a little bit confused by your code above and your notes done. In your code above you call command_Terminate() upon QuitResult is true. in your notes you're saying the command terminates as soon the user uses any button on the ribbon bar. So command_Terminate() should have been already executed. In case of QuitResult is false you assume command_Terminate() already has been executed and you create a new command without prior calling command_Terminate().

Might this cause the issue?

Kind regards,
Wolfgang Kunert - www.wksyspro.de

Re: Execute macro windows popup when starting new SolidEdgeFramework.Command

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Thanks Wolfgang,

 

You are right.

 

The code I put as example is not the current code and I made a mistake copying it here is the correct one :

 

Private Sub command_Terminate()
        Try

                Try
                    _mouse.ClearLocateFilter()

                    If _command IsNot Nothing Then
                        _command.Done = True
                    End If
                Catch ex As Exception
                End Try
                _mouse = Nothing
                _command = Nothing
 

                Dim QuitResult As MsgBoxResult = MessageBox.Show("Do you want to quit the macro ?", "Quit macro ?", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
                f QuitResult = MsgBoxResult.Yes Then
                    End
                Else
                  _command = _application.CreateCommand(CInt(SolidEdgeConstants.seCmdFlag.seNoDeactivate))
                  AddHandler _command.Terminate, AddressOf command_Terminate
                  _command.Start()
                  _application.DisplayAlerts = True
                  _mouse = _command.Mouse
                  _mouse.EnabledMove = True
                  _mouse.LocateMode = SolidEdgeConstants.seLocateModes.seLocateOff
                  _mouse.WindowTypes = 1
                  _mouse.EnabledDrag = False
                  _mouse.DynamicsMode = 0

                End If
        Catch ex As Exception

        End Try

    End Sub

 

Thanks

Romuald

 


Romuald BERTIN