Reply
Solved! Go to solution

Append MenuItem / Access Pathfinder programmically

Hey there,

 

I'm trying to write an Add-In which integrates into the Pathfinder. First I want to access the Pathfinder and get information about the selected part, so it should return me something like SolidEdgeFramework.SolidEdgeDocument. Secondly, I'd like to append a MenuItem to the menu which appears when I right-click a part in the Pathfinder.

I'm failing with both, I can't find any interfaces for the Pathfinder, nor could I figure out how to edit menus in SolidEdge. Is it even possible?

 

Thanks in advance,

Jonas

8 REPLIES

Re: Append MenuItem / Access Pathfinder programmically

Jonas,

 

please have a look at the addin samples under Solid Edge Samples on Codeplex.

There is one sample addin (SolidEdge.AddIn.EdgeBar) which might help you how to use the edgebar. You will probably display the occurrences in a treeview on your edgebar and add there the specific menu item in a popup menu.

Re: Append MenuItem / Access Pathfinder programmically

Jonas,

 

That's a good question. I don't currently have any examples on CodePlex to do what you're asking but this would be a good one to add if I can figure it out. I'll give it a go and reply back with the results.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Append MenuItem / Access Pathfinder programmically

AFAIK, there is no API to add a menu item to the popup menu on the SE PathFinder. That's why I suggested to create your own edgebar with your own popup handler.

There is a BuildMenu event in SE, which works well in the graphic area and can be used to add a context specific menu item.

We use this in Solid Edge Mold Tooling and Electrode Design.

Re: Append MenuItem / Access Pathfinder programmically


MartinBernhard wrote:

AFAIK, there is no API to add a menu item to the popup menu on the SE PathFinder. That's why I suggested to create your own edgebar with your own popup handler.

>>Thats an interesting approach, however, it would reduce the usabilty as you have to switch pages in the Edgebar and search the part in the treeview. The goal of the Add-In is to improve usability, e.g. opening the draft of a part from within the assembly environment.

There is a BuildMenu event in SE, which works well in the graphic area and can be used to add a context specific menu item.

We use this in Solid Edge Mold Tooling and Electrode Design.

>>This is interesting. It doesn't _have_ to be the Pathfinder, the graphics area would do the job as well. If its possible to add menu items to the menu in the graphics area, that would fit my needs as well. I'll look into that.


 

Re: Append MenuItem / Access Pathfinder programmically

I just recognized that the BuildMenu event handler is also called when hitting the RMB in the PathFinder.

So you should be able to do what you want ;-)

Re: Append MenuItem / Access Pathfinder programmically

Here is what confuses me:

 

 public void BuildMenu(string EnvCatID, SolidEdgeFramework.ShortCutMenuContextConstants Context, object pGraphicDispatch, out Array MenuStrings, out Array CommandIDs)
{
MenuStrings = new string[] { "Test" };
CommandIDs = new int[] { 10941 };
}

 

I would suspect the MenuStrings and CommandIDs arrays to contain the menu entries of the context menu that is about to pop up, but instead the arrays are null (so I can't append any entries). Creating new arrays as shown in the code above does nothing. Any hints on how this is supposed to work?

 

Regards

Jonas

Solution
Solution
Accepted by topic author freijon
‎08-26-2015 04:32 AM

Re: Append MenuItem / Access Pathfinder programmically

I don't have an addin in C#, but I am creating the string and ID arrays in native C++ and return them. It is important that you use your command IDs, and not the ones SE assigns to a command.

 

After returning the arrays, Solid Edge is adding these items (or submenu) to the existing context menu items.

If you return Nothing, the default popup menu will be displayed.

Re: Append MenuItem / Access Pathfinder programmically

Thanks, I solved the problem. I made two mistakes:

  •  I used the CommandID property of the control, but you need the SolidEdgeCommandId (for those who work with Jasons SolidEdgeCommunity library)
  • I didn't register the needed environments

Thanks for your assistance.