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 > User Development
Downloads

User Development User developed add-ons to Flexsim

  #1  
Old 11-05-2009
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default findInCode User Command

Sometimes it's fairly laborious going through your code & triggers when searching for some text, as the standard Find/Replace is printed to the console.

This user command lets you right-click a table of search results that it generates to edit the code directly. It also shows you on which line(s) in the code the text you're searching for is located (thanks Phil for pointing me towards the code for that).

You can use it in a script window like :
Code:
findInCode("objectexists");
If you specify a node as a second parameter it will only search from that point down in the tree, otherwise it will search through the model, including the /Tools folder. eg:
Code:
findInCode("TASKTYPE",node("/Processor",model()));
Just open this library into your libraries and it will autoinstall the user command into your model.

Have fun.

Jason
Attached Files
File Type: zip findInCode.zip (3.3 KB, 310 views)

Last edited by Jason Lightfoot; 11-06-2009 at 04:25 AM.
The Following 13 Users Say Thank You to Jason Lightfoot For This Useful Post:
zhang xin (11-06-2009)
  #2  
Old 11-06-2009
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

Jason,

Awesome.
The Following User Says Thank You to Phil BoBo For This Useful Post:
Jason Lightfoot (11-06-2009)
  #3  
Old 11-06-2009
Vincent Bechard Vincent Bechard is offline
Consulting in Simulation
 
Join Date: Oct 2008
Location: Montréal (Canada)
Posts: 28
Downloads: 0
Uploads: 0
Thanks: 4
Thanked 41 Times in 13 Posts
Rep Power: 165
Vincent Bechard will become famous soon enoughVincent Bechard will become famous soon enough
Smile Updated version

Hi,

Amazing!!!! This will increase productivity!

I modified it a little bit. Deprecated commands have been replaced by their current implementation, and the UserCommand can now be c++ compiled. This is very useful in my context, see thread: https://www.flexsim.com/community/fo...=newpost&t=542.

I strongly recommend to upgrade the find/Replace in Tree, for version 5.0.


Vincent Béchard, ing., M.Sc.A.
Simulation & optimization
__________________________
SNC-Lavalin Devonyx Inc.
360, St-Jacques O.
Montréal (Canada) H2Y 1P5
514-845-2166 #2204

**UPDATE** The attachments were lost in a server crash. These features have now been included natively in FlexSim Software, making this attachment obsolete.

Last edited by Ben Wilson; 11-19-2014 at 02:58 PM. Reason: attachments lost in server crash
The Following 5 Users Say Thank You to Vincent Bechard For This Useful Post:
Tom David (11-11-2009)
  #4  
Old 11-16-2009
Luciano Luciano is offline
Flexsim Distributor Italy
 
Join Date: Oct 2007
Location: Cuneo (IT)
Posts: 22
Downloads: 66
Uploads: 0
Thanks: 31
Thanked 27 Times in 9 Posts
Rep Power: 170
Luciano will become famous soon enough
Default Updated Version

Hi,

Thanks Jason and Vincent for the library.
Very Useful!

Attached a new version that open the code edit window also with a doubleclick on the selected cell of the results search table.

Luciano Cavallero
Flexcon s.r.l.
Viale Risorgimento, 16
I–10092 Beinasco (TO) - Italy
phone +39-011-19682600
fax +39-011-19682640
Attached Files
File Type: zip findInCode2.zip (3.7 KB, 250 views)
The Following 8 Users Say Thank You to Luciano For This Useful Post:
Tom David (11-16-2009)
  #5  
Old 11-17-2009
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default Update #3

Hi again and thanks for the feedback and help!

I've now marked the row of each result with S,C or D (or blank - see below) to indicate what type of node it is (flexscript,C or DLL).

I've also added findInText() which searches all string data nodes, not just those toggled as code. This is useful if you're using executefsnode or want to find text within scripts in GUIs. The 'non-code' node you want to edit will open in a tree view with the target as the head (and only) node. I haven't found a way to auto-mark the search text in the tree view for these types of nodes yet.

Also be warned that there are no Cancel functions when editing the tree directly (although closing the window without clicking away from the node may produce this effect), so this isn't for the faint hearted. I'd recommend sticking with findInCode unless you know you need findInText.

Jason
Attached Files
File Type: zip findInCode3.zip (4.5 KB, 236 views)
The Following 6 Users Say Thank You to Jason Lightfoot For This Useful Post:
Tom David (11-17-2009)
  #6  
Old 11-18-2009
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default update #4

I made a small addition to this superb usercommand. I added an openmodelinstall so that if you have this library loaded and you open a different model, the commands are automatically added so you don't have to load the library again to install those commands again.

Steven
Attached Files
File Type: zip findInCode4.zip (4.8 KB, 229 views)
The Following 5 Users Say Thank You to Steven Hamoen For This Useful Post:
Tom David (11-18-2009)
  #7  
Old 11-18-2009
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

Hi,

I found a bug that caused Flexsim to crach, Jason help me found what the problem was.
The problem was that I had a corrupt node in my model.

I add a check to check if a node is okay or not, using objectexists solved the problem.

Thanks Jason for put me in right direction.

Lars-Olof
Attached Files
File Type: zip findInCode6.zip (4.8 KB, 225 views)
The Following 5 Users Say Thank You to Lars-Olof Leven For This Useful Post:
Tom David (11-18-2009)
  #8  
Old 11-18-2009
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default Update #7

