Showing results for 
Search instead for 
Did you mean: 

How to create an associated Point through Code which can be accessed through Part NAVIGATOR




Im confused on how to create an ASSOCIATED / Linked point through code, which i can access through Part Navigator later.


This may looks silly, but im a noob with NXOpen, and gaining knowledge.


I did tried a code available in GTAC " create smart line with point constructor"


//Sample NX Open .NET C# program : create smart line with point constructor
using System;
using NXOpen;
using NXOpen.Features;
using NXOpen.Utilities;
using NXOpen.UF;

public class create_smart_line_with_point_constructor
    public static UFSession theUFSession;
    public static Session theSession;
    public static ListingWindow theLW;

    public static void Main(string[] args)
        theSession = Session.GetSession();
        theUFSession = UFSession.GetUFSession();
        theLW = theSession.ListingWindow;
        Part workPart = theSession.Parts.Work;

        NXOpen.Session.UndoMarkId markId1;
        markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start");

        Tag[] tPoints = new Tag[2];
        if( (select_point("Select Start Point", ref tPoints[0]) == UFConstants.UF_UI_OK) && 
            (select_point("Select End Point", ref tPoints[1]) == UFConstants.UF_UI_OK) )
            Tag tLine = Tag.Null;

			// The the default update option for the legacy UI_UI_point_construct() function is UF_SO_update_after_modeling 
			// and those smart points cannot be used as input for any current features like Line, Spline, etc. (see PR-6736402)

			// If we delete the SO parent data from the points, it won't be associative any more:
			//            theUFSession.So.DeleteParms(tPoints[0]);
			//            theUFSession.So.DeleteParms(tPoints[1]);
			//            theUFSession.So.CreateLineTwoPoints(tPoints[0], UFSo.UpdateOption.UpdateWithinModeling, tPoints, out tLine);

			// If we just need the line without further children, we can update it after modelling:
            theUFSession.So.CreateLineTwoPoints(tPoints[0], UFSo.UpdateOption.UpdateAfterModeling, tPoints, out tLine);
            theUFSession.So.SetVisibilityOption(tLine, UFSo.VisibilityOption.Visible);

            SmartObject[] tObjects = { (SmartObject)NXObjectManager.Get(tPoints[0]),
            theLW.WriteLine( String.Format("{0,-20}{1,-20}\n", "Object", "UpdateOption") );
            for(int ii=0; ii<3;ii++)
            theLW.WriteLine( String.Format("{0,-20}{1,-20}\n", tObjects[ii].ToString(), tObjects[ii].Update.ToString()) );


    public static int select_point(string cue, ref Tag point_tag )
        double[] base_pt = new double[3];
        int response = 0;
        UFUi.PointBaseMethod base_method = UFUi.PointBaseMethod.PointInferred;

		theUFSession.Ui.PointConstruct( cue,
										ref base_method,
										out point_tag,
										out response);

        if( point_tag != Tag.Null)
            theUFSession.So.SetVisibilityOption(point_tag, UFSo.VisibilityOption.Visible);
        return response;


Tested Case:

       1. Created One circle (ZX Plane) and Rectangle (XY Plane) -- Both are Sketches.

       2. Compiled the above code and ran it.

       3. Selected circle for first point

       4. Selected One line out of 4 lines of Rectangle ( Used control point option in point constructor)

       5. Line created.

       6. Moved the rectangle to some distance inside sketch.

       7. Line was associated.


But Points created (Visible in Graphics) were not visible in Part Navigator Tree.



1. How can i create a point which can be accessible through Part Navigator?.

2. Is there any other ways to create associated Point based on the element user select, If yes How???.






Windows 7 x64
NX 8.5, NX 9.0. And also NX 7.5
Visual Studio 2010 SP1, 2012 Update 4

Re: How to create an associated Point through Code which can be accessed through Part NAVIGATOR