Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

ExportReferenceDesign Class Reference

Last update: 16.07.2025

defines information on imported data and files given a reference design This class contains settings for an example design directory (the base_path). These settings include file formats, data items to be imported etc. More...

Public Types

typedef std::vector< ExportItemInfoExportItemInfoVector
 a set of data items
 

Public Member Functions

 addFile_Abaqus (Structure database, string filename)
 Exports information to a file in Abaqus format. More...
 
 addFile_ANSYS_MechanicalDat (Structure database, string filename)
 Exports information to a file in ANSYS format. More...
 
 addFile_CSV (Structure database, string filename)
 Exports information to a file in CSV format. More...
 
 addFile_ElementDataCSV (Structure database, string filename)
 Exports information to a file in CSV format. More...
 
 addFile_ExternalDataCSV_Disp (Structure database, string filename)
 Exports information to a file in External data CSV format. More...
 
 addFile_ExternalDataCSV_ElementData (Structure database, string filename)
 Exports information to a file in External data CSV format. More...
 
 addFile_ExternalDataCSV_NodeData (Structure database, string filename)
 Exports information to a file in External data CSV format. More...
 
 addFile_Image (Structure database, string filename)
 Exports information to an image file. More...
 
 addFile_LSDynaK (Structure database, string filename)
 Exports information to a file in LS-DYNA K format. More...
 
 addFile_Nastran (Structure database, string filename)
 Exports information to a file in Nastran format. More...
 
 addFile_NodeDataCSV (Structure database, string filename)
 Exports information to a file in CSV format. More...
 
 addFile_PERMAS (Structure database, string filename)
 Exports information to a file in PERMAS format. More...
 
 addFile_SingleSignalCSV (Structure database, string filename)
 Exports information to a file in CSV format. More...
 
 addFile_STL (Structure database, string filename)
 Exports information to a file in binary STL format. More...
 
 addNewFile_ANSYS_MechanicalDat (Structure database, string filename)
 Exports information to a file in ANSYS format. More...
 
 addNewFile_CSV (Structure database, string filename)
 Exports information to a file in CSV format. More...
 
 addNewFile_ElementDataCSV (Structure database, string filename)
 Exports information to a file in CSV format. More...
 
 addNewFile_ExternalDataCSV_Disp (Structure database, string filename)
 Exports information to a file in External data CSV format. More...
 
 addNewFile_ExternalDataCSV_ElementData (Structure database, string filename)
 Exports information to a file in External data CSV format. More...
 
 addNewFile_ExternalDataCSV_NodeData (Structure database, string filename)
 Exports information to a file in External data CSV format. More...
 
 addNewFile_Image (Structure database, string filename)
 Exports information to an image file. More...
 
 addNewFile_NodeDataCSV (Structure database, string filename)
 Exports information to a file in CSV format. More...
 
 addNewFile_SingleSignalCSV (Structure database, string filename)
 Exports information to a file in CSV format. More...
 
 addNewFile_STL (Structure database, string filename)
 Exports information to a file in binary STL format. More...
 
 check (Structure database)
 checks if the settings are valid and produces an error. More...
 
 checkFiles (string abs_design_dir_path, bool quiet=false)
 checks if all required files to be exported to exist in the given design directory More...
 
 checkObjects (Structure database, int sample, bool quiet=false)
 checks if all required objects for the given design number are existing in the database More...
 
 ExportReferenceDesign (string the_base_path)
 constructor More...
 
string generateScriptOfSettingsDefinition (string variable_ident, string other_base_path="")
 generates a script string (Lua) that is used to build up the current settings object. More...
 
std::vector< string > getFiles ()
 assembles the complete list of files being known to this class This is a compact view onto the contained data, since multiple items may be imported from a single file. More...
 
std::vector< string > getFilesToExport ()
 assembles a list of files which are to be exported (only the files for which one selected a quantity are exported here) This is a compact view onto the contained data, since multiple items may be imported from a single file and some files may be inactive. More...
 
ExportItemInfo getItem (string filename, ExportItemInfo::Type data_type)
 gets the respective item if existing More...
 
number getItemIndex (string filename, ExportItemInfo::Type data_type)
 gets the index of the respective item if existing More...
 
std::vector< number > getItemsForFile (string filename)
 assembles a list of items which are to be exported to a specific file More...
 
std::vector< string > getModifiedFiles ()
 assembles the complete list of files being known to this class and that are NOT to be created This is a compact view onto the contained data, since multiple items may be imported from a single file. More...
 
