cancel
Showing results for 
Search instead for 
Did you mean: 

Storing an object in a List

Pioneer
Pioneer

Hi,

 

I have a Table in Drawing and it contains Points details like Name and its coordinates (these points were selected by user) .

 

I would like to update the coordinates of points once the file is reopened.

If any of points were deleted means, the points details from table has to deleted. 

 

I wonder is there any way of storing this points object itself directly in a List (expression or in Knowledge Fusion), so that, the next time file is reopened i can run a journal and reupdate the table.

 

I had worked in CATIA, and CATIA has got this functionality. So i think there might be some sort of way of achiving this.

 

Regards,

Maddy

Windows 7 x64
NX 8.5, NX 9.0. And also NX 7.5
Visual Studio 2010 SP1, 2012 Update 4
10 REPLIES

Re: Storing an object in a List

Esteemed Contributor
Esteemed Contributor

Which NX release? (Add your environment to your signature, then we don't have to ask repeatedly Smiley Wink )

 

There is a hole table object, which should do this automatically.

It must be enabled through an environment variable in NX 6 and higher, see the NX documentation for further details.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX12.0

How to Get the Most from Your Signature in the Community

Re: Storing an object in a List

Esteemed Contributor
Esteemed Contributor

If the hole table doesn't work, you can do this with UDOs (User defined objects) but it may involve a fair bit of code.  Possibly one UDO object type for each point, then another one for the table itself.

 

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Storing an object in a List

Genius
Genius

I'm also trying to store objects in a list specifically with datum planes in python in NX10. Once I figure it out I'll post my code

 

some initial attempts

plane_list=[]

plane_list.append(Myobject())

 

or

 

plane_list = [plane_class(count) for count in range(1,30)]

Re: Storing an object in a List

Siemens Phenom Siemens Phenom
Siemens Phenom

I don't really see the problem. In the table, you have the names of the points. Given a name, you can find the point object, get its (possibly new) coordinates, and update them in the table. If you can't find the point, it means it has been deleted, so you should remove the entry from the table.

 

You need to get the "update" code to run when a part file is opened. You can do this through a User Exit (an maybe other ways, too).

山田
yamada

Re: Storing an object in a List

Pioneer
Pioneer

Hi Yamda,

 

The point here is, if the user has selected the points from two different parts from an assembly.

And both points has 

case 1: Distinct Names

                So when this is the case, then i need to loop through all the points from all the components to find the points, which is time consuming.

 

Case2: Same Names

               In this case it is difficult to find out the points, even if the points are present in same part file or in two different part files.

 

                Rather than these cases, if i can store the point object itself in a list, which i can user later (part file closed and reopened in a different session), then i can directly fetch the correspoding documnet very easily.

 

I know im a bit superstitious, but i would like the journal to be robust.

 

Thanks and Regards,

Maddy

Windows 7 x64
NX 8.5, NX 9.0. And also NX 7.5
Visual Studio 2010 SP1, 2012 Update 4

Re: Storing an object in a List

Siemens Phenom Siemens Phenom
Siemens Phenom

It seems to me that this is a different problem from the one the OP had.

 

He was trying maintain a list of points that was persistent across sessions.

 

Your list doesn't seem like it needs to be persistent at all. It seems like you're just trying to make a transient list of objects -- the lifetime of the list is just the lifetime of your program. In Python, you could use either a list or a tuple. But tuples are immutable (can't be changed, once created), so I would guess that a list would be better for you. So, you write things like:

 

myList = [ obj1, obj2, obj3 ]
myList.Append(obj4)

 

山田
yamada

Re: Storing an object in a List

Pioneer
Pioneer

Hi Yamda,

 

Yes i now about the list's lifetime is just my programs life time.

 

But CATIA has got this functionality where in which we can store objects in lists, which can be retained across sessions.

So i think there might be some way to achieve the same. (may be by Fusion or by any means)

 

Thanks and Regards,

Maddy

Windows 7 x64
NX 8.5, NX 9.0. And also NX 7.5
Visual Studio 2010 SP1, 2012 Update 4

Re: Storing an object in a List

Siemens Phenom Siemens Phenom
Siemens Phenom

If you want a list that's persists across sessions, there are several ways to do this, as others have mentioned.

 

One further suggestion:

Name the objects, and then put the names in a part attribute. Specifically, you can create an attribute whose value is an array of strings that can represent the object names.

山田
yamada

Re: Storing an object in a List

Pioneer
Pioneer

Thanks Yamda,

 

I was having this in mind (storing names in an attribute). But thought of looking for some other alternative methods.

 

Thanks alot Guys,

 

Will check on all the possibilities and come back here.

 

Regards,

Maddy

Windows 7 x64
NX 8.5, NX 9.0. And also NX 7.5
Visual Studio 2010 SP1, 2012 Update 4