cee::exp::ExportVTFx

class ExportVTFx

Export current view and model setting as VTFx file.

The VTF and VTFx file formats are Ceetron’s own formats tailored specifically to carry structural mechanics and fluid dynamics data in a very compact form.

By utilizing XML and zip compression, the VTFx format expands the functionality and usefulness of the well established VTF format by adding features for security, adaptability and the ability to carry multiple cases in one file - without compromising on the file size.

VTFx files can be viewed in several products from Ceetron. For instance the free viewers, Ceetron 3D Viewer and Ceetron 3D Plugin for Microsoft Office.

Example:

cee::exp::ExportVTFx exporter(cee::exp::ExportVTFx::DISPLAY_MODEL_ONLY, model);

// Add properties
{
    cee::PtrRef<cee::PropertySetCollection> propColl = new cee::PropertySetCollection;
    cee::PtrRef<cee::ImageResources> resources = new cee::ImageResources;
    cee::exp::PropertyBuilderVTFx propBuilder(propColl.get(), resources.get());
    propBuilder.addFromModel(*model);
    propBuilder.addFromView(*view);
    exporter.addProperties(*propColl);
    exporter.addResources(*resources);
}

// Thumbnail image
{
    PtrRef<cee::vis::Image> thumbNailImg = new cee::Image;
    view->renderToImage(640, 480, thumbNailImg.get());
    exporter.setSnapshotImage(thumbNailImg.get());
}

exporter.setVendorNameAndApplication("MyCompany", "MyApp");

exporter.saveCase(myFilename);

See also

VTFxFileBrowser

Public Types

enum ExportType

Type of export to perform.

Values:

enumerator DISPLAY_MODEL_ONLY

Only exports the visible triangles/points/lines as well as any cutting plane or isosurfaces as precomputed items.

This gives the smallest file size. Note that it is not possible to move cutting planes or to recompute isosurfaces when loading this file.

enumerator FULL_DATA_MODEL

The full element model (with all internal elements for volume models) is exported to the VTFx file.

enum OverlayPosition

Overlay position in exported VTFx.

Values:

enumerator TOP_LEFT

Top left corner.

enumerator TOP_RIGHT

Top right corner.

enumerator BOTTOM_LEFT

Bottom left corner.

enumerator BOTTOM_RIGHT

Bottom rigth corner.

Public Functions

ExportVTFx(ExportType type, ug::UnstructGridModel *model)

Creates an export object prepared to export the given model.

Parameters
  • type – The type of export to perform. DISPLAY_MODEL_ONLY: Only exports the visible triangles/points/lines as well as any cutting plane or isosurfaces as precomputed items. This gives the smallest file size. Note that it is not possible to move cutting planes or to recompute isosurfaces when loading this file. FULL_DATA_MODEL: The full element model (with all internal elements for volume models) is exported to the VTFx file.

  • model – The model to export. Whatever is currently shown in the model (as specified in the model spec) will be exported.

ExportVTFx(ExportType type, ug::UnstructGridModel *model, bool forceIdenticalDatabase)

Creates an export object prepared to export the given model.

This constructor gives the opportunity to optimize the export operations when the database remains the same in between calls to appendCase().

This is the case if the display model has the same geometry and it is generated for the same states for all cases.

The option must not be used if the file already contains cases generated from different models.

Parameters
  • type – The type of export to perform. DISPLAY_MODEL_ONLY: Only exports the visible triangles/points/lines as well as any cutting plane or isosurfaces as precomputed items. This gives the smallest file size. Note that it is not possible to move cutting planes or to recompute isosurfaces when loading this file. FULL_DATA_MODEL: The full element model (with all internal elements for volume models) is exported to the VTFx file.

  • model – The model to export. Whatever is currently shown in the model (as specified in the model spec) will be exported.

  • forceIdenticalDatabase – Enables or disables writing optimizations made possible for exports involving a single model

void addProperties(const PropertySetCollection &properties)

Adds properties to export.

Related settings like camera setup, background color and to produce a thumbnail/snapshot image in the VTFx file.

void addResources(const ImageResources &resources)

Adds image resources to a VTFx file export.

void clearPropertiesAndResources()

Clears any added properties and resources.

size_t addPlotData(const Str &plotName, const std::vector<Str> &variableNames, const std::vector<std::vector<double>> &variableValues)

Adds a plot to be exported to VTFx.

void setVendorNameAndApplication(const Str &vendorName, const Str &vendorApplication)

Sets the name of the vendor and application from which it is exported from.

void setSnapshotImage(Image *snapshotImage)

Sets a snapshot image for the exported model file.

void setCaseName(const Str &name)

Sets the case name.

void setCaseDescription(const Str &description)

Sets the case description.

void setCustomLogo(Image *logoImage, OverlayPosition position)

Sets a custom logo to be shown at the given position in the view.

The logo will be showed in the Ceetron 3D Viewer.

void setVisiblePartsOnly(bool on)

When this flag is on, only visible parts will be exported in the VTFx file. The default is on.

void setStartAnimation(bool on)

When this flag is on and an animation is stored in the VTFx file, it will start automatically when the file is opened.

The default is on.

void setCompressionLevel(unsigned int compressionLevel)

Sets the level of compression of the VTFx file.

Values range from 0 to 9.

A value of 0 means no compression, values greater than 0 indicate increasing compression performance and hence larger processing time. The default is 6.

void setPassword(const Str &password)

Sets the password used for file encryption. An empty password means no encryption, which is the default.

void setCreateSignature(bool on)

When this flag is on, a digital signature is added to the VTFx file. The default is off.

void setExportRelativeValues(bool on)

When this flag is on, the true values of results are hidden by storing relative values ranging from 0 to 1.

The default is off.

void setWriteAsciiDataFiles(bool on)

When this flag is on, the files in the database are written in Ascii format. The default is off.

void setRelativeDisplacements(bool on)

When this flag is on, displacements will be considered as relative.

void setExportOnlyVisibleElements(bool on)

If FULL_DATA_MODEL is selected, enabling this option will only export visible elements (not filtered by set, scalar value etc).

bool addUserTextFile(const Str &filename, const Str &content)

Adds a the string in content as a file into the VTFx archive.

The name of the file is filename. The file will be stored in the “UserData” VTFx directory.

Previously added files with the same name will be overwritten.

Returns false if an error occurred.

bool saveCase(const Str &fileName)

Exports current view as a VTFx model file.

Returns true on success.

bool appendCase(const Str &fileName)

Exports current view as a VTFx model file.

The current view will be added as a case to an existing VTFx model file.

Returns true on success.

void close()

Closes the exporter, writing any pending blocks to the archive.

bool saveCase(ug::VTFxMemoryFile *vtfxMemoryFile)

Exports current view as a memory file.

Returns true on success.

bool appendCase(ug::VTFxMemoryFile *vtfxMemoryFile)

Exports current view as a VTFx model memory file.

The current view will be added as a case to an existing VTFx model memory file.

Returns true on success.