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

I would use it all of the time 3 50.00%
I would use it sometimes 3 50.00%
I would not use it 0 0%
Voters: 6. You may not vote on this poll

  #1  
Old 06-08-2008
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default InputBox in Flexsim script

A missing (as far as I know) but very useful feature in Flexsim script is a simple InputBox. You may wonder why we need a simple InputBox since we can create all kinds of GUIs. Well, if you use createview to display a window, the code after the createview will continue to execute and sometimes you do not want that.

In the attached model, I created user commands to show a simple InputBox and get the user inputs as a string. Flexsim DLL is used to create the commands.

Two user commands are provided. Basically they works the same but using slightly different methods to create. The dllinputbox command using parstr to passing strings as parameters. According to a post by Anthony(http://www.flexsim.com/community/for...command+string), you can use parstr to parse strings but you may get memory leaking. Keeping that in mind, the other user command, inputbox, uses treenodes to hold strings so there is definitely no memory leaking problem. So you should use inputbox command to be safe. Both user commands returns a treenode (returned as a double since user command can only return double) which stores the user inputs as a string. Then you have to use gets(tonode(inputbox())) to get the result.

The attached DLL InputBox.zip includes the demo model and the dll file. Unzip the files to the same directory. The demo model has a script window open. Simply click the Execute button and type something in the inputbox. The retured user inputs will be printed out in the Output window. If you want user input numbers, you can use stringtonum command to cast the results to numbers.

The attached DLL Project.zip includes a Visual Studio 2008 project which has all C++ source code.

The InputBox is not perfect yet since when the InputBox is open, the Flexsim main window still response to mouse actions. I do not know how to fix it. Maybe Anthony or some other guy in Flexsim can do something about it.
Attached Files
File Type: zip DLL InputBox.zip (134.3 KB, 415 views)
File Type: zip DLL Project.zip (204.7 KB, 421 views)
__________________
Best,
Alan
The Following 9 Users Say Thank You to AlanZhang For This Useful Post:
Yongbin Kim (09-30-2010)
  #2  
Old 04-08-2015
Graca Silva
Guest
 
Posts: n/a
Downloads: 11
Uploads: 0
Default

Hello! That sounds like a useful tool, is it possible to make these available again please?


Thread Thread Starter Forum Replies Last Post
Dynamic script generation: Good Example with a User Command Naresh Yamani Tips and Tricks 2 05-16-2008 06:54 PM


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.