ExportModel.1.vbs Example

Applies To

ExportModel command

Description

VBScript example : Importing and exporting models using the ImportModel/ExportModel commands. Models and submodels are created and then exported and imported in this example. First create a model, a submodel, and primitives within them.

Code

SICreateModel , "SubModel"
SICreateModel "SubModel", "Model"
CreatePrim  "Torus", "MeshSurface", "MyTorus", "SubModel"
CreatePrim  "Cube", "MeshSurface", "MyCube", "Model"
' Now export the models, once exporting submodels, and once not.
emdlFile = Application.InstallationPath( siUserPath ) & "\Model.emdl"
emdlSubFile = Application.InstallationPath( siUserPath ) & "\Model_with_Submodels.emdl"
ExportModel "Model", emdlFile, False
ExportModel "Model", emdlSubFile, True
' Now delete the models/primitives of the scene (so we can re-import them), 
DeleteObj "Model.SubModel.MyTorus"
DeleteObj "Model.SubModel"
DeleteObj "Model.MyCube"
DeleteObj "Model"
' Now import the exported files. One as a referenced model, the other not.
ImportModel emdlFile, , False, , "Model (no submodels, not referenced)"
ImportModel emdlSubFile, , True, , "Model (with submodels, referenced)"
'---------------------------------------------------------
'INFO : Output from this script:
'INFO : "4152 - Data loaded from file <UserPath>\Model.emdl was created with build number: <build_num> - compatibility version: 300"
'INFO : "4152 - Data loaded from file <UserPath>\Model_with_Submodels.emdl was created with build number: <build_num> - compatibility version: 300"
'INFO : Object: "Model___no_submodels__not_referenced_.MyCube"
'INFO : Object: "Model___with_submodels__referenced_.MyCube"
'INFO : Object: "Model___with_submodels__referenced_.SubModel.MyTorus"
'---------------------------------------------------------

Keywords

ExportModel


Autodesk Softimage 2011