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

User Defined Objects(UDO) in NXOpen

Hi All,

Can ayone help me to create a UDO to store mutidimensional arrays. I am able to store one dimensional arrays in UDO but not muti dimensional.

 

Thanks

4 REPLIES

Re: User Defined Objects(UDO) in NXOpen

It seems the calls currently available both in Open C and the Common API only work with one-dimensional arrays of doubles.  You can submit an ER to ask for this functionality in some future release of the software, 

Re: User Defined Objects(UDO) in NXOpen

Thank you!!!!

 

I am trying to store number of string array in one udo object but I have seen that if I access that number of string array using (displayEvent.UserDefinedObject.GetStrings), it will give me only the last array.

 

Is there any way to store array by name so I can access the array by name from the udo object.

Solution
Solution
Accepted by topic author saddam
‎07-19-2016 04:20 AM

Re: User Defined Objects(UDO) in NXOpen

UDOs only have tha capacity to store 1 array of integers, 1 array of doubles, 1 array of strings etc.

There are 2 ways to store more complicated data structures:

 

Use multiple UDO instances:

  1. Have a main UDO instance that holds an array of strings that are names of arrays that you would like to access
  2. Have another UDO instance for each of the members of the array in the main UDO
  3. Create an object link between the main UDO and the other UDOs
  4. To access a given array member look it up in the main UDO string array to get it's index, navigate to the linked UDO by using the index in the links array, then read the string from the other UDO
  5. Beware when using this method that if any of the UDOs that hold the data get deletedthe string array in the main UDO will not automatically get updated. Things can get very corrupt very quickly.

 

Simulate sub-arrays in the string array:

  1. When you store the data, format a string to represent each string array, for instance "{A,B,C,D}"
  2. Store each formatted 'array' into the UDOs string array, so the UDO string array would hold:
    "{A,B,C,D}" , "{ME,YOU,US}" , "{SOME,OTHER,DATA}"
  3. When reading the data, parse the formatted array to extract the data

 

I've used both of these in the past. Hope that helps.

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5

Re: User Defined Objects(UDO) in NXOpen

I am getting an "exception" -- "You do not have permission to query this class id."

when trying to access the saved UDO.

 

Exception is thrown at call

"theSession.UserDefinedClassManager.GetUserDefinedClassFromClassName("MYUDO")"

 

This only happens when its a new NXSession (UI is closed and re-opened), in the same session when document is closed and re-opened the exception is not thrown and I am able to access the saved UDO.

 

"AllowQueryClassForName" is also "ON" during save.

udoclass.AllowQueryClassFromName = UserDefinedClass.AllowQueryClass.On;