Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX Open API help

Status
Not open for further replies.

Ram K

Mechanical
Apr 17, 2018
56
0
0
IN
Hi
I am trying to create NXOpen C# code to do an activity in drawings. In assembly drawings when a drafting curve(which in view) is selected the curve's original component name is to be returned by the code.
Attached image is the UI styler block image for selection of the curve. Below is the code with OK callback. In below code "OwningPart.Leaf" is returning the drawing file name instead of original component part file name of that assembly. Could some body suggest me the proper API to return the original component name of the drafting arc. Thank you in advance.


//------------------------------------------------------------------------------
//Callback Name: ok_cb
//------------------------------------------------------------------------------
public int ok_cb()
{
int errorCode = 0;
try
{
errorCode = apply_cb();
//---- Enter your callback code here -----
Session theSession = Session.GetSession();
Part wPart = theSession.Parts.Work;
Part dPart = theSession.Parts.Display;
ListingWindow lw = theSession.ListingWindow;
TaggedObject[] objs = selection0.GetSelectedObjects(); // selection0 is from UI block



lw.Open();

foreach (TaggedObject t in objs)
{
lw.WriteLine(t.GetType().ToString());

NXObject nb = t as NXObject;

lw.WriteLine(nb.OwningPart.Leaf);

lw.WriteLine("============================================================");

}



}
catch (Exception ex)
{
//---- Enter your exception handling code here -----
errorCode = 1;
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
}
return errorCode;
}
 
 https://files.engineering.com/getfile.aspx?folder=875d7065-a34a-4f85-bfdd-d09110ab12fa&file=30-07-2018_19-36-09.jpg
Status
Not open for further replies.
Back
Top