In this version the tree views also mark the lines of text containing the search string.
Attached Files
File Type: zip findInCode7.zip (4.9 KB, 230 views)
The Following 6 Users Say Thank You to Jason Lightfoot For This Useful Post:
Tom David (11-18-2009)
  #9  
Old 11-20-2009
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default Update #8

Great work Jason and all for joining in!

I tend to have a short memory so I made the following additions:
*the picklistedit window title displays the full path to the code
*column added to the search results table that reports when you have pressed the OK button on a given picklistedit.

Kris
Attached Files
File Type: zip findInCode8.zip (5.2 KB, 239 views)
The Following 6 Users Say Thank You to Kris Geisberger For This Useful Post:
Tom David (11-20-2009)
  #10  
Old 11-23-2009
Vincent Bechard Vincent Bechard is offline
Consulting in Simulation
 
Join Date: Oct 2008
Location: Montréal (Canada)
Posts: 28
Downloads: 0
Uploads: 0
Thanks: 4
Thanked 41 Times in 13 Posts
Rep Power: 165
Vincent Bechard will become famous soon enoughVincent Bechard will become famous soon enough
Smile findString UserCommand

Hi,

Following to the posts on the wonderful findInCode command, here is a lighter version
derived from version 8.

The changes are:
- all C++ nodes were tagged "D"; switch_cppfunc was used instead of switch_dllfunc for detecting DLL nodes
- the right-click Edit Code option (menupopup) is removed; double-clicking on the row is so nice!
- some deprecated flexscript functions are replaced; findString now C++-compiles successfuly
- there is only one User Command which dows everything

Here is the findString description:
Search for the string "searchtext" in the subtree of startnode.
If the flag alltexts is 0, search is limited to nodes toggled as code (FS, C++, DLL).
If the flag alltexts is 1, search is extended to any node containing string data.

The results table tells if the node containing searchtext is FS, C++, DLL or string
data (F, C, F, or blank in row header, respectively).
Double-click on a row of the results table to edit the code.
If OK is pressed after editing the node, a OK word will appear in column 2.

Enjoy!

**UPDATE** The attachments were lost in a server crash. However, these features are now built in to FlexSim as of 2014.

Last edited by Ben Wilson; 11-19-2014 at 02:56 PM. Reason: attachments lost in server crash
The Following 3 Users Say Thank You to Vincent Bechard For This Useful Post:
Tom David (11-23-2009)
  #11  
Old 11-27-2009
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Hi Guys,

I just try to use our command to find something. I looked for "ROUNDNUM" which is a macro used in the Fluids. Our command just came up with 1 hit in a user command in the model (which is the one I was working on) but the Flexsim find/replace command came up with 9 hits.

So something is not 100% ok here. If somebody has to time to look into it, please be my guest.

Steven
  #12  
Old 11-29-2009
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

Steven did you use findInText ? This searches all the nodes with string data and should give the same results.

If you used findInCode and had user commands with the macro name in the command's code it would find those, but if the macro is referenced in the example of the user command, it wouldn't find those - so you would see a difference.

I tried this in a model I have with the macro DISPATCHER and findInCode found 35 references while findInText found 928 - the same as the standard Find and Replace in Flexsim.
  #13  
Old 11-30-2009
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Hi Jason,

I used all commands. If you startup Flexsim blank and add the library and type: findInText( "ROUNDNUM", maintree()) you end up finding nothing.

If you use the Flexsim find & replace and select main and then the project node (so MAIN:/1) you will find 2 occurences.

Steven
  #14  
Old 11-30-2009
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default Update #9

Updated to account for the maintree() as the root of the search, and corrected the switch_dllfunc error
Attached Files
File Type: zip findInCode9.zip (5.4 KB, 227 views)

Last edited by Jason Lightfoot; 12-01-2009 at 07:08 AM.
The Following 5 Users Say Thank You to Jason Lightfoot For This Useful Post:
Tom David (11-30-2009)
  #15  
Old 11-30-2009
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Hi Jason,

It seems to work fine now. Thanks for the quick reply!

Steven
  #16  
Old 01-14-2010
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default

Hi,
I really like this command.
Need to find all strings in my code like =" so I tried
findInCode(concat("=",strascii(34)));
The command gives back a table with results, but it returns an error when I click on the tableentry to jump to the code....
__________________
kind regards Nico.
  #17  
Old 01-14-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

Nico we'll look into this - unfortunately I think there's a problem with the code needed to fix it which hopefully we'll resolve.

By the way you can use the escape character '\' to prefix a quotation mark (and other special characters) and thereby add it to your string:

string str="=\"";

assigns the two characters =" to the string str.
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post:
Phil BoBo (01-14-2010)
  #18  
Old 01-14-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

Okay, here's an update to take care of double quotation marks within the search string - thanks to Phil for pointing out a simple solution. There may be other string combinations (I'm thinking with escape characters) that also yield errors with the highlighting logic. If you find some - please post them here.

Good luck!
Attached Files
File Type: zip findInCode10.zip (5.5 KB, 238 views)
The Following 5 Users Say Thank You to Jason Lightfoot For This Useful Post:
Tom David (01-17-2010)
  #19  
Old 05-21-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 difference

Could someone tell me what is the difference between this library and the Find/Replace in a tree which you find in Edit menu?
  #20  
Old 05-21-2012
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

This was developed first and then added with alterations to version 5 as the find/replace in tree you mention. If you want to customize your own search then this might still be useful.
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
shafizad (05-22-2012)



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.