Simio
  • Export Import Model Using A Text File

  • Do you have objects, models, libraries, path decorators, textures, symbols, custom API code, documentation, or anything else others might find useful? Please attach it here with a brief description.
Do you have objects, models, libraries, path decorators, textures, symbols, custom API code, documentation, or anything else others might find useful? Please attach it here with a brief description.
 #4212  by gtwirth
 Fri Jul 12, 2013 3:30 pm
Here is a simple utility that will export your model to a text file (pipe delimited). Then you can modify the file and import the model back in. NOTE: Currently, this utility does not handle graphics in your model.

There is also has capabilities to import and export lists and networks.

Here are some quick instructions on how to setup this add-in.

1) Download the "ExportImportModelAddIn_DLL.zip"

2) Extract "ExportImportModelAddIn.dll" from the "ExportImportModelAddIn_DLL.zip" into a temp folder (e.g. c:\temp).

3) Right-click the assembly and select properties. Then choose to "unblock" button and press apply. (only needed for Windows 7 and later).

4) Copy "ExportImportModelAddIn.dll" into "C:\Users\<YOUR USERNAME>\Documents\SimioUserExtensions". You might need to add the SimioUserExtensions folder under MyDocuments (C:\Users\<YOUR USERNAME>\Documents) if it does not already exist.

5) Open Simio and load your model.

6) From the Project Home...Select Add-In button, select "Export Import Model"

7) Choose the function that you want to run (e.g. Export, Delete, Import, etc..). Note...If you export and then import the model without a delete, it will update the object data if the object already exist.

Updated 2017-09-25....Fixed the import of lists.

Updated 2017-07-14....Added the ability to auto generate and auto read files. Previously, the files need to be created prior to running the add-in. Now, they will created by the export. Also, the import will retrieve the same file generated by the export. These options are available when the "Auto Generate and Read Files" option is selected.

Updated 2017-07-13....Added the ability to multi-select options. Now, more than one option can be initiated when the OK button is selected. This will streamline the process of exporting, deleting and importing. This tool is very helpful for testing out your model with various configurations to ensure that runs properly under various object and/or data configuration.
MultiSelectOptions.png
MultiSelectOptions.png (18.16 KiB) Viewed 2698 times
Updated 2017-07-11....Now supports exporting and importing of model properties, exporting and importing of table properties and delete table data.

Updated 2017-06-22....Now supports exporting and importing of data tables using using XML. This is simple way to export all the table data from one model and import the same data into a new model (assuming that the same tables schema exist in the new model).

Updated 2017-01-27....Now supports exporting of object types using XML. This can be used with the new Configure Scheduling Resources in Simio 9.150 capabilities to define your own object type properties based on an XML document.

Updated 2017-01-23....Now supports exporting and importing objects using XML. When using XML, property units are also exported and imported back in.

Updated 2016-10-24....Updated files...Added support for repeating properties.
Attachments
(40.76 KiB) Downloaded 25 times
(23.04 KiB) Downloaded 22 times
Last edited by gtwirth on Tue Sep 03, 2013 7:33 am, edited 2 times in total.
 #4234  by miguelgaitan
 Tue Jul 16, 2013 4:06 pm
nice!, thank you!

this is perfect since i can interface this with a python program, edit away there and then come back and import it, amazing stuff!

similar to the excel import but plain text files are always nicer,

regards,
 #4240  by miguelgaitan
 Wed Jul 17, 2013 8:05 am
hi... on another note, when exporting a file, I have to manually create the blank txt file before exporting, or is it just me_
is there a way of making the addin create the txt automatically if it doesnt exist?

thanks!

regards
 #4244  by willem
 Wed Jul 17, 2013 11:17 am
Thanks, great stuff...

Is it possible to export the files as .csv (comma seperated values) in stead of the | seperated values? This will allow easy import, edit and save in excel.
 #4578  by gtwirth
 Thu Sep 12, 2013 9:11 am
I have updated this add-in to support the export and import of elements.

If you need to update the properties on the elements in your model, first export them. Then update the text file and the import them again. The element properties will be updated.

See attached code and DLL...

Updated 2014-01-24....See later posts for code and DLL.
 #4580  by MEagar
 Thu Sep 12, 2013 8:05 pm
Glen,

If I had a sheet of golden stars, I would stick on on your forehead...

THANK YOU SO MUCH !!

Mark
 #4584  by willem
 Fri Sep 13, 2013 2:25 am
Thanks,

One feature that I would still like is a selective delete, or a rename. Is it currently possible to rename objects?

It would be great if the functionality of this add was incorporated into the standard Simio package, allowing for a batch select.
 #5061  by MEagar
 Fri Jan 24, 2014 3:48 am
Hi Glen...

PLEASE can you update the export to include Log_Observations == True/False....

Fanks !!
 #5064  by gtwirth
 Fri Jan 24, 2014 10:16 am
Hi Mark...Please clarify...Do you mean updating the LogObservation property on a StateStatistic or TallyStatistic elements?

This can be done with the existing Export Import Model Add in...

I was able to export the elements from the HositalEmergenyDepartment.spfx. Then, I ran a a search an replace From "LogObservations|False" to "LogObservations|True". Imported the elements file. Once this is done, all StateStatistics and TallyStatistics in the model were being logged.
 #5065  by gtwirth
 Fri Jan 24, 2014 3:31 pm
I have updated this add-in to support the export and import of vertices.

If you need to update the vertices on a link in your model, first export them. Then update the text file and the import them again. If the link exists in the file, all vertices on a link will be removed and then re-added based on what is contained in the file.

See attached code and DLL.

Added 2014-03-04....The ability to define your own delimiter...Note: Import and Export of Objects does not work well with the comma as the delimiter. The expression properties will not import correctly since expression typically have commas in them as well.

Added 2016-01-27....Updated project to use Microsoft .NET 4.5 Framework.

Update 2016-10-24....See first post for latest files.
 #5077  by MEagar
 Sun Jan 26, 2014 7:35 pm
Hi Glen,

This was my bad...I had exported all output statistics, changed to state statistics, and re imported....Had to do this again for state statistics to reset log observations to true as the default was false.

Forgot the output statistics does not have the log observations property.
Mark
 #6934  by gtwirth
 Mon Sep 21, 2015 5:31 pm
Hi Mark,

Are you referencing the Spreadsheet Import?

http://www.simio.com/forums/viewtopic.php?f=36&t=904

If so, you should be able to add the column to the spreadsheet that references the user defined property. The spreadsheet import should see and import the values defined in the column of the spreadsheet for the object.