Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NXOpen MenuBar MenuButton

Status
Not open for further replies.

Zoes

Mechanical
Joined
Sep 30, 2011
Messages
46
Location
GB
Hi there,

Any ideas mapping menu buttons to c# with NXOpen? I thick I'm on the right track but I'm not sure. The code below tries to map the menu button "Create Rectangle" to a window forms button:

namespace sth
{
public partial class Someform : Form
{
public NXOpen.UI theUI = NXOpen.UI.GetUI();
public Session theSession = Session.GetSession();
public UFSession theUfSession = UFSession.GetUFSession();
public NXOpen.Session.UndoMarkId Id2;
public int nErrs1;
public DisplayModification displayModification1;
public Part workPart;
public Part displayPart;
public NXOpen.MenuBar.MenuButton myButton;

public Someform()
{
InitializeComponent();

workPart = theSession.Parts.Work;
displayPart = theSession.Parts.Display;

NXOpen.MenuBar.MenuButton myButton = theUI.MenuBarManager.GetButtonFromName("Create Rectangle");
this.myButton = form_btn;

}

private void form_btn_Click(object sender, EventArgs e)
{

try
{
// Update part
theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Create Rectangle");
nErrs1 = theSession.UpdateManager.DoUpdate(Id2);

lw.WriteLine("button clicked" + "\r\n");
}
catch (Exception ex)
{
MessageBox.Show("Error is : " + ex);
}
}
}}
 
Anyone?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top