How can I label curves using NX Open C#?

529 Views Asked by At

I am new to NX Open journals and coding in general, and I have tried to accomplish something with studying, but now I am in need of some guidance.

I want to add code that will label these curves that it has found as just "Curve 1", "Curve 2", "Curve 3" , ... etc... on the actual Math model. How can I achieve this?

Something similar to an outcome of what I want is:

Wanted outcome

So far, I wrote the code of identifying the curves and counting how many total curves there are:

using NXOpen;
using NXOpenUI;
using System;

internal static partial class NXJournal
{
    public static void Main (){

        Session theSession = Session.GetSession();

        Part workpart = theSession.Parts.Work;

        int numCurve = 0;

        foreach (NXOpen.Curve cur in workpart.Curves) // Code for finding the facet bodies
        {
            numCurve = numCurve + 1; // Counting how many in layer # with color #

            // Put labeling code here

        }
        // Then it will repeat

        Guide.InfoWriteLine("This analysis has" + numCurve + ".");
    }
}

However, this code only adds up a total amount of curves and does not label them on the math model.

1

There are 1 best solutions below

0
On

In the code add where you are doing the foreach loop, just assign names to the curves.

  1. cur.SetName(). this will not be seen by the user. Unless you check for properties of the curve.
  2. You can use PMI notes and add labels to each curve