Find all references of object

Find all references of object

steven_chen1
Not applicable
20 Views
6 Replies
Message 1 of 7

Find all references of object

steven_chen1
Not applicable

[ FlexSim 20.1.2 ]

Hello,

Is there a possible way to find out all references to an object?

Let's say we have an object "Model/Source1", the following objects reference source1 in different ways:

By connection : Queue1.inObjects[1]

29842-01.png

By node path : Operator1's home location "Model.find("Source1")"

29833-02.png

By pink name : Event-Triggered Source object

29824-03.png

How could I have a better picture to understand the relation between objects?

0 Likes
Accepted solutions (1)
21 Views
6 Replies
Replies (6)
Message 2 of 7

tanner_p
Not applicable

@steven.chen,

I'm not sure what your question is. You have pointed out a handful of ways to reference objects, and I think that's good. But, I'm not sure how I can answer this question. Was this perhaps meant to be a suggestion for a page in the User Manual that discusses how to reference objects? Is there a specific way that you'd like to reference an object besides connection, node path, and pointer references?

0 Likes
Message 3 of 7

joerg_vogel_HsH
Mentor
Mentor

@tanner.p, I think, Steven wants to search recursively all pointers linked to an object in the tree. Where ever there is link he wants to count him, get the source code node path or just the name of the node.

0 Likes
Message 4 of 7

tanner_p
Not applicable

Thanks for the clarification, Jörg. I don't know of any way to do what you've described, though. I bet you could write a script to go through the tree and find all the references, but it would be very time-intensive.

@steven.chen, what do you need to use the references for? Maybe we could determine a workaround.

0 Likes
Message 5 of 7

steven_chen1
Not applicable

When I takes over someone's model, it's hard to identify the purpose of an object. The object may be used in random activity of process flow, or receiving message sent from other objects. If I somehow decide to delete (or rename) the object, I will only know I messed up the model on exception shows up at runtime.

0 Likes
Message 6 of 7

brenton_king
Not applicable

@steven.chen

There is no possible way to find every object or block of code that could be referencing a given object because you can't guarantee the method that they used for the reference. I agree that that is a pain. That is one of the many reasons why Process Flow is great. It is very rare that I have dummy objects in the 3D model that have logic in them with my models. That obviously doesn't help decipher someone else's mess though. Knowing all of the possible ways an object can be referenced is the first step. Look for centerports especially. Then you can always do a tree search by the name of the object and see if they used that method in their code somewhere. This option only appears in quick properties when you have the tree open.

Image.png

0 Likes
Message 7 of 7

matt_long
Not applicable
Accepted solution

FlexSim doesn't have any built in way to find all references to an object like a compiler would have. Often references are dynamically created and accessed using labels. If the references use code like

Model.find("Source1")

then you can easily search for that using the quick properties Search panel in the Tree View.

If you're looking for pointer/direct references (pink text) as shown in your process flow image, you would need to write some code to search through all nodes in the tree.

Your best bet is to avoid deleting or renaming objects that you are not fully confident about what their purpose is.