This example opens an existing VTFx file in append mode and adds a new state. It also adds scalar result values for this new state and updates the existing case properties to include this new state in the animation.
The initial VTFx file has three states. The VTFx created in this example will also contain a fourth state and scalar results for this state. The first three states (with their results) are identical to the initial VTFx file.
cee::Str fileName =
"ExampleAppend2.vtfx";
std::ifstream src("../../DemoFiles/SimpleExample.vtfx", std::ios::binary);
if (!src.good())
{
return EXIT_FAILURE;
}
std::ofstream dst(fileName.
toStdString().c_str(), std::ios::binary);
dst << src.rdbuf();
src.close();
dst.close();
{
return EXIT_FAILURE;
}
{
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
{
{
{
if (!resultValuesBlockPart1Step4->
setMapToBlockId(1, cee::vtfx::Block::NODES))
{
return EXIT_FAILURE;
}
const float RESULT_VALUES[] = { 0.0f, 0.0f, 1.5f, 2.0f, 2.0f, 2.0f, 3.0f, 4.0f };
std::vector<float> resultValues(RESULT_VALUES, RESULT_VALUES + sizeof(RESULT_VALUES) / sizeof(RESULT_VALUES[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
}
{
{
if (!resultValuesBlockPart2Step4->
setMapToBlockId(2, cee::vtfx::Block::NODES))
{
return EXIT_FAILURE;
}
const float RESULT_VALUES[] = { 0.0f, 0.0f, 0.5f, 0.5f, 4.0f };
std::vector<float> resultValues(RESULT_VALUES, RESULT_VALUES + sizeof(RESULT_VALUES) / sizeof(RESULT_VALUES[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
}
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
{
scalarSelection->
setValue(
"fringes_result_id", 1);
std::vector<cee::Variant> stateIds(STATE_IDS, STATE_IDS + sizeof(STATE_IDS) / sizeof(STATE_IDS[0]));
stateSelection->
setValue(
"state_ids", stateIds);
viewer->
setValue(
"start_animation",
true);
{
return EXIT_FAILURE;
}
}
{
return EXIT_FAILURE;
}
std::cout <<
"Exported successfully to file: " << fileName.
toStdString() << std::endl;
std::cout << std::endl << "Press enter to exit..." << std::endl;
std::cin.ignore();
return EXIT_SUCCESS;