Jump to content

Welcome to the Simio Forum

Welcome to the Simio Forum! Experience the full experience of the forum by becoming a Simio Insider!

Click_Here_button.png

New Software Release

Our latest release, Simio 10.174, will be live in July 2018!

Save the Date!

Simio Sync is May 14-15, 2018! More details coming next month.

msilverwood2

Members
  • Content count

    12
  • Joined

  • Last visited

Community Reputation

0 Neutral

About msilverwood2

Converted

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. msilverwood2

    Design Add-In Interactive Window (Updated:15 Nov 2012)

    Oh I see. I've never tried to do anything like that so I don't know if it is possible. I suspect that the API doesn't cover the dashboard and therefore it will not be possible to programatically access that data about the dashboard objects. There is an API Reference Guide in the Simio install directory which lists all the things that are possible with the API. Maybe you can look through that and see if there is anything. Otherwise you will need to ask Simio directly if this is possible and how to do it. I think Glen Wirth is probably the right person to ask at Simio.
  2. msilverwood2

    Design Add-In Interactive Window (Updated:15 Nov 2012)

    Hi This code should give you the size and location of an object in the model. You need to put in the correct name of the object! I'm not sure if this will work with a status label, probably not. string objectName = "PUT NAME OF OBJECT HERE"; IIntelligentObject ob = context.ActiveModel.Facility.IntelligentObjects[objectName]; if(ob != null) { WriteLine(String.Format("{0}: {1}","Location X",ob.Location.X)); WriteLine(String.Format("{0}: {1}","Location Y",ob.Location.Y)); WriteLine(String.Format("{0}: {1}","Location Z",ob.Location.Z)); WriteLine(String.Format("{0}: {1}","Size Height",ob.Size.Height)); WriteLine(String.Format("{0}: {1}","Size Width",ob.Size.Width)); WriteLine(String.Format("{0}: {1}","Size Length",ob.Size.Length)); }
  3. msilverwood2

    Design Add-In Interactive Window (Updated:15 Nov 2012)

    @miguel. This add-in requires .Net 4.5 to be installed if I remember correctly. That is most likely the problem. You wouldn't need to install Roslyn unless you are using the source code because the dlls are included.
  4. msilverwood2

    Design Add-In Interactive Window (Updated:15 Nov 2012)

    I've added the source code to GitHub. https://github.com/SlicedSilver/SimioREPL If you make any improvements to the code then please share.
  5. msilverwood2

    Design Add-In Interactive Window

    New version at the original forum post: http://www.simio.com/forums/viewtopic.php?f=35&t=977
  6. msilverwood2

    Simio Event Handlers

    Hi, Is it possible to set-up custom event handlers for Simio Events? I know that it is possible to schedule an event (using the ICalendar interface during a step add-in) which you can specify a callback method for. Is it possible to subscribe to other events such as events in the model that are not scheduled for a specific time in the event calendar? Thanks.
  7. msilverwood2

    Design Add-In Interactive Window (Updated:15 Nov 2012)

    I've updated the Add-In. It looks nicer now and has a few new features. 1) Initialization code is completed automatically when the window is opened. 2) Crtl+Enter will execute whatever is in the input text box. 3) Recall previous command can now be pressed multiple times to go back further in the command history. 4) Added a drop-down code snippet tool (green drop-down). This loads stored functions stored in the following file: "c:\SimioReferences\REPL_Functions.txt". 5) Window is re-sizable (main reason for updating). Install dll into either: "C:\Program Files (x86)\Simio\UserExtensions\SimioREPL\SimioREPL.dll" or "C:\Program Files\Simio\UserExtensions\SimioREPL\SimioREPL.dll" Still doesn't have intellisense. Seems like too much work to get it working. I just code in visual studio with a temp file and copy-paste what I need to test. SimioREPL.zip
  8. msilverwood2

    Design Add-In Interactive Window

    I've created a tool which makes my life a bit easier when trying to code Design Add-Ins for Simio and I thought that I would share it with everyone else. Disclaimer: I'm an engineer that is mostly self-taught when it comes to programming so it may not work (all I know is that it works on my pc ). Also I know that it isn't the prettiest piece of software either. What the tool does is allow you to try c# code directly within Simio and evaluate the results. If you have ever used a dynamic programming language like Matlab or Mathematica then it will be familiar to you. Its like the command window in Matlab where you can enter commands without compiling. Its called a REPL (Read-Eval-Print-Loop). more info here: http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop The code uses the Microsoft Roslyn Compiler API. more info here: http://en.wikipedia.org/wiki/Microsoft_Roslyn If you want to play around with the source code then you will probably need to install the Roslyn CTP. Download here: http://msdn.microsoft.com/en-gb/roslyn. I created the solution using Visual Studio 2012 and I believe that the roslyn compiler only works with VS 2012 at the moment. How to install: 1) Copy the SimioREPL folder from the zip file into either: C:\Program Files\Simio\UserExtensions or c:\Program Files (x86)\Simio\UserExtensions 2) The folder structure should be ..\Simio\UserExtensions\SimioREPL How to get started: 1) Create a new model in simio. 2) Select SimioREPL from the Select Add-In drop Menu (Project Home Ribbon) 3) Click "Insert Initializing Code" button. This inserts some code to get the whole thing going. You may need to change the directory of the dlls loaded if you are not using a 64-bit machine (delete the x86 part from the path). 4) Press the Execute button to evaluate the code. 5) You can now start playing with the interactive coding environment The bottom textbox displays the results from each execution loop. If no return values are given then it will display just the execution count. How to use (here is an example of how to use the tool): Enter c# code just like in a normal program, for example: int x = 10; You can find out the current value of a variable by entering its name without the ending semi-colon, for example: x or x*2 + 10 -3 This will display the value in the output text box at the bottom of the window. I've added the ability to use Write() and WriteLine(), just like in a console application. for example: WriteLine(object.ObjectName); If the code is invalid then the Exception message will be displayed in the results text box, and the input code will remain. If the code is valid then the input code is cleared. The context object is already defined. Use context as you normally would. Some example code Walkthrough: Add some objects to the model IIntelligentObjects intelligentObjects = context.ActiveModel.Facility.IntelligentObjects; IFixedObject sourceObject = intelligentObjects.CreateObject("Source", new FacilityLocation(-5, 0, -5)) as IFixedObject; IFixedObject serverObject = intelligentObjects.CreateObject("Server", new FacilityLocation(0, 0, 0)) as IFixedObject; IFixedObject sinkObject = intelligentObjects.CreateObject("Sink", new FacilityLocation(5, 0, 5)) as IFixedObject; ILinkObject path1 = intelligentObjects.CreateLink("Path",sourceObject.Nodes[0],serverObject.Nodes[0],null) as ILinkObject; ILinkObject path2 = intelligentObjects.CreateLink("Path",serverObject.Nodes[1],sinkObject.Nodes[0],null) as ILinkObject; [Execute] Move the source object intelligentObjects["Source1"].Location = new FacilityLocation(-4.5, 0, -2); [Execute] List all the nodes on the server object foreach(var node in serverObject.Nodes) { WriteLine(node); } [Execute] List all the objects in the model foreach(var ob in intelligentObjects) { WriteLine(ob.ObjectName); } [Execute] ---------- Hopefully you find this useful. If you improve the tool using the Source Code given then could you please repost the source code here in this forum topic. I'm sure that there are many things that can be improved by a proper programmer. What it really needs is intellisense . SimioREPL Source.zip SimioREPL UserExtension.zip
  9. I've created a tool which makes my life a bit easier when trying to code Design Add-Ins for Simio and I thought that I would share it with everyone else. Disclaimer: I'm an engineer that is mostly self-taught when it comes to programming so it may not work (all I know is that it works on my pc ). Also I know that it isn't the prettiest piece of software either. What the tool does is allow you to try c# code directly within Simio and evaluate the results. If you have ever used a dynamic programming language like Matlab or Mathematica then it will be familiar to you. Its like the command window in Matlab where you can enter commands without compiling. Its called a REPL (Read-Eval-Print-Loop). more info here: http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop The code uses the Microsoft Roslyn Compiler API. more info here: http://en.wikipedia.org/wiki/Microsoft_Roslyn If you want to play around with the source code then you will probably need to install the Roslyn CTP. Download here: http://msdn.microsoft.com/en-gb/roslyn. I created the solution using Visual Studio 2012 and I believe that the roslyn compiler only works with VS 2012 at the moment. How to install: 1) Copy the SimioREPL folder from the zip file into either: C:\Program Files\Simio\UserExtensions or c:\Program Files (x86)\Simio\UserExtensions 2) The folder structure should be ..\Simio\UserExtensions\SimioREPL How to get started: 1) Create a new model in simio. 2) Select SimioREPL from the Select Add-In drop Menu (Project Home Ribbon) 3) Click "Insert Initializing Code" button. This inserts some code to get the whole thing going. You may need to change the directory of the dlls loaded if you are not using a 64-bit machine (delete the x86 part from the path). 4) Press the Execute button to evaluate the code. 5) You can now start playing with the interactive coding environment The bottom textbox displays the results from each execution loop. If no return values are given then it will display just the execution count. How to use (here is an example of how to use the tool): Enter c# code just like in a normal program, for example: int x = 10; You can find out the current value of a variable by entering its name without the ending semi-colon, for example: x or x*2 + 10 -3 This will display the value in the output text box at the bottom of the window. I've added the ability to use Write() and WriteLine(), just like in a console application. for example: WriteLine(object.ObjectName); If the code is invalid then the Exception message will be displayed in the results text box, and the input code will remain. If the code is valid then the input code is cleared. The context object is already defined. Use context as you normally would. Some example code Walkthrough: Add some objects to the model IIntelligentObjects intelligentObjects = context.ActiveModel.Facility.IntelligentObjects; IFixedObject sourceObject = intelligentObjects.CreateObject("Source", new FacilityLocation(-5, 0, -5)) as IFixedObject; IFixedObject serverObject = intelligentObjects.CreateObject("Server", new FacilityLocation(0, 0, 0)) as IFixedObject; IFixedObject sinkObject = intelligentObjects.CreateObject("Sink", new FacilityLocation(5, 0, 5)) as IFixedObject; ILinkObject path1 = intelligentObjects.CreateLink("Path",sourceObject.Nodes[0],serverObject.Nodes[0],null) as ILinkObject; ILinkObject path2 = intelligentObjects.CreateLink("Path",serverObject.Nodes[1],sinkObject.Nodes[0],null) as ILinkObject; [Execute] Move the source object intelligentObjects["Source1"].Location = new FacilityLocation(-4.5, 0, -2); [Execute] List all the nodes on the server object foreach(var node in serverObject.Nodes) { WriteLine(node); } [Execute] List all the objects in the model foreach(var ob in intelligentObjects) { WriteLine(ob.ObjectName); } [Execute] ---------- Hopefully you find this useful. If you improve the tool using the Source Code given then could you please repost the source code here in this forum topic. I'm sure that there are many things that can be improved by a proper programmer. What it really needs is intellisense . SimioREPL Source.zip SimioREPL UserExtension.zip
×