Showing results for 
Search instead for 
Do you mean 
Solved! Go to solution

How to Use Wrapper Functions in C#

Hi All,

i need some Help with Wrapper Functions.

i want to use a Wrapper Function from NXOpen.UF.UFSo --> AskParents()


in The Documentation they say that to use a wrapper Function you have to  create an instance of the UFSession.

So what i did is :


TheUFSession = UFSession.GetUFSession();


is that right ?

And how can i use the wrapper Function ?


what i Did is :


public NXOpen.UF.UFSo Ask_Parents;



But i get always an error message because my Ask_Parents is null :/


Maybe somebody can help me Smiley Happy

Thank you very much in advance.


Accepted by topic author Ildon
‎05-24-2016 08:37 AM

Re: How to Use Wrapper Functions in C#

[ Edited ]

Once you have the UfSession initialized, you can use it like this:




The wrapped functions are grouped by category:

TheUFSession.Modl = modeling functions

TheUFSession.Assem = assembly functions

TheUFSession.Draw = drafting functions

etc, etc.

Re: How to Use Wrapper Functions in C#

[ Edited ]

You are almost there!


Try this:



Re: How to Use Wrapper Functions in C#

[ Edited ]



Re: How to Use Wrapper Functions in C#

thank you very much you two.

But if i debug the Code i get an Error Message that " The object being queried is not smart"
What does this mean and how can i fix that ?

Re: How to Use Wrapper Functions in C#

Not all objects in an NX part are "smart". You can use TheUFSession.So.Isso() to ask whether a given tag is referring to a smart object or not.

What kind of an object are you working with? Can you share more details about what you are trying to accomplish? Thanks!

Re: How to Use Wrapper Functions in C#

[ Edited ]

That error means that the object you passed in to the function is not a 'smart object' and the .AskParents function can't do anything useful with it.

Re: How to Use Wrapper Functions in C#

[ Edited ]

I have a list of Feature Tags, and i'm passing one Tag (FeatureTag) to the AskParents Method.
And now i want to get all Parents of the Feature and list them.


The Object is only a curve. And this Curve has a lot of Parents. And i want to select all Parents.

TheUFSession.So.AskParents(FeatureTag, NXOpen.UF.UFConstants.UF_SO_ASK_ALL_PARENTS, out n_parents, out ParentTag)

Re: How to Use Wrapper Functions in C#

Like Steve said, not all objects are 'smart'. Open a model in NX and create a point in space (turn off the 'associative' option). No matter what happens to the model, the point stays put until you move or delete it. Create another point, turn the 'associative' option on this time and pick an end point of a model edge. Now when the model updates, the point updates with it. NX has created an associativity between the edge end point and the point object; the point is a smart object and the edge is one of its parents. The first point is just hanging out in space, it is a 'dumb' point.

Re: How to Use Wrapper Functions in C#

[ Edited ]

Is there a possibility to get the parents of a "dump" Object ?