question

Richard G avatar image
0 Likes"
Richard G asked Richard G commented

findInCode User Command

It would be great to search a model and find any custom code. I found this old forum post that discusses this topic (https://www.flexsim.com/community/forum/showthread.php?t=1149) but I can't download a file from that thread. Does someone has access to Jason Lightfoot's script from that thread? This other post has a code snippet but it looks like Jason implemented something more complete (https://www.flexsim.com/community/forum/showthread.php?t=2094). Thanks in advance!

FlexSim 18.0.1
user commandsearch toolcustom code templatesearch model tree
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Arun Kr avatar image Arun Kr commented ·
1 Like 1 ·
Richard G avatar image Richard G Arun Kr commented ·

Ah, I could've tagged him. Didn't think of that, thanks

0 Likes 0 ·

1 Answer

Phil BoBo avatar image
3 Likes"
Phil BoBo answered Richard G commented

Jason's custom search was implemented into standard FlexSim back in version 5.0 in 2010. In FlexSim 5 and 6, it was under main menu Edit > Find/Replace in Tree. In more recent versions of FlexSim, it is the Search section in Quick Properties when a tree view is active. Searching in that UI opens the Find Results view:


find-in-code.png (109.6 KiB)
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Richard G avatar image Richard G commented ·

@phil.bobo thanks for that info and the quick reply. Unfortunately, I can't use the search if I don't know the search term, say, if I inherited a model from someone else without documentation. In that case, I don't have visibility of whether (1) custom code exists in the model and (2) where it exists. Since I couldn't view Jason's code, I figured it was a more fully-implemented sample of what you developed in this thread (https://www.flexsim.com/community/forum/showthread.php?t=2094) as indicated by the last post there. Your sample reportedly checks variables and reports if they differ from the defaults, so no need to use queries. Is something like this implemented in FlexSim 2018? Should I just work on implementing your sample from that thread, or can you suggest a better path forward?

1 Like 1 ·
Phil BoBo avatar image Phil BoBo ♦♦ Richard G commented ·

The Script in that link still works correctly with 18.0.

That's a good place to start if you want to find customized code nodes within a model.

No features have been added to the software to do what that script does. You should just start with that script and update it according to your needs.

Jason's code wasn't related to finding customized code nodes; it was generally finding text within any nodes in the tree, customized or not.

0 Likes 0 ·
Richard G avatar image Richard G Phil BoBo ♦♦ commented ·

Thank you @phil.bobo

0 Likes 0 ·