FileUIEvents.OnPlacePartUI

Hi all,

I had an old VB6 in which i could simulate a Place Part command from my own application.

That was using oFUIevents.OnPlacePartUI. It worked well:

Now i'm using VB 2010 and the equivalent code would be this:

--------------------------

Public Class Form1

Dim oSe As SolidEdgeFramework.Application

Dim oASM As SolidEdgeAssembly.AssemblyDocument

 

Dim WithEvents oFUIevents As SolidEdgeFramework.FileUIEvents

 

'When the textbox changes i start the "Place Part" command

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

oSe.StartCommand(SolidEdgeFramework.SolidEdgeCommandConstants.seAssemblyPlacePartCommand)

End Sub

 

'When the Place Part command starts i can define the part filename and it do a "Place Part" command with my settings.

Private Sub oFUIevents_OnPlacePartUI(ByRef Filename As String, ByRef AppendToTitle As String) Handles oFUIevents.OnPlacePartUI

Filename = "c:\temp\part1.par"

End Sub

End Class

------------------------

 

Well, VB 2010 finds an error in the "Dim WithEvents..." line, translating from Spanish it says something like:

 

Interoperatibility Type 'FileUIEvents' cannot be used because the 'Guid' attribute is missing.

 

Any help would be appreciated.

Thanks in advance,

Julian Guillo

Pixel Sistemas SL

Spain

 

Posted by: Julian Guillo
Post date: 3/29/2012 3:19:46 AM

2 REPLIES

Re: FileUIEvents.OnPlacePartUI

Julian,

 

to avoid the error you must not embed the Solid Edge COM Interop types. Embedding COM Interop is the default in VB/C# 2010. You can change it by selecting each COM Interop reference in you project (requires to make all files visible) and then check the property "Embed interop types" and set it to false.

 

Posted by: Wolfgang Kunert
Post date: 3/29/2012 11:56:14 AM

Re: FileUIEvents.OnPlacePartUI

Hi,

I was too optimist saying it was working perfectly because it just compiled well.

After doing some tests i realized that the OnPlacePartUI event is NOT fired and Solid Edge (ST4 MP4) shows a message box saying something like this (translated from Spanish):

 

"You must use the Library tab in Edgebar to add parts to the assembly.

Activate Edgebar or Main toolbar in Tools menu"

(not very clever, uh?)

 

The most funny thing is that i tested again my old, equivalent VB6 program and it works like a charm!!!

 

Can someone send me a code snippet or tell me what i'm doing wrong?

Thanks in advance,

Julian

 

Posted by: Julian Guillo
Post date: 3/30/2012 6:39:21 AM