ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 03-14-2012
shafizad shafizad is offline
ProcSim Consulting
 
Join Date: Jul 2010
Location: Switzerland
Posts: 75
Downloads: 18
Uploads: 0
Thanks: 90
Thanked 2 Times in 2 Posts
Rep Power: 126
shafizad is on a distinguished road
Default 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
treenode item = parnode(1);
treenode current = ownerobject(c);
/**First available*/
/** \nOpen all ports.*/

return 0 ;
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  
Old 03-14-2012
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

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  
Old 05-16-2012
Jens Mühlheimer Jens Mühlheimer is offline
Flexsim User
 
Join Date: Jul 2008
Location: Stuttgart, Germany
Posts: 140
Downloads: 8
Uploads: 0
Thanks: 40
Thanked 35 Times in 27 Posts
Rep Power: 174
Jens Mühlheimer will become famous soon enoughJens Mühlheimer will become famous soon enough
Default

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


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.