Jump to content

Export Import Model Using A Text File


gtwirth
 Share

Recommended Posts

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\<YourUserName>\Documents\SimioUserExtensions". You might need to add the SimioUserExtensions folder under MyDocuments (C:\Users\<YourUserName>\Documents) if it does not already exist.  (e.g. C:\Users\GlenWirth\Documents\SimioUserExtensions).

 

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 2021-12-07....Added the ability to select a table and then remove the data from the selected table.  If a table name is not selected, all the tables in the model will have their data removed.

ExportImportModelAddIn.thumb.png.305d2bf2edc5ff14d2b78830b680c47f.png

Updated 2021-09-20....Added Update Model Properties (CSV).   With this new method, you can import model properties into your model.  If the file contains 3 fields...First is name, then type and last is default value.    The only valid types are real, datetime, boolean and everything else is string.   If the model property already exists, it will only update the default value on the property.   Note:  The example assumes the field separator is a caret '^'.  To change this , you need to change the delimiter field.

 

Updated 2021-09-08....Updated the sequence of the exports, deletes and imports happen.  When OK is pressed, first the exports are run, then deletes and finally the imports.    With this change, I am able to Export Table to DB, Delete Table Data and Import Table from DB from in a single run.    I typically do this when re-mapping auto create elements.    Since the table data need to be removed and recreated before mapping of the elements are correctly mapped. 

Updated 2021-09-06....Upgraded to .NET 4.7.2.  Also, fixed the windows form so it displays correctly.   When opened, the form should no longer need to be expanded to see all the options.

 

Updated 2018-11-08....Added Export To CSV, Export To DB and Import From DB.   Export To DB will create a table in the SQL Server database with the same table name as the table in Simio.  The data columns will be of type nvarchar(max) and the default value will be the same as the default value in the Simio table.  It is assumed that Simio desktop will still do the data validation; not the database.  This feature is used to save the Simio data into a database so it is backed up and can be shared across users.  Each time the Export To DB, if the table already exists, it is dropped and a new table is created.  This ensures that the data schemas match between the Simio model and the SQL Server database.

Updated 2017-12-05....Fixed index issue with links import.

 

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.

 

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.

 

 

 

 

 

 

 

 

 

 

 

ExportImportModel_Code.zip ExportImportModelAddIn_DLL.zip

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 months later...

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

Hi!


Im having a little problem with the add in. In Simio, under select add-in, I do not have the "Export Import Model"option. All I have is the "Place Source, Server, Sink" option. I created the folder just the way you said "C:\Users\\Documents\SimioUserExtensions", does ir have anything to do with the version 9.147?

Link to comment
Share on other sites

  • 11 months later...
  • 1 year later...
On 11/8/2018 at 3:58 PM, gtwirth said:

Process steps cannot be exported....New capabilities just added...See first post on this topic.

Hi Glen,

Would it at all be possible now or in future to import and export processes?

We have 8 models that have to use the same processes but have different data tables and layouts.  Most of the logic we can place objects but not all, so we have some logic in the main model.

Any suggestions on how to do this other than a manual copy paste?

Regards,

Willem 

Link to comment
Share on other sites

  • 1 month later...

Hi Tere,

We still largely used the manual approach, however we used a lot of subclassed object to make sure a change gets applied to all 8 models.  We also made use of the table based autocreate to create the different layouts. We do have 8 separate models and we just copy paste the processes.

Essentially we could have had one model but with 8 different sets of bindings, this was also not ideal as we have multiple table and even just selecting all of the different bindings while testing would have been cumbersome.

If you find a better way please let us know.

Regards,

Willem

Link to comment
Share on other sites

  • 3 months later...

Hi Glen, I need your support for an error that I have to manage very often. My company set an automatic backup on One Drive and that is creating problem to load your Add-In.

The body of the error is the following:

 Exception in loading types from 'C:\Users\username\OneDrive \documents\.\SimioUserExtensions\ExportImportModelAddIn.dll', message: 'Could not load file or assembly 'file:///C:\Users\username\OneDrive\documents\SimioUserExtensions\ExportImportModelAddIn.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)'
 Loading 'C:\Users\username\OneDrive\documents\.\SimioUserExtensions\ExportImportModelAddIn.dll' may have failed because the DLL was copied from another computer and has been blocked by Windows. To unblock it, copy the file to a user writable directory, right click on it and select Properties, on the General tab, click Unblock, then click OK, and then copy it back to your UserExtensions folder if necessary. 

Off course the file is unblocked, do you have some suggestion to fix it?

Simio version is 11.197.19514.0

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
 Share

×
×
  • Create New...