How can I label a line in NX Open C#?

371 views Asked by At

How would I label these lines using coding?

I have already figured out how to identify and count up how many lines exist using this code:

using NXOpen;

using System;

public class FailedRegionCounting
{
    public static void Main()
    {

        Session theSession=Session.GetSession();
        Part workpart=theSession.Parts.Work;
 
        int numLine = 0;

        foreach (NXOpen.Curve tempFeat in workpart.Curves)

        {
            string name = tempFeat.Name;
            string a = "Line";           

            if (name.Contains(a))
            {
                numLine = numLine + 1;
            }    
        }
        Guide.InfoWriteLine("This analysis has " + numLine + " of Lines.");
    }
}

However, I would like to learn how I would label these lines on NX.

This is somewhat of a result I desire:

Enter image description here

1

There are 1 answers

0
NAGA REDDY On
  1. You can use PMI notes for achieving this.

  2. If you want to display temporary names, then there are some functions where you can create temporary Names for the curves.

     UFObj.DispProps props = new UFObj.DispProps();
     props.color = 186;
     double[] loc = {rcpPoint.X+5, rcpPoint.Y+5, rcpPoint.Z+5};
     theUFSession.Disp.DisplayTemporaryText(
         Tag.Null, UFDisp.ViewType.UseWorkView,
         inx.ToString(), loc, UFDisp.TextRef.Middlecenter, ref props, 10.0, 1);