Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

ExportDesigns Class Reference

Last update: 16.07.2025

A struct collecting export information for various design directories. More...

Public Member Functions

 check (Structure database)
 Checks validity of these data. More...
 
 ExportDesigns (Structure database, ExportReferenceDesign reference_design)
 Initializes defaults and starts a first filesystem scan. ( Structure ) More...
 
TUIntVector getDesignNumbers ()
 Generates a list of all design sample numbers. More...
 
string getDesignNumbersString ()
 generates the defined design range intervals as a string More...
 
DataObjectContainer::string_vector_type getDesignPathNames ()
 generates a list of all design directory path names () More...
 
 modifyDesigns (Structure database)
 Exports multiple designs to disk. More...
 
 scanDesignRanges (Structure database)
 Scans the base path for design directories. ( Structure ) More...
 
 setDesignNumbers (string design_ranges)
 Sets the design number intervals given as string The method calls unifyDesignNumbers(); to ensure uniqueness of the defined design numbers. () More...
 
 unifyDesignNumbers ()
 Unifies the design numbers This method ensures that each design number appears at most once in the design interval definition. () More...
 

Public Attributes

string base_path
 Base path (absolute path) More...
 
string design_name_format
 Format string for identifying design directories. More...
 
TUIntVector ranges_from
 Defines ranges of the design directories, specifically the left interval boundaries. More...
 
TUIntVector ranges_to
 Defines ranges of the design directories, specifically the right interval boundaries. More...
 
ExportReferenceDesign reference_design
 Stores the information on the reference design/design template (defines which data to be imported) More...
 

Detailed Description

A struct collecting export information for various design directories.

Constructor & Destructor Documentation

◆ ExportDesigns()

ExportDesigns ( Structure  database,
ExportReferenceDesign  reference_design 
)

Initializes defaults and starts a first filesystem scan. ( Structure )

At first, the constructor tries to generate a suiteable base path and design template string:

Parameters
reference_designThe reference design object ( Structure )
databaseThe database were all data is stored

Member Function Documentation

◆ check()

check ( Structure  database)

Checks validity of these data.

  • If any of the specified directories, design IDs or files does not exist, an exception is thrown
  • It also checks the validity of the reference design
  • It further checks if any of the objects to be exported does not exist.
Parameters
databaseThe data base where all the data is stored

◆ getDesignNumbers()

TUIntVector getDesignNumbers ( )

Generates a list of all design sample numbers.

Returns
A vector of integer numbers where each number represents the design identifier used in the SoS database. The vector indices correspond to the vector of ImportDesigns::getDesignPathNames

◆ getDesignNumbersString()

string getDesignNumbersString ( )

generates the defined design range intervals as a string

Returns
the design range string, eg. "1-4;6-10;12;15-20"

◆ getDesignPathNames()

generates a list of all design directory path names ()

Returns
A vector of strings where each string represents the design path name. Each path name is a valid directory name (already includes the base_path). ()

◆ modifyDesigns()

modifyDesigns ( Structure  database)

Exports multiple designs to disk.

This method tries to export as much data as possible and does even proceed in case of errors. Important: the design directories to be exported to must already exist.

Parameters
databaseThe data base where all data is contained.

◆ scanDesignRanges()

scanDesignRanges ( Structure  database)

Scans the base path for design directories. ( Structure )

Depending on the currently storred information (base path, design name properties, defined files in the reference design) the design directories are determined and the ranges of the indicies are stored in ranges_from and ranges_to. Only design directories are accepted which contain ALL of the files being contained in the reference path! ( Structure ) Furthermore, only those design numbers are accepted for which all objects to be exported exist in the database.

Parameters
databaseThe database where all data are stored

◆ setDesignNumbers()

setDesignNumbers ( string  design_ranges)

Sets the design number intervals given as string The method calls unifyDesignNumbers(); to ensure uniqueness of the defined design numbers. ()

Parameters
design_rangesThe string to be interpreted, must be of format "1-4;12;15-20;" or "1-4" or "1" or "".
Exceptions
anexception If the string can not be interpreted. In this case, the definition is not changed. ()

◆ unifyDesignNumbers()

unifyDesignNumbers ( )

Unifies the design numbers This method ensures that each design number appears at most once in the design interval definition. ()

()

Member Data Documentation

◆ base_path

string base_path

Base path (absolute path)

◆ design_name_format

string design_name_format

Format string for identifying design directories.

Format strings shall be defined as Perl Regular Expressions including one sub-expression which defines the design ID, eg.

Design_?(\d+)$

which matches the string Design, followed by one or no underscore and a sub-expression of one or more digits until the end of the string. The digit group will be used as unique design number within the database. Other examples might be

Design_?(\d\d)$

which expects exactly 2 digits, or

first/.*/Design_?(\d{1,5})/dp\d{2}/mech$

which matches the directory 'first' relative to base_path, any of its subdirectories, a Design directory consisting of one or 5 digits (zero should be avoided as internal design numbers must be generated in that case), an ANSYS dp subdirectory composed of the dp string followed by exactly 2 digits and as last acceptable subdirectory the string mech. For further common pittfalls - like the maximum sub directory level - refer to DesignScanner::filter ( string )

◆ ranges_from

TUIntVector ranges_from

Defines ranges of the design directories, specifically the left interval boundaries.

◆ ranges_to

TUIntVector ranges_to

Defines ranges of the design directories, specifically the right interval boundaries.

Must have the same dimensions as #ImportDesings::ranges_from

◆ reference_design

ExportReferenceDesign reference_design

Stores the information on the reference design/design template (defines which data to be imported)

Connect with Ansys