Extending Unigraphics NX using C# (III) Accessing entities

29 Jan

In Unigraphics, there are two files which are especially for programmers.

  1. The .net reference, in the folder %UGDir\UGDOC\html_files\nxopen_net_ref.chm, which contains all the class references;
  2. The .net programming guide, in the folder %UGDir\UGDOC\html_files\nxopen_net_ref\index.htm .

The 2nd is esp. useful at the initial programming stages.

For instance, in the programming guide, it is clearlly noted the methods of retrieving the entities:


  • NX session → list of parts

  • part → list of solid bodies

  • solid body → list of faces

    solid body → list of edges

  • face → list of associated edges

    face → solid body

  • edge → list of associated faces

    edge → solid body

Using this, it is very easy to access the entities:

            theSession = Session.GetSession();
            PartCollection sessionParts = theSession.Parts;
            foreach (Part p in sessionParts)
                if (p.IsFullyLoaded)
                    TreeNode PartNode =new TreeNode(p.Leaf);
                    foreach (Body body in p.Bodies)
                        TreeNode BodyNode=new TreeNode(body.JournalIdentifier);
                        BodyNode.Tag = body;

1 Comment

Posted by on January 29, 2010 in CAD, Dotnet/C#


One response to “Extending Unigraphics NX using C# (III) Accessing entities

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: