Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross 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
Sep 30, 2011
46
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);
}
}
}}
 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top