Pedro Posted June 27, 2013 Share Posted June 27, 2013 Hi, can I get an object reference from a string with its name? Thanks! Link to comment Share on other sites More sharing options...
ASagan Posted June 27, 2013 Share Posted June 27, 2013 You might be able to use a search step to search for an object with the name. Usually its easier just to pass object references around than using string searching though... Link to comment Share on other sites More sharing options...
Pedro Posted June 29, 2013 Author Share Posted June 29, 2013 You might be able to use a search step to search for an object with the name. Usually its easier just to pass object references around than using string searching though... ... unless they come from an external information source to simio, where we haven't object references Link to comment Share on other sites More sharing options...
ASagan Posted June 29, 2013 Share Posted June 29, 2013 If its a table import, you can change the column type to be 'object' instead of 'string' once the table is initially set up -- it will remember this type on future imports. It might be possible to write a custom step that finds an object based on a string, too, if the search step doesn't work for you. Link to comment Share on other sites More sharing options...
MEagar Posted July 1, 2013 Share Posted July 1, 2013 Please support my post for arrays of type object...where each dimension can be of a different object type. Link to comment Share on other sites More sharing options...
allysonfrancis Posted October 18, 2019 Share Posted October 18, 2019 I had the opposite problem today (trying to get a string from an object reference) and I was able to use the .Name function to do so. I imagine you could check if the object's .Name function output matches the string. This post is very old but I wanted to post a reply here in case it helps someone. Link to comment Share on other sites More sharing options...
teresimio123 Posted February 19, 2020 Share Posted February 19, 2020 Hi Allyson! I am trying to get ModelEntity.CurrentStation as a string, and when I put ModelEntity.CurrentStation.Name it returns, for example, Processing if what I actually want is Filler63.Processing. Actually I only want Filler63 as a string but I don't know how to get that. Could you help me out? thanks!!! Link to comment Share on other sites More sharing options...
AndreVenter Posted March 9, 2020 Share Posted March 9, 2020 ModelEntity.PreviousNode.AssociatedObject.Name 1 Link to comment Share on other sites More sharing options...
jzhou Posted March 21 Share Posted March 21 On 7/2/2013 at 6:18 AM, MEagar said: Please support my post for arrays of type object...where each dimension can be of a different object type. I second this idea. If we can directly assign string name to a object-reference state variable, then use the object-ref state variable as the Object, it will be a lot helpful. String concat is a very good one, for example , ModelEntity go through NodeA, we define its next destination as NodeA_a .... Link to comment Share on other sites More sharing options...
Recommended Posts