Submitted by 218156 on Tue, 01/28/2020 - 05:40
Forums:
Hello
In below Example I can Get the View Label on Parent View Of Section View (Thanks for posting This Example)
http://www.nxjournaling.com/content/nx-drawing-simplestepped-section-line
In Similar way, How can I get View Label On Parent view of Detail View, Can you Please help Me, Thanks In Advance
re: get label on parent of detail view
GTAC has a code sample (C#) here:
http://solutions.industrysoftware.automation.siemens.com/view.php?si=nx_...
Thanks for Reply, I am not
Thanks for Reply, I am not able to open this link, After login I am getting Message that "Access to the requested resource is forbidden" , can You please paste the code in this Journaling Site, Thanks In Advance
re: get label on parent of detail view
The code below (link in previous post) is GTAC document nx_api6015, the code (C#) was authored by Frank Berger.
using System;
using NXOpen;
using NXOpen.UF;
using NXOpen.Utilities;
public class ReportDetailParentLabel
{
public static void Main(string[] args)
{
Session theSession = Session.GetSession();
UFSession theUFSession = UFSession.GetUFSession();
ListingWindow theLW = theSession.ListingWindow;
int options = UFConstants.UF_SO_ASK_ALL_CHILDREN;
int nChildren;
Tag[] children;
View theView = null;
while (select_a_view(ref theView) == Selection.Response.Ok)
{
theLW.Open();
theLW.WriteLine("Selected View: " + theView.ToString());
theUFSession.So.AskChildren(theView.Tag, options, out nChildren, out children);
theLW.WriteLine(" Children: " + nChildren.ToString());
foreach (Tag child in children)
{
TaggedObject theChild = NXObjectManager.Get(child);
theLW.WriteLine(" Child: " + theChild.ToString());
try
{
int type;
int subtype;
theUFSession.Obj.AskTypeAndSubtype(child, out type, out subtype);
if (type == UFConstants.UF_drafting_entity_type &&
subtype == UFConstants.UF_draft_label_on_parent_subtype)
{
NXObject[] oneObject = new NXObject[1]{theView};
theSession.Information.DisplayObjectsDetails(oneObject);
}
}
catch (NXException ex) {/*The first parameter passed in was invalid*/ }
}
}
}
public static Selection.Response select_a_view(ref View theView)
{
TaggedObject selobj = null;
Point3d cursor = default(Point3d);
Selection.MaskTriple[] mask =
{ new Selection.MaskTriple(UFConstants.UF_view_type, UFConstants.UF_all_subtype, 0) };
Selection.Response resp = UI.GetUI().SelectionManager.SelectTaggedObject(
"Selection", "Select a Detail View",
Selection.SelectionScope.WorkPart, Selection.SelectionAction.EnableSpecific, false,
false, mask, out selobj, out cursor);
if (resp == Selection.Response.ObjectSelected | resp == Selection.Response.ObjectSelectedByName)
{
theView = (View)selobj;
return Selection.Response.Ok;
}
return Selection.Response.Cancel;
}
}
Thank You
Thank You