SE ST8 plug-in problem

Valued Contributor
Valued Contributor

Hello

 

Im making a Se add-in,  got this far that I got plugin registered and it can be seen in SE adins.

But it does not react to eny events.

Visual studio 2010 and .net 4.0

Here is some code:

 

public void OnConnection(
object Application,
SolidEdgeFramework.SeConnectMode ConnectMode,
SolidEdgeFramework.AddIn AddInInstance
)
{
m_addin = AddInInstance;
m_application = (SolidEdgeFramework.Application)Application;
AddInInstance.GuiVersion = 1;
try
{
m_appevents = (SolidEdgeFramework.ISEApplicationEvents_Event)m_application.ApplicationEvents;
m_appevents.AfterDocumentOpen += new SolidEdgeFramework.ISEApplicationEvents_AfterDocumentOpenEventHandler(m_appevents_AfterDocumentOpen);
m_appevents.AfterNewDocumentOpen += new SolidEdgeFramework.ISEApplicationEvents_AfterNewDocumentOpenEventHandler(m_appevents_AfterNewDocumentOpen);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show("Error loadding the addin" + ex.Message.ToString());
}
}

 

void m_appevents_AfterNewDocumentOpen(object theDocument)
{
try
{
System.Windows.Forms.MessageBox.Show("Voisitko toimia?"); // (it reads: Could you please work?) Smiley Happy
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show("Error m_appevents_AfterDocumentOpen " + ex.Message.ToString());
}
}

 

 

4 REPLIES

Re: SE ST8 plug-in problem

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Did you solve this?

Are there any other addins installed?

LMGi
www.TLMGi.com

Re: SE ST8 plug-in problem

Valued Contributor
Valued Contributor

Hello

Some how but Im having a second problem.

Adding a button and functionality behind it.

 

This I have managed to do.

How to get those buttons active and ad functionality behind them?

 

public void OnConnectToEnvironment(
string EnvCatID,
object pEnvironmentDispatch,
bool bFirstTime) {


Guid envGuid = new Guid(EnvCatID);
SolidEdgeFramework.Environment environment = (SolidEdgeFramework.Environment)pEnvironmentDispatch;


// Allocate room for required arrays for CommandBars.
Array commandNames = Array.CreateInstance(typeof(String), 2);
Array commandIDs = Array.CreateInstance(typeof(int), 2);

// Populate arrays.
commandNames.SetValue("cmdOpen File\n\nOpen File Description\nOpen File", 0);
commandNames.SetValue("cmdButton2\n\nButton2 Description\nButton", 1);

commandIDs.SetValue(101, 0);
commandIDs.SetValue(102, 1);

// Call SetAddInInfo
m_addin.SetAddInInfo(
Marshal.GetHINSTANCE(this.GetType().Module).ToInt32(),
EnvCatID,
"Loader",
101,
102,
-1,
-1,
2,
ref commandNames,
ref commandIDs);


if (bFirstTime)
{
m_addin.AddCommandBarButton(EnvCatID, "Open File", 101);

m_addin.AddCommandBarButton(EnvCatID, "Loader", 102);

}



}

Re: SE ST8 plug-in problem

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I provide Visual Studio templates to create Solid Edge Addins in .NET. Here is a video: Solid Edge Community Templates Quick Start. The templates use NuGet packages that I offer to make all of this much easier. If you don't want to use the templates and NuGet packages, all of the source code is open source. See SolidEdge.Community.AddIn on GitHub.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: SE ST8 plug-in problem

Valued Contributor
Valued Contributor

Hello

 

Thanks for answer, I did dowloaded those earlyer.

But I did not find eny reference to AddCommandBarButton.

 

I did but up a new thread for this, if you have any advice plese write for that thread.