'---------------------------------------------------------
' VBScript example : Importing and exporting a dotXSI file.
' This example uses the SIImportDotXSIFile and SIExportDotXSIFile
' commands, which do not prompt for the user for validation of
' import/export parameters like ImportDotXSI and ExportDotXSI.
'---------------------------------------------------------
' Create a model, with some primitives.
dim ExportRoot
SICreateModel , "ExportRoot", , ExportRoot
CreatePrim "Torus", "MeshSurface", "Torus", ExportRoot
CreatePrim "Cube", "NurbsSurface", "Cube", ExportRoot
' Since we are not getting a dialog to modify dotXSIExport options,
' We can specify them here, if we wish. To see what each parameter corresponds to,
' goto the .spdl file, <InstallationPath>\Application\spdl\C3DdotXSIExportOpt.spdl.
SetValue "dotXSIExportOptions.project_name", ActiveProject.Name
SetValue "dotXSIExportOptions.output_file_format", 1 ' 0 = Binary, 1 = Ascii
SetValue "dotXSIExportOptions.output_file_format_version", 360 ' "3.0" = 300, "3.5" = 350, "3.6" = 360
SetValue "dotXSIExportOptions.sceneroot", False
SetValue "dotXSIExportOptions.polymesh", True
SetValue "dotXSIExportOptions.tesselation", False
SetValue "dotXSIExportOptions.nrbssrf", True
SetValue "dotXSIExportOptions.nrbscrv", True
SetValue "dotXSIExportOptions.animall", True
SetValue "dotXSIExportOptions.constraint", True
SetValue "dotXSIExportOptions.custompset", True
' Now specify to export the model to a dotXSI file
dotXSIFile = Application.InstallationPath( siUserPath ) & "\MyModel.xsi"
SIExportDotXSIFile ExportRoot, dotXSIFile
' Now delete the primitives and model, and re-import them.
DeleteObj "ExportRoot.Torus"
DeleteObj "ExportRoot.Cube"
DeleteObj "ExportRoot"
' Again, since we do not get a dialog box to change import options, change them
' now programmatically. To see what each parameter corresponds to, goto the
' .spdl file, <InstallationPath>\Application\spdl\C3DdotXSIImportOpt.spdl.
SetValue "dotXSIImportOptions.anim_import", True
SetValue "dotXSIImportOptions.classical_scaling", True
SetValue "dotXSIImportOptions.mat_import", True
SetValue "dotXSIImportOptions.txt_import", True
' Now import the same model that was just exported.
SIImportDotXSIFile dotXSIFile
'---------------------------------------------------------
' Output from this script (user specifies ok on both dialogs):
'INFO : "4004 - Begin: Export .xsi file"
'INFO : "4005 - End: Export .xsi file"
'INFO : "4002 - Begin: Import .xsi file"
'INFO : "4003 - End: Import .xsi file"
' Object: ExportRoot.Torus
' Object: ExportRoot.Cube
'--------------------------------------------------------- |