cancel
Showing results for 
Search instead for 
Did you mean: 

Contentlist for frames

Experimenter
Experimenter

Hello everybody,

 

Can anyone tell me if there is a function in SimTalk to get a list of all the contents included in a frame other than using a for loop and the attributes Node(i) and NumNodes ?

 

The idea would be to have a function which can generate something similar to the contentlist attribute of some objects. Thus I could sort the table and filter it without having to check all the nodes of the frame.

 

Thank you in advance

14 REPLIES

Re: Contentlist for frames

Legend
Legend

You can create at the start the list you want, or if you prefer using a button.

for local i := 1 to current.NumNodes loop

Table[1,Table.Ydim+1] := current.node(i);

next;

Re: Contentlist for frames

Experimenter
Experimenter

@Alessio yes, this is how I am doing it right now, but I wondered if there was any way Plant Simulation makes it automatically.

Re: Contentlist for frames

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi SEATDF,

With the following method you can implement the feature in a reusable way:

param frame:object -> list

var ContentsList:list[object]
ContentsList.create

for var i := 1 to frame.numNodes
	ContentsList.append(frame.Node(i))
next

return ContentsList

It might make sense to implement this as a method of the frame. The problem is always that the more methods each objects has the more complex is its interface.

 

Regards,

Ralf

Re: Contentlist for frames

Experimenter
Experimenter

@RalfTobel as I was telling to @Alessio, this is how I am doing it right now, but I wondered if there was any way Plant Simulation makes it automatically.

Re: Contentlist for frames

Phenom
Phenom

have you yet checked the Frame methods

 

selectContents ,  selectionToClipboard ,  pasteClipboard ?

Re: Contentlist for frames

Legend
Legend

Just curiosity: why do you need an "automatic" feature? If you run the method only once at the beginning it won't affect the model performance.

Re: Contentlist for frames

Experimenter
Experimenter

We are currently developing a model which continously creates and deletes objects and, since the total number of objects is very large, I wanted to reduce computering time whenever I need to check them.

Re: Contentlist for frames

Experimenter
Experimenter

@simulator I thought about using them, but the frame's method pasteClipboard  actually paste all the selected objects before writing them into the table. So, every time I wanted to use these functions all the objects would become duplicated.

Re: Contentlist for frames

Phenom
Phenom

with .selectContents(false) you can deselect the contents