std::vector< string > getModifiedFilesToExport ()
 assembles a list of modified files which are to be exported (only the files for which one selected a quantity are exported here) This is a compact view onto the contained data, since multiple items may be imported from a single file and some files may be inactive. The filenames in this list contain only those files that are not "newly created" but modified. More...
 
std::vector< string > getNewFilesToExport ()
 assembles a list of new files which are to be exported (only the files for which one selected a quantity are exported here) This is a compact view onto the contained data, since multiple items may be imported from a single file and some files may be inactive. The filenames in this list contain only those files that are not "newly created" but modified. More...
 
 modifyDesign (Structure database, int sample_number, string design_path="", bool do_not_check_settings=false)
 modifies a design on disk More...
 
 removeFileFromList (string filename)
 removes all import data from item list which is associated with the sepcified file More...
 
 setBasePath (string path)
 sets a new base path. This includes changing the relative path definition of the already parsed files. More...
 
 setExportDesign (number item, string design_ident="")
 sets if the quantity ident of an item More...
 
 setExportQuantity (number item, string quantity_ident="")
 sets if the quantity ident of an item More...
 
 setExportSource (number item, ExportItemInfo::DataSource source)
 sets if the source of an item More...
 

Public Attributes

::ansys::ANSYS_Mechanical_DSDAT_Settings ANSYS_DSDAT_settings
 contains settings for the ANSYS DS.DAT modifier
 
string base_path
 defines the base path is stored as absolute path do never change it directly! Please use setBasePath() instead!
 
bool fmop_use_sampling_bounds
 if true, the point to be approximated by FMOP, must be within the original sampling bounds.
 
ExportItemInfoVector items
 stores all parsed data item information
 
bool mesh_smoothening
 defines if the deviation is applied with smoothening if true: use iterative smoothening, if false: use no smoothening. Default: false. mesh smoothening works with distance fields and without.
 
bool throw_error_on_unstable_mesh
 defines if an error is thrown in the case then mesh smoothening was not successful.
 
bool use_distancefield
 defines the method for applying geometric variations if false: Use a normal vector on the boundary. if true: Use an iterative distance field strategy
 

Detailed Description

defines information on imported data and files given a reference design This class contains settings for an example design directory (the base_path). These settings include file formats, data items to be imported etc.

Note
The currently stored data must be kept "functional" at all times. If you add a new file using the appropriate function, this will take care for you. If you change the data items from outside (GUI etc.) you must use the function check() in order to approve the changes. If the changes are erroneous, the next addFIle-method call may lead to undefined behaviour.

Constructor & Destructor Documentation

◆ ExportReferenceDesign()

ExportReferenceDesign ( string  the_base_path)

constructor

Parameters
the_base_pathdefines the base path

Member Function Documentation

◆ addFile_Abaqus()

addFile_Abaqus ( Structure  database,
string  filename 
)

Exports information to a file in Abaqus format.

Multiple data items per file are supported.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be MODIFIED. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_ANSYS_MechanicalDat()

addFile_ANSYS_MechanicalDat ( Structure  database,
string  filename 
)

Exports information to a file in ANSYS format.

Deprecated:

Multiple data items per file are supported.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be MODIFIED. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_CSV()

addFile_CSV ( Structure  database,
string  filename 
)

Exports information to a file in CSV format.

Deprecated:

A CSV file will always be rewritten. It further contains all available scalar quantities.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_ElementDataCSV()

addFile_ElementDataCSV ( Structure  database,
string  filename 
)

Exports information to a file in CSV format.

Deprecated:

A CSV file will always be rewritten. It further contains the selected element quantity.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_ExternalDataCSV_Disp()

addFile_ExternalDataCSV_Disp ( Structure  database,
string  filename 
)

Exports information to a file in External data CSV format.

Deprecated:

A CSV file will always be rewritten. It further contains the selected node quantity.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_ExternalDataCSV_ElementData()

addFile_ExternalDataCSV_ElementData ( Structure  database,
string  filename 
)

Exports information to a file in External data CSV format.

Deprecated:

A CSV file will always be rewritten. It further contains the selected node quantity.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_ExternalDataCSV_NodeData()

addFile_ExternalDataCSV_NodeData ( Structure  database,
string  filename 
)

Exports information to a file in External data CSV format.

Deprecated:

A CSV file will always be rewritten. It further contains the selected node quantity.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_Image()

addFile_Image ( Structure  database,
string  filename 
)

Exports information to an image file.

Deprecated:

Multiple data items per file are supported.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be MODIFIED. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_LSDynaK()

addFile_LSDynaK ( Structure  database,
string  filename 
)

Exports information to a file in LS-DYNA K format.

