Import Models API

STL files are typically loaded into Local Simulation in a one of three primary ways:

  1. Import directly within Local Simulation.
  2. Transfer from Netfabb.
  3. Transfer from PowerShape Utility.

When working with multiple STL files in a single simulation, it may be useful to import several files at once. To accomplish importing several files at once, we have provided the Import Models API. This API allows you to define a list of parts, supports, and the associated volume fraction for each STL file with a JSON file.

Define the JSON File

The JSON file can be created with any standard text editor. Every JSON file must contain the following keywords:
  • SimulationImport
  • version
  • parts
  • supports

The SimulationImport keyword identifies the action to take place, importing. The version keyword is used to identify the version of Local Simulation installed. At this time, the only value of version supported is "com.autodesk.tivuslaunch-1.1". The parts keyword is used to identify all STL files to be imported as parts. Included in the parts keyword are the name and volumeFraction descriptors. The supports keyword is used to identify all STL files to be imported as support structures. Included in the supports keyword are the name and volumeFraction descriptors. Consider the basic structure below:

{
	"SimulationImport":
	{
		"version":"com.autodesk.tivuslaunch-1.1",
		"parts":
			[{"name":"partname1.stl","volumeFraction":"vf1"},
			 {"name":"partname2.stl","volumeFraction":"vf2"}],
		"supports":
			[{"name":"supportname1.stl","volumeFraction":"vf3"},
			 {"name":"supportname2.stl","volumeFraction":"vf4"},
			 {"name":"supportname3.stl","volumeFraction":"vf5"}]
	}
}

where partnameN and supportnameN are the file names for the STL files to be imported and vfN is the volume fraction associated with each file. If the parts and supports are not located in the same directory as the JSON file, you must provide the full path to the file names. The volume fraction represents the ratio of fused support volume to the total support volume, where 0 < vf ≤ 1.0. Values outside this range are adjusted to 1.0.

The JSON file must be saved with a .tivusimport file extension.

Call the Import Models API

The Import Models API is called using the appbase.exe file installed with Local Simulation. The call is defined as follows:

call path_to_appbase\appbase.exe "path_to_json\filename.tivusimport"
where path_to_appbase is the directory location of the appbase.exe file and path_to_json is the directory location of the *.tivusimport file. The appbase.exe file is found in the \SIM\ folder in the installation location. To determine the installation directory, locate the InstallLocation registry key:
  1. Netfabb Ultimate subscribers: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Autodesk Netfabb Ultimate 2018
  2. Netfabb Premium subscribers: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Autodesk Netfabb Premium 2018

The API call can take place in a Windows command file (*.cmd) or within another software application.

Example API Call

In this example, a Windows command file is created which contains the required syntax to call the Import Models API. After the command file is created, it can be executed to import the models into Local Simulation.

  1. Use a text editor to create a new file.
  2. Add the following syntax to the text file:
    call C:\Program Files\Autodesk\Netfabb Ultimate 2018\SIM\appbase.exe "D:\Netfabb\models.tivusimport"

    In this case, C:\Program Files\Autodesk\Netfabb Ultimate 2018\SIM\ is the location of the appbase.exe file and D:\Netfabb\ is the location of the models.tivusimport JSON file containing the list of parts and supports to import. Be sure to include the models.tivusimport file, and the full path to this file, inside double quotation marks.

  3. Save the file with a *.cmd extension. In this case, let's name it importstl.cmd.
  4. Double-click the importstl.cmd file to execute the API call.