ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
How can I search for written codes in a model?
Hello,
I have a model that is written by another person and now I would like to take a look at all his code. I am looking for a way to find all the code he has written here and there in objects. Is it possible? because Flexsim objects come with some default code like I am looking for a way to see only all the the code that is different from normal default code (default code is like the example above which already exists upon object insertion in the model.) How can I find out the place of all the written code by a user? Is there someway like VisualBasic that all the code written by programmer can be seen at one place for a better control? if my question is not clear, let me know |
#2
|
||||
|
||||
Execute this in a script window. This isn't perfect, but it will get you started. It checks variables to see if they are different than the defaults on the class object in the library, so any variables that have been edited (through custom code or changing the pick option) will show up.
Maybe someone else has a better idea, but this came to mind when you asked the question so I coded it up real quick. Good luck. Code:
forobjecttreeunder(model()) { if(getdatatype(a) == DATATYPE_OBJECT) // if it is an object { if(!comparetext(getname(a),"TaskExecuterFlowItem")) // skip the task executer flowitem { treenode class = classobject(a); for(int v=1; v<=content(variables(a)); v++) // loop through the object's variables { string varname = getname(rank(variables(a),v)); treenode classvar = getvarnode(class,varname); treenode superclass = node(">superclasses/1+",class); while(!objectexists(classvar) && objectexists(superclass)) // check the superclasses for variables if they aren't on the class { class = superclass; classvar = getvarnode(class,varname); superclass = node(">superclasses/1+",class); } string classvartext = getvarstr(class,varname); string myvartext = getvarstr(a,varname); if(!comparetext(classvartext,myvartext)) // if the text doesn't match the class's variable text { applicationcommand("outputconsole"); pt(nodetopath(rank(variables(a),v),1));pr(); } } } } } |
The Following 3 Users Say Thank You to Phil BoBo For This Useful Post: | ||
Jörg Vogel (03-15-2012) |
#3
|
|||
|
|||
Late answer - this might also bring you further
http://www.flexsim.com/community/for...ead.php?t=1149 |
The Following User Says Thank You to Jens Mühlheimer For This Useful Post: | ||
shafizad (05-21-2012) |
Tags |
code |
Thread | Thread Starter | Forum | Replies | Last Post |
Search for cell and value | Jens Mühlheimer | Q&A | 8 | 03-13-2012 03:20 AM |
Search function | Nico Zahn | Q&A | 2 | 10-23-2010 02:04 AM |
Understanding Flexsim Network Error Codes | Jorge Toucet | Installation | 0 | 11-02-2008 05:46 PM |
Search and replace | Nico Zahn | Gripes and Goodies | 0 | 05-19-2008 01:54 AM |