Multiple data items per file are supported.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be modified. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_Nastran()

addFile_Nastran ( Structure  database,
string  filename 
)

Exports information to a file in Nastran format.

Multiple data items per file are supported.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be MODIFIED. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_NodeDataCSV()

addFile_NodeDataCSV ( Structure  database,
string  filename 
)

Exports information to a file in CSV format.

Deprecated:

A CSV file will always be rewritten. It further contains the selected node quantity.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_PERMAS()

addFile_PERMAS ( Structure  database,
string  filename 
)

Exports information to a file in PERMAS format.

Multiple data items per file are supported.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be MODIFIED. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_SingleSignalCSV()

addFile_SingleSignalCSV ( Structure  database,
string  filename 
)

Exports information to a file in CSV format.

Deprecated:

A CSV file will always be rewritten. It further contains the selected node quantity. The first column will not denote the node ID, but the respective x-coordinate

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addFile_STL()

addFile_STL ( Structure  database,
string  filename 
)

Exports information to a file in binary STL format.

Deprecated:

Multiple data items per file are supported.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be MODIFIED. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addNewFile_ANSYS_MechanicalDat()

addNewFile_ANSYS_MechanicalDat ( Structure  database,
string  filename 
)

Exports information to a file in ANSYS format.

Multiple data items per file are supported.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be MODIFIED. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addNewFile_CSV()

addNewFile_CSV ( Structure  database,
string  filename 
)

Exports information to a file in CSV format.

A CSV file will always be rewritten. It further contains all available scalar quantities.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addNewFile_ElementDataCSV()

addNewFile_ElementDataCSV ( Structure  database,
string  filename 
)

Exports information to a file in CSV format.

A CSV file will always be rewritten. It further contains the selected element quantity.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addNewFile_ExternalDataCSV_Disp()

addNewFile_ExternalDataCSV_Disp ( Structure  database,
string  filename 
)

Exports information to a file in External data CSV format.

A CSV file will always be rewritten. It further contains the selected node quantity.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addNewFile_ExternalDataCSV_ElementData()

addNewFile_ExternalDataCSV_ElementData ( Structure  database,
string  filename 
)

Exports information to a file in External data CSV format.

A CSV file will always be rewritten. It further contains the selected node quantity.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addNewFile_ExternalDataCSV_NodeData()

addNewFile_ExternalDataCSV_NodeData ( Structure  database,
string  filename 
)

Exports information to a file in External data CSV format.

A CSV file will always be rewritten. It further contains the selected node quantity.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addNewFile_Image()

addNewFile_Image ( Structure  database,
string  filename 
)

Exports information to an image file.

Multiple data items per file are supported.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be MODIFIED. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addNewFile_NodeDataCSV()

addNewFile_NodeDataCSV ( Structure  database,
string  filename 
)

Exports information to a file in CSV format.

A CSV file will always be rewritten. It further contains the selected node quantity.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addNewFile_SingleSignalCSV()

addNewFile_SingleSignalCSV ( Structure  database,
string  filename 
)

Exports information to a file in CSV format.

A CSV file will always be rewritten. It further contains the selected node quantity. The first column will not denote the node ID, but the respective x-coordinate

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be WRITTEN. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ addNewFile_STL()

addNewFile_STL ( Structure  database,
string  filename 
)

Exports information to a file in binary STL format.

Multiple data items per file are supported.

Parameters
databaseThe current database where the items are to be extracted from
filenameThe file to be MODIFIED. The file path will be treated as relative to the base_path or if this is not existing, take it as absolute path respective relative to the working directory

◆ check()

check ( Structure  database)

checks if the settings are valid and produces an error.

Parameters
databasethe data base
Exceptions
exceptionif an error was detected

◆ checkFiles()

checkFiles ( string  abs_design_dir_path,
bool  quiet = false 
)

checks if all required files to be exported to exist in the given design directory

Parameters
abs_design_dir_paththe path of the design directory to be checked
quietif true, then no log message is printed
Exceptions
exceptionif at least one required object is missing for exporting the design for the given sample number.

◆ checkObjects()

checkObjects ( Structure  database,
int  sample,
bool  quiet = false 
)

checks if all required objects for the given design number are existing in the database

Parameters
databasethe data base
samplethe sample number used to generate the sample design idents
quietif true, then no log message is printed
Exceptions
exceptionif at least one required object is missing for exporting the design for the given sample number.

◆ generateScriptOfSettingsDefinition()

string generateScriptOfSettingsDefinition ( string  variable_ident,
string  other_base_path = "" 
)

generates a script string (Lua) that is used to build up the current settings object.

Returns
the script code, ends with newline.
Parameters
variable_identthe ident of the Lua variable that contains the settings object
other_base_pathif this string is empty, then this string is used as the base path of the exported definition. This must be a Lua variable, so either a Lua variable name or a string containing the path

◆ getFiles()

std::vector<string> getFiles ( )

assembles the complete list of files being known to this class This is a compact view onto the contained data, since multiple items may be imported from a single file.

Returns
a list of filenames. The file names are relative to the base path.

◆ getFilesToExport()

std::vector<string> getFilesToExport ( )

assembles a list of files which are to be exported (only the files for which one selected a quantity are exported here) This is a compact view onto the contained data, since multiple items may be imported from a single file and some files may be inactive.

Returns
a list of filenames. The file names are relative to the base path.

◆ getItem()

ExportItemInfo getItem ( string  filename,
ExportItemInfo::Type  data_type 
)

gets the respective item if existing

Parameters
filenamethe filename relative to the base directory
data_typethe data type, e.g. "coordinate along x direction"
Returns
a writable reference to the item. Throws an exception if not existing

◆ getItemIndex()

number getItemIndex ( string  filename,
ExportItemInfo::Type  data_type 
)

gets the index of the respective item if existing

Parameters
filenamethe filename relative to the base directory
data_typethe data type, e.g. "coordinate along x direction"
Returns
index to the item in the vector items. Throws an exception if not existing

◆ getItemsForFile()

std::vector<number> getItemsForFile ( string  filename)

assembles a list of items which are to be exported to a specific file

Parameters
filenamethe file name for which all items to be imported are searched.
Returns
a list of integer indices in ascending order. Each index refers to an Item in the vector items. If no data is to be imported from the requested file, an empty list is returned.

◆ getModifiedFiles()

std::vector<string> getModifiedFiles ( )

assembles the complete list of files being known to this class and that are NOT to be created This is a compact view onto the contained data, since multiple items may be imported from a single file.

Returns
a list of filenames. The file names are relative to the base path.

◆ getModifiedFilesToExport()

std::vector<string> getModifiedFilesToExport ( )

assembles a list of modified files which are to be exported (only the files for which one selected a quantity are exported here) This is a compact view onto the contained data, since multiple items may be imported from a single file and some files may be inactive. The filenames in this list contain only those files that are not "newly created" but modified.

Returns
a list of filenames. The file names are relative to the base path.

◆ getNewFilesToExport()

std::vector<string> getNewFilesToExport ( )

assembles a list of new files which are to be exported (only the files for which one selected a quantity are exported here) This is a compact view onto the contained data, since multiple items may be imported from a single file and some files may be inactive. The filenames in this list contain only those files that are not "newly created" but modified.

Returns
a list of filenames. The file names are relative to the base path.

◆ modifyDesign()

modifyDesign ( Structure  database,
int  sample_number,
string  design_path = "",
bool  do_not_check_settings = false 
)

modifies a design on disk

Parameters
databasethe data base where all data is to be added
sample_numberthe design number which is used to define the design ident string for all data in the database
design_pathif this is empty, one takes the base_path. Else one takes this string instead of this->base_path
do_not_check_settingsif this is true, then the contents of design_info will not be checked on validity before starting the import. This is helpful when importing multiple designs at once. If this settings object is configured to check on duplicates in the global database, then a duplicate would be found after import of the first design always leading to an error! In this case, set this parameter to true. If an error appears during import, an exception is thrown. Nevertheless, the method tries to import as much data as possible before quit.

◆ removeFileFromList()

removeFileFromList ( string  filename)

removes all import data from item list which is associated with the sepcified file

Parameters
filenamethe file name of the file which is to be removed from import item list (exact match!).
Exceptions
exceptionsif the file does not exist in the list.

◆ setBasePath()

setBasePath ( string  path)

sets a new base path. This includes changing the relative path definition of the already parsed files.

Parameters
paththe base path

◆ setExportDesign()

setExportDesign ( number  item,
string  design_ident = "" 
)

sets if the quantity ident of an item

Parameters
itemthe index in items vector
design_identthe design ident to be exported (if empty: use the current design number) /

◆ setExportQuantity()

setExportQuantity ( number  item,
string  quantity_ident = "" 
)

sets if the quantity ident of an item

Parameters
itemthe index in items vector
quantity_identthe quantity ident to be exported (if empty: do not export this item)

◆ setExportSource()

setExportSource ( number  item,
ExportItemInfo::DataSource  source 
)

sets if the source of an item

Parameters
itemthe index in items vector
sourcedefines where the data object is taken from /

Connect with Ansys