Project

Project
This namespace holds top-level commands and queries related to the Project, File and Units.

AbandonBackgroundTasks

Abandon all pending background tasks from last update.

AbandonTopLevelBackgroundDesignPointUpdate

Abandon all top-level pending background DP updates if none is running.

AddPropertyTable

This command is used to allow the expression of a property to reference data in the named table. This is a reference and not a copy, and so if the table is used in the expression, and a change is made on the referenced table and the change is in the data being referenced the value of the property will be modified. The command creates table functions in the context of this expression which can be used with constants, field variables, or another named expression. If the property does not support an expression an error will occur.

Return     An int which corresponds to the Index passed in to the command and indicates the comand successfully completed.
    Type     int

Required Arguments

Dependents    A List of the column index(es) to use from the Table which correspond to the dependent variable(s) of the Property. The indexes can be an Integer index or the String name of the column.
    Type     List<Object>
Independents    A List of the column index(es) to use from the Table for use in the expression and correspond to the independent variables of the Property. The indexes can be an Integer index or the String name of the column.
    Type     List<Object>
Index    An integer which uniquely identifies the Table for use in the expression of the Property. In the expression this table can be accessed via tableIndex(args). The table with an index of one can be accessed in the expression as table(args) or table1(args).
    Type     uint
Parent    The DataReference of the object which has the Property that the Table should be added to.
    Type     DataReference
Property    The String which provides the path of the property on the Parent.
    Type     string
Table    The DataReference of the table to add to the Property.
    Type     DataReference

Optional Arguments

Bounds    An enum which describes what will occur when the index is outside of the bounds of the table. The valid enum values are; Constant, Fit, Zero, and Error. The default is Error.
    Type     TableInterpolationBeyondBounds
    Default Value    Error
Interpolation    An enum of the type of interpolation to use when accessing data from the table at a given index. The valid enum values are; None, Linear, Cubic Spline. The default is Linear.
    Type     TableInterpolation
    Default Value    Linear
Example

    tbl1 = pressure1.CreateTable(Columns=[[“X”, “Length”], [“Y”, “Length”], [“Z”, “Length”], [“Pressure”, “Pressure”], [“Temperature”, “Temperature Difference”]])
    #
    # Use three of the columns from tbl1
    bc1.AddPropertyTable(Property=“Magnitude”, Table=tbl1, Index=1, Independents=[“X”, “Y”], Dependents=[“Pressure”])
    # In the table function the x and y refer to field variables
    bc1.SetPropertyExpression(Entity=bc1, Name=“Magnitude”, Expresssion=“table1(x, y)”)
    #
    # Use four of the columns from tbl1
    bc1.AddPropertyTable(Property=“Temperature”, Table=tbl1, Index=1, Independents=[“X”, “Y”, “Z”], Dependents=[“Temperature”])
    # In the table function the x, y, and z refer to field variables
    bc1.SetPropertyExpression(Entity=bc1, Name=“Temperature”, Expression=“table1(x, y, z)”)
    #
    # Use two of the columns from tbl1
    bc1.AddPropertyTable(Property=“Magnitude”, Table=tbl1, Index=1, Independents=[“X”], Dependents=[“Pressure”])
    # In the table function the x refers to field variables
    bc1.SetPropertyExpression(Entity=bc1, Name=“Magnitude”, Expression=“table1(x)”)
    #
    # Use of a constant
    bc1.SetPropertyExpression(Entity=bc1, Name=“Magnitude”, Expression=“table1(20)”)

AddSourceToComponentInSystem

Add a connection between two components in the same system.

Required Arguments

SourceComponent    A reference to the component providing data.
    Type     DataReference
TargetComponent    A reference to the component receiving data.
    Type     DataReference

AddTableColumn

AddColumn will add a column at the specified index to the table.

Return     The Integer which corresponds to the index of the column which was newly added to the table.
    Type     int

Required Arguments

Name    The String used to uniquely identify the column (case-sensitive) in this table. If the value is not unique an error will occur.
    Type     string
Table    The DataReference of the table to add this column of data.
    Type     DataReference

Optional Arguments

Data     A List of Strings which specifies the data for this column. The String must be a valid Quantity string in the form "value [units]".
   If the size of the list is smaller than the current number of rows the data will be initialized to an undefined value. If the size of the List is greater than the current number of rows then an error will occur.
    Type    List<Quantity>
Index    The Integer index of the location for the newly added column. An index of 0 (zero) will add to the left-most side of the table. The default is to add the column to the right-most side of the table.
    Type     int
PhysicalQuantity    The String for the physical quantity (e.g. Density, Pressure, etc.) used to verify the data has the correct units.
    Type     string
Example

This example illustrates adding columns to a table.

    # NameSpace is the Addin namespace in use (e.g. Study, EngData, etc.)  which may have its specific CreateTable command
    # drParent is the DataReference of an object that has been previously created
    table1 = NameSpace.CreateTable(Parent=drParent, Columns=[])
    table1.AddRow()
    table1.AddRow()
    table1.AddRow()
    table1.AddColumn("Displacement", "Length", Data=["0 [m]",".001 [m]"])
    table1.AddColumn("Temperature","Temperature", Index=0)

AddTableRow

AddRow will add a row at the specified index to the table.

Return     The Integer which corresponds to the index of the row which was newly added to the table.
    Type     int

Required Arguments

Table    The DataReference of the table to add this row of data.
    Type     DataReference

Optional Arguments

Data    A List of Strings which specifies the data for this row. The String must be a valid Quantity string in the form "value [units]".
    Type     List<Quantity>
Index    The Integer index of the location for the newly added row. An index of 0 (zero) will add to the top of the table. The default is to add the row to the end of the table.
    Type     int
Example

This example illustrates adding rows to a table.

    # NameSpace is the Addin namespace in use (e.g. Study, EngData, etc.)  which may have its specific CreateTable command
    # drParent is the DataReference of an object that has been previously created
    table1 = NameSpace.CreateTable(Parent=drParent, Columns=[("Temperature","Temperature"),("Displacement","Length")])
    table1.AddRow(Data=["100 [C]","1.0 [m]"])
    table1.AddRow()
    table1.AddRow(Data=["300 [C]",".06 [m]"])
    table1.AddRow(Index=0, Data=["50 [C]",".001 [m]"])

Archive

Creates a project archive based on current project files and contents. The project must be saved before an archive can be created.

Required Arguments

FilePath    The full file path of the project archive to be created.
    Type     string

Optional Arguments

FailIfMissingFiles    Set to true to force failure if there are any files to repair.
    Type     bool
    Default Value    False
IncludeExternalImportedFiles    Whether to include files imported to the project from external locations.
    Type     bool
    Default Value    False
IncludeSkippedFiles    Whether to include Results and Solution files in the archive.
    Type     bool
    Default Value    True
IncludeUserFiles    Whether to include files in the project user_files directory.
    Type     bool
    Default Value    True
Example

This example creates a project archive from the currently loaded project. The full file path is specified and the argument will include items from the user_files folder, include results/solution files, and exclude external files imported into the project.

    Archive(FilePath=r"C:\Users\AnsUser\simpleStructural.zip",
            IncludeUserFiles=True,
            IncludeSkippedFiles=True,
            IncludeExternalImportedFiles=False,
            FailIfFilesNeedRepair=False)

CleanSystem

Clears generated data on all components in the given system(s).

Required Arguments

Systems    A list of systems to be cleaned.
    Type     List<DataReference>

ClearMessagesBySource

Clears all messages that have no Source from the message store.

Optional Arguments

Source    The optional source of the message.
    Type     Object
SourceUsage    The optional message storage arguments.
    Type     ClearMessagesOption

ClearMessages

Clears all messages from the message store.

ConvertRepositoryFileToLocalFile

Convert a repository file to local file

Required Arguments

File    The reference to the file entity to be converted.
    Type     DataReference

CopyFile

Copies a file to a target directory. Either the SourceFile argument or the SourceFilePath argument must be specified.

Return     A reference to the created file is returned in this argument.
    Type     DataReference

Required Arguments

DestinationDirectoryPath    The full path to the destination directory.
    Type     string
Overwrite    Specifies whether to overwrite an existing files of the same name. Note: A registered file may not be overwritten.
    Type     bool

Optional Arguments

SourceFile    A reference to the file to be copied. A file reference can be obtained from commands and queries like RegisterFileCommand and GetRegisteredFileQuery.
    Type     DataReference
SourceFilePath    A full path to the file to be copied.
    Type     string
Example

This example illustrates a path-based file copy procedure. The specified file will be copied to the specified destination directory path. The destination file will not be registered and the return value will be null.

    CopyFile(SourceFilePath=r"C:\Users\anyuser\myTextFile.txt",
              DestinationDirectoryPath=r"C:\Users\anyuser\newfolder",
              Overwrite=True)             

This second example illustrates a reference-based file copy procedure. The specified file will be copied to the specified destination directory path. The destination file will also be registered and the new reference returned.

    file1 = GetRegisteredFile(FilePath=r"C:\path_to_file\file.txt")
    file2 = CopyFile(SourceFile=file1,
              DestinationDirectoryPath=r"C:\Users\anyuser\newfolder",
              Overwrite=True)             

CreateCustomUnitSystem

Creates a custom unit system based on predefined unit system (e.g., MKS, US Customary) or other custom unit sytem already defined.

Return     A reference to the created UnitSystem data entity.
    Type     DataReference

Required Arguments

BaseUnitSystemName    The internal name of the unit system that is the basis for the newly created system.
    Type     string
UnitSystemDisplayName    The displayed name of the new unit system.
    Type     string
UnitSystemName    The internal name of the new unit system.
    Type     string
Example

This example illustrates the creation of a custom unit system.

    myUnitSystem = CreateCustomUnitSystem(UnitSystemName="MyUnitSystem",
                                          UnitSystemDisplayName="My Custom Unit System",
                                          BaseUnitSystemName="SI")

CreateTemplateFromProject

Creates a Project Template from the current project and adds it to the list of Custom systems.

Return     A reference to the created CustomProjectTemplate entity.
    Type     DataReference

Required Arguments

Name    The name of the created template.
    Type     string

CreateUnitSystem

Creates the UnitSystem data entity for the named system.

Return     A data reference to the created UnitSystem entity.
    Type     DataReference

Required Arguments

UnitSystemName    The internal name of the unit system to be created.
    Type     string

DeleteFile

Deletes the specified file. Either the File argument or the FilePath argument must be specified.

Optional Arguments

BackUp    Specifies whether to back up the file before deletion. This optional argument's default value is true.
    Type     bool
    Default Value    True
DeleteIfShared    Specifies whether a registered file should be deleted even if it is still in use. This optional argument's default value is true. If this argument's value is false, an exception will be thrown if a shared file is encountered. To avoid the exception, set ErrorIfShared to false.
    Type     bool
    Default Value    False
ErrorIfShared    Specifies whether to throw an exception when trying to delete a shared file if DeleteIfShared is set to false.
    Type     bool
File    A reference to the file to be deleted. A file reference can be obtained from commands and queries like RegisterFileCommand and GetRegisteredFileQuery.
    Type     DataReference
Example

The following example illustrates a simple file deletion; file is not deleteed if it is registered.

    DeleteFile(FilePath=r"C:\Users\anyuser\path-to-file.extension")

The next example illustrates forced file deletion.

    DeleteFile(FilePath=r"C:\Users\anyuser\path-to-file.extension", DeleteIfShared=True)

The next example illustrates a deletion of a registered file via a file reference. The file will be deleted if even if it is still in use. Note that the file will be backed up.

    fileRef = GetRegisteredFile(FilePath=r"C:\Users\anyuser\path-to-file.extension")
    DeleteFile(File=fileRef, DeleteIfShared=True,
                   BackUp=True)

The final example illustrates a deletion of a registered file via a file reference without a forced deletion. If the file is shared, an error will not occur, and the file reference count will be decremented.

    fileRef = GetRegisteredFile(FilePath=r"C:\Users\anyuser\path-to-file.extension")
    DeleteFile(File=fileRef, ErrorIfShared=False)

DeleteTableColumn

DeleteColumn will delete a column at the specified index from the table.

Required Arguments

Index     An Integer index or the String name of the column (case-sensitive) to remove from the table. The first column has an index of 0 (zero).
    Type     Object
Table    The DataReference of the table to delete the column from.
    Type     DataReference
Example

This example illustrates removing a column from a table.

    # NameSpace is the Addin namespace in use (e.g. Study, EngData, etc.)  which may have its specific CreateTable command
    # drParent is the DataReference of an object that has been previously created
    table1 = NameSpace.CreateTable(Parent=drParent, Columns=[("Temperature","Temperature"),("Displacement","Length")])
    table1.AddRow(Data=["100 [C]","1.0 [m]"])
    table1.AddRow(Data=["200 [C]",".02 [m]"])
    table1.AddRow(Data=["300 [C]",".06 [m]"])
    table1.DeleteColumn(Index='Displacement')

DeleteTableRow

DeleteRow will delete a row at the specified index from the table.

Required Arguments

Index    The Integer index of the row to remove from the table. The row indexes for the table begin at 0 (zero).
    Type     int
Table    The DataReference of the table to delete the row from.
    Type     DataReference
Example

This example illustrates removing a row from a table.

    # NameSpace is the Addin namespace in use (e.g. Study, EngData, etc.)  which may have its specific CreateTable command
    # drParent is the DataReference of an object that has been previously created
    table1 = NameSpace.CreateTable(Parent=drParent, Columns=[("Temperature","Temperature"),("Displacement","Length")])
    table1.AddRow(Data=["100 [C]","1.0 [m]"])
    table1.AddRow(Data=["200 [C]",".02 [m]"])
    table1.AddRow(Data=["300 [C]",".06 [m]"])
    table1.DeleteRow(Index=2)

DeleteTabularDataRow

Delete a row from a tabular data sheet.

Required Arguments

Index    Index of the row to delete.
    Type     int
TabularData    Data Entity that can be bound to ITabularDataWrite
    Type     DataReference

Optional Arguments

SheetName    Name of the sheet to access.
    Type     string
SheetQualifiers    SheetQualifiers is used to pass in the qualifiers to select between multiple sheets witht the same name. This is a dictionary of the Qualifier and its Value.
    Type     Dictionary<string, string>
Example

The following example illustrates the deletion of a row from a tabular data sheet.

    #
    # Create a new Engineering Data System and access Structural Steel
    #
    template1 = GetTemplate(TemplateName="EngData")
    system1 = template1.CreateSystem()
    engineeringData1 = system1.GetContainer(ComponentName="Engineering Data")
    matl1 = engineeringData1.GetMaterial(Name="Structural Steel")
    #
    # Delete the first row in the Density property
    #
    matlProp1 = matl1.GetProperty(Name="Density")
    matlProp1.DeleteTabularDataRow(Index = 0)
    #
    # Delete the first row in the Coefficient of Thermal Expansion property with optional SheeetNamea nd SheetQualifiers
    #
    matlProp2 = matl1.GetProperty(Name="Coefficient of Thermal Expansion")
    matlProp2.DeleteTabularDataRow(
                      SheetName="Coefficient of Thermal Expansion",
                      SheetQualifiers={"Definition Method": "Secant", "Behavior": "Isotropic"},
                      Index = 0)

DeleteUnitSystem

Deletes the named unit system.

Required Arguments

UnitSystemName    The name of the unit system to delete.
    Type     string

DownloadRepositoryFile

Download the specified file from repository

Return     Holds the reference to the Repository file as the output value.
    Type     DataReference

Required Arguments

RepositoryFile    The repository file info to be downloaded
    Type     RepositoryFileInfo

ExportReport

Writes out project report containing both framework- and addin-supplied content. The report output is XML in accordance to EKM schema. If the file path extension is html, the XML will be converted to an html output file.

Required Arguments

FilePath    The full destination file path for the reporting. If the extension is .xml, the report will be produced in XML format per EKM schema. If the extension is .html, the report will be poduced using the EKM schema-certified XML and then translated in html.
    Type     string

ForceReleaseOfReservedLicenses

release the license reservation held by a given reservation key, if the reservation key matches the id reserved by the project then the reservation record and reservation count stored in the project is deleted. The id doesn't have to be supplied in which case the value used is the id reserved by the project.

Optional Arguments

ReservationId    This parameter field stores the reservation id to release. If the parameter value matches the id reserved by the project then the reservation record and reservation count stored in the project is deleted. The default value is the id reserved by the project.
    Type     string

GetAbsoluteUserPathName

Gets the absolute user path name for the given relative path name, based on the current setting of the user path root. See also GetUserPathRoot and SetUserPathRoot.

Return     The returned absolute user path name.
    Type     string

Required Arguments

RelativePathName    The relative path name.
    Type     string
Example

This example uses the SetUserPathRoot and GetAbsoluteUserPathName to read a project from two different user directories.

    SetUserPathRoot(DirectoryPath = "C:/Users/myUser1/Projects")
    Open(FilePath=GetAbsoluteUserPathName("proj1.wbpj")) # Read project from first location
    SetUserPathRoot(UserPathRoot = "C:/Users/myUser2/Projects")
    Open(FilePath=GetAbsoluteUserPathName("proj1.wbpj")) # Read project from second location

GetAllFiles

Gets the list of all files that have been registered with the project (even if external to the project directory) or exist within the project files directory.

Return     List of paths to all known project files.
    Type     List<string>

GetAllSystems

Query to return the set of Data References to all System entities in the project.

Return     Data Reference set of Systems
    Type     DataReferenceSet

GetComponentTemplate

Query to return the Data Reference to the Component Template of the given name.

Return     Component Template Data Reference.
    Type     DataReference

Required Arguments

Name    Full name of the Component Template.
    Type     string

GetCurrentRegisteredFiles

Gets the files registered with the project.

Return     The set of data references to registered files.
    Type     DataReferenceSet

GetDesignPointUpdateSettings

Query to return the singleton DesignPointSolveSettings.

Return     DesignPointSolveSettings Data Reference.
    Type     DataReference

GetFileReference

Gets the File Reference to a registered file based upon the file reference's name. Throws an Invalid Operation Exception if a matching File Reference is not found.

Return     The data reference of the file whose name matches the supplied parameter.
    Type     DataReference

Required Arguments

Name    The file reference name.
    Type     string

GetFilesForDirectory

Gets the set of data references to registered files within a directory.

Return     The set of data references to files in the directory.
    Type     DataReferenceSet

Required Arguments

DirectoryPath    The full path to the directory.
    Type     string

GetFileType

Returns a reference to a FileType data entity, given the data entity name of the FileType object.

Return     The data reference to the FileType data entitity.
    Type     DataReference

Required Arguments

Name    The data entity name of the FileType object.
    Type     string

GetFrameworkBuildVersion

Get the current framework build version.

Return     Return the framework build version.
    Type     string

GetFrameworkVersion

Get the currently executing framework version.

Return     Return the currently executing framework version.
    Type     string

GetLicenseNames

Query to return license features ID and names.

Return     Returns license feature IDs along with readible names.
    Type     Dictionary<string, string>

GetMaxProjectPathLength

Gets the max project path length created in WorkBench based on the project directory and project name.

Return     The max project path length
    Type     int

Required Arguments

ProjectDirectory    The full path to the project directory.
    Type     string
ProjectName    The project name
    Type     string

GetMessages

Returns DataReferences for all stored messages, ordered by message publication date/time with most recent messages first.

Return     The list of StoredMessage data entities for current messages.
    Type     DataReferenceSet

GetNeededLicenses

Query to return the needed licenses to update project.

Return     Needed licenses based on previous updates, with license feature ID as key, along with needed count.
    Type     Dictionary<string, int>

GetPersistedProjectVersion

Given the path to a WB project, return the last-saved-in version. Note: The command will return '00' if a project is not supplied and the current session project has not been saved.

Return     The Project's persisted version (e.g, 120, 121, 130, 140, 145, ...).
    Type     string

Optional Arguments

FilePath    The Project File Path (wbpj).
    Type     string

GetProjectDirectory

Gets the full path to the current project directory.

Return     The project directory full path.
    Type     string

GetProjectFile

Gets the full path of the current project file (*.wbpj).

Return     The full path of the current project file.
    Type     string

GetProjectTemplate

Query to return the Project Template of the given name.

Return     Project Template Data Reference.
    Type     DataReference

Required Arguments

Name    Full name of the Project Template.
    Type     string

GetProjectUnitSystem

Gets the current unit system for the project.

Return     A reference to the UnitSystem data entity.
    Type     DataReference

GetPropertyExpression

Gets the expression defining a data entity property's value.

Return     Returns the expression that currently defines the property's value.
    Type     string

Required Arguments

Entity    The entity to query.
    Type     DataReference
Name    The property name or member path.
    Type     string

GetQuantityUnitForUnitSystem

Gets the unit for a quantity in the specified unit system.

Return     The current Unit for the quantity.
    Type     string

Required Arguments

QuantityName    The name of the Quantity of interest.
    Type     string
UnitSystemName    The internal name of the unit system.
    Type     string

GetRegisteredFile

Gets the File Reference to a registered file based upon the file's path.

Return     The data reference of the file whose location points to the specified path. Null if no data reference is found.
    Type     DataReference

Required Arguments

FilePath    The full path of the file.
    Type     string

GetRegisteredFilesForDirectory

Gets list of File References for a directory path.

Return     The list of data reference of files whose location root is DirectoryPath. Empty list if no data reference is found.
    Type     DataReferenceSet

Required Arguments

DirectoryPath    The full path to the directory.
    Type     string

GetRsmQueues

Query to return Rsm queue names from available configured queues when Rsm is running using the new architecture

Return     List of Rsm queues names, or null if configured queues are not available
    Type     List<string>

GetSchematicSettings

Query to return the singleton SchematicSettings.

Return     SchematicSettings Data Reference.
    Type     DataReference

GetScriptVersion

returns the software version that the current script that is being executed is compliant with

Return     the software version that the current script that is being executed is compliant with
    Type     string

GetSystem

Query to return the Data Reference to the system of the given name.

Return     System Data Reference
    Type     DataReference

Required Arguments

Name    Full name of the System
    Type     string

GetTableData

GetData will return the data in a table.

Return     A List of Strings or a List of List of Strings for the requested range.
    Type     List<Object>

Required Arguments

Table    The DataReference of the table to get data from.
    Type     DataReference

Optional Arguments

ColumnRange    A Tuple of the column starting index and ending index to access the data. The default is (0, maximumColumns - 1). A single index may be used also to return a single column. The first column has an index of 0 (zero).
    Type     Object
RowRange    A Tuple of the row starting index and ending index to access the data. The default is (0, maximumRows - 1). A single index may be used also to return a single row. The first row has an index of 0 (zero).
    Type     Object
Example

This example illustrates data retrieval from a table.

    # drParent is the DataReference of an object that has been previously created
    table1 = drParent.CreateTable(Columns=[("Temperature","Temperature"),("Displacement","Length")])
    table1.AddRow(Data=["100 [C]","1.0 [m]"])
    table1.AddRow(Data=["200 [C]",".02 [m]"])
    table1.AddRow(Data=["300 [C]",".06 [m]"])
    table1.GetData(RowRange=1) # get the second row of the table
    table1.GetData(RowRange=(1,2)) # get the second and third row of the table
    table1.GetData() # complete table in row-major
    # Get table as column major
    numCol = len(table1.GetData(RowRange=0))
    colMajorArr = [0 for i in range(numCol)]
    for colIdx in range(numCol):
        colMajorArr[colIdx] = [row[colIdx] for row in table1.GetData()]
    colMajorArr

GetTabularData

Returns the tabular data associated with the data entity.

Return     The returned data in scalar, list, or dictionary format.
    Type     Object

Required Arguments

TabularData    Data entity that has associated tabular data.
    Type     DataReference

Optional Arguments

AsDictionary    If set to true, the data will be returned as a dictionary where the keys are variable names and the values are the data for each variable. If set to false, the data will be returned in scalar or list format without the variable names.
    Type     bool
    Default Value    False
ColumnMajor    If set to true, the data will be returned in column-major order. If set to false, the data will be returned in row-major order.
    Type     bool
    Default Value    True
EndIndex    The end index for requesting a subset of the data (zero-based).
    Type     int
    Default Value    -2147483647
SheetName    Specifies the sheet name when the data contains multiple sheets.
    Type     string
SheetQualifiers    Used to pass in the qualifiers to select between multiple sheets with the same name. This is a dictionary of qualifiers and values.
    Type     Dictionary<string, string>
StartIndex    The start index for requesting a subset of the data (zero-based).
    Type     int
    Default Value    0
Variables    Names of the variables for which data is requested (string or list of strings).
    Type     Object
Example

In this example, all data is requested for the given tabular data entity.

    tabData1.GetData()

In this example, all data is requested in row-major order.

    tabData1.GetData(ColumnMajor=False)

In this example, all data is requested in dictionary format.

    tabData1.GetData(AsDictionary=True)

In this example, data for variables Density and Temperature is requested in dictionary format.

    tabData1.GetData(Variables=["Density", "Temperature"], AsDictionary=True)

GetAllTeamcenterConnections

A query that returns all Teamcenter geometry connection data

Return     A list of Teamcenter source strings
    Type     List<string>

GetTemplate

Query to return a System Template reference, based on the template name and additional solver specification.

Return     Template Data Reference.
    Type     DataReference

Required Arguments

TemplateName    Generic name of the Template, without any solver-specific designation.
    Type     string

Optional Arguments

Solver    The name of the solver to qualify the specific template.
    Type     string

GetUnitsDisplaySettings

Gets the value of units display settings ("DisplayValuesAsDefined" or "DisplayValuesInProjectUnits").

Return     The current value of the Units display setting.
    Type     string

GetUnitSystem

Gets a reference to the UnitSystem entity of the given internal name.

Return     A reference to the UnitSystem data entity.
    Type     DataReference

Required Arguments

UnitSystemName    The internal name of the unit system.
    Type     string

GetUnitSystemsNames

Gets the internal names of all currently defined unit systems (Predefined and Custom Unit Systems).

Return     A list of the internal names of currently defined unit systems.
    Type     List<string>

GetUserFilesDirectory

Gets the current user_files directory.

Return     The full path to the user_files directory.
    Type     string

GetUserPathRoot

Gets the current user path root.

Return     The user path root.
    Type     string

ImportFile

Imports a file into the project. The result of the import varies, dependent upon the file type's defined import behavior. Usually a corresponding system is created in the project view. Sometimes, the file is simply added to the files view. To be imported, a file's type must be registered and the ImportFileCommandName property must be non-null. Use FileTypeRepository.RegisterFileTypeTemplate or FileTypeTemplateRecord.ImportFileCommandName to specify the command to be invoked when importing a file of a given type.

Required Arguments

FilePath    The full path to the file to import.
    Type     string

Optional Arguments

FileType    The reference to the type of the file to import. If not specified, the type will be inferred from the file's extension.
    Type     DataReference

ImportJournalVariables

Imports any variables defined in the currently-recorded journal file into the scripting environment so they can be accessed in the command window.

ImportProjectInternal

Importing a project into the current project. There are several restrictions / limitations to this

Required Arguments

FilePath    Path to the project to import.
    Type     string

ImportUnitSystem

Imports a unit system from a Units .xml file.

Return     A reference to the created UnitSystem data entity.
    Type     DataReference

Required Arguments

FilePath    The full path to the file to be imported.
    Type     string

Optional Arguments

UnitSystemName    The internal name of the unit system to be created.
    Type     string

IsProjectUpToDate

A query to determine if all systems and their components in the project are fully up to date, that is, NOT even interrupted-but-up-to-date.

Return     The return is True if the project is up to date.
    Type     bool

MergeRsmProject

Merging multiple project tasks solved from RSM design point updates into the current project. This command should *NOT* be used to merge any un-related projects. Solved projects may be either intermediate or final results.

Required Arguments

MergingProjects    The dictionary contains full file path of base project of the RSM project as key, and a dictionary of the full file path to the updated RSM project and its design points to be merged into the current project as value. The file paths can be either standard wbpz file or partial wppz file or wbpj file. If the project is a standard wbpz or partial wppz archive, it will be unpacked to a sub-directory (whose name is the same as archive file name) under the same directory as the wbpz directory first before merging.
    Type     Dictionary<string, Dictionary<string, List<DataReference>>>

Optional Arguments

DoRevertibleSave    Whether do revertible save or not
    Type     bool
    Default Value    True
KeepFilesInRsmProject    Determines whether we should keep the project files from the (unarchived) RSM project after it is merged into the current project. Note that keeping the RSM project will significant slow down the project file merging performance and will require more disk space. If this option is false, it is up to the caller to backup the original project first. Also note that if the ProjectFilePath is a *.wbpz file, it will not be affected.
    Type     bool
    Default Value    True
Overwrite    If the ProjectFilePath is an archive file (*.wbpz), and if the same unpacked project already exists on the same directory, this flag determines whether we should overwrite it.
    Type     bool
SaveFirst    Whether to save the project before merging.
    Type     bool
Example

The following example illustrates how this command may be used to merge all Design Points from RSM-solved projects into the current project. Existing Rsm Project files are retained. Any existing archive with the same name in the destination project will be overwritted. The project will be first saved using a revertible save.

    MergeRsmProject(MergingProjects={(r"Path_to_RSM_Project", {(r"Path_to_current_project", {Updated DesignPoints})})},
                    KeepFilesInRsmProject=True,
                    Overwrite=True,
                    SaveFirst=True,
                    DoRevertibleSave=True)

MoveFile

Moves a file to a new directory. Either the File argument or the FilePath argument must be specified.

Required Arguments

NewDirectoryPath    The full path to the destination directory.
    Type     string

Optional Arguments

BackUp    Specifies whether to back up the file before the move. This optional argument's default value is true.
    Type     bool
    Default Value    True
File    A reference to the file to be moved. A file reference can be obtained from commands and queries like RegisterFileCommand and GetRegisteredFileQuery.
    Type     DataReference
FilePath    A full path to the file to be moved.
    Type     string
Example

This example illustrates a path-based file move procedure. The specified file will be moved to the specified destination directory path.

    MoveFile(FilePath=r"C:\Users\anyuser\myTextFile.txt",
             NewDirectoryPath=r"C:\Users\anyuser\newfolder")             

This second example illustrates a reference-based file move procedure. The specified file will be moved to the specified destination directory path.

    file1 = GetRegisteredFile(FilePath=r"C:\path_to_file\file.txt")
    MoveFile(SourceFile=file1,
             NewDirectoryPath=r"C:\Users\anyuser\newfolder") 

This final example also illustrates a reference-based file move procedure. The specified file will be moved to the specified destination directory path. The file will not be backed up prior to the move.

    file1 = GetRegisteredFile(FilePath=r"C:\path_to_file\file.txt")
    MoveFile(SourceFile=file1,
             NewDirectoryPath=r"C:\Users\anyuser\newfolder",
             Backup=False)

Open

Opens a Workbench project from the specified .wbpj file.

Required Arguments

FilePath    The full path to the project file to open.
    Type     string

Refresh

Refreshes the input data for the entire project by reading changed data from upstream sources. Does not perform any calculations or updates based on the new data.

RegisterFile

Registers the specified file with the project. Either the FilePath argument or the RepositoryFile argument must be specified.

Return     Holds the reference to the registered file as the output value.
    Type     DataReference

Optional Arguments

FilePath    A full path to the file to be registered.
    Type     string
FileType    The reference to the type of the file to register. If not specified, the type will be inferred from the file's extension.
    Type     DataReference
Example

This example illustrates a path-based file registration procedure. The specified file will be registered and the resulting file reference will be returned.

    file1 = RegisterFile(FilePath=r"C:\Users\anyuser\myTextFile.txt")             

This second example illustrates a file type based file registration procedure. The specified file will be registered with the corresponding (supplied) file type and the resulting file reference will be returned.

    fileType1 = GetFileType(Name="MyFileType")
    file1 = RegisterFile(FilePath=r"C:\Users\anyuser\myFile.abc",
                         FileType=fileType1)             

ReleaseReservedLicenses

unreserve the license set for this project from the license server

RemovePropertyTable

Remove a table reference from a property to prevent its use in an expression. If the property does not support an expression an error will occur.

Required Arguments

Index    The integer which uniquely identifies the Table for use in the expression of the Property.
    Type     uint
Parent    The DataReference of the object which has the Property that the Table should be removed from.
    Type     DataReference
Property    The String which provides the path of the property on the Parent.
    Type     string
Example

    tbl1 = pressure1.CreateTable(Columns=[[“X”, “Length”], [“Y”, “Length”], [“Pressure”, “Pressure”]])
    bc1.AddPropertyTable(Property=“Magnitude”, Table=tbl1, Independents=[“X”, “Y”], Dependents=[“Pressure”])
    # In the table function the x and y refer to field variables
    bc1.SetPropertyExpression(Entity=bc1, Name=“Magnitude”, Expression=“table1(x, y)”)
    bc1.RemovePropertyTable(Property=“Magnitude”, Index=1);

RenameFile

Renames a file. Either the File argument or the FilePath argument must be specified.

Required Arguments

NewName    The new file name, excluding the directory path. To change the directory, see MoveFileCommand.
    Type     string

Optional Arguments

BackUp    Specifies whether to back up the file before renaming it. This optional argument's default value is true.
    Type     bool
    Default Value    True
File    A reference to the file to be renamed. A file reference can be obtained from commands and queries like RegisterFileCommand and GetRegisteredFileQuery.
    Type     DataReference
FilePath    A full path to the file to be renamed.
    Type     string
Example

This example illustrates a path-based file rename procedure. The specified file will be renamed with the specified new name.

    RenameFile(FilePath=r"C:\Users\anyuser\myTextFile.txt",
             NewName="myTextFileRENAMED.txt")             

This second example illustrates a reference-based file rename procedure. The specified file reference will be renamed with the specified new name.

    file1 = GetRegisteredFile(FilePath=r"C:\path_to_file\file.txt")
    RenameFile(File=file1,
             NewName="fileRENAMED.txt") 

This final example also illustrates a reference-based file rename procedure. The specified file will be renamed with the specified new name. The file will not be backed up prior to the move.

    file1 = GetRegisteredFile(FilePath=r"C:\path_to_file\file.txt")
    RenameFile(File=file1,
             NewName="fileRENAMED.txt",
             Backup=False)

RenameUnitSystem

Renames a unit system.

Required Arguments

UnitSystemName    The name of the unit system to be changed.
    Type     string
UnitSystemNewName    The new name of the unit system.
    Type     string

ReserveLicenses

reserve the license set for this project with the license server

Reset

Resets Workbench to an empty project. Any unsaved changes in the current project are lost.

Resolve

A command used to resolve the data object to make it consistent with the rest of the data model

Required Arguments

Entity    The entity to resolve.
    Type     DataReference

ResumeBackgroundDesignPointUpdate

Resume given design point update session previously submitted for remote execution.

Return     Optional output which will be set immediately to the input session. It is provided for the convenience of the invoking code so that the same type of output can be returned from this vs. UADP command.
    Type     DataReference

Optional Arguments

Session    If not specified, top level background UADP sessions will be resumed.
    Type     DataReference

ResumeDesignPointUpdates

Resume design point updates suspended waiting for subtasks executed in background; or resume suspended parametric updates.

RunScript

Executes a Workbench script file from the specified location.

Required Arguments

FilePath    Full path to the script file to execute.
    Type     string

Save

Saves the current project to disk.

Optional Arguments

FilePath    The full path of the project file to be saved.
    Type     string
Overwrite    Whether to overwrite the project save location if it exists.
    Type     bool

SaveProjectArchiveToTeamcenter

Saves a project archive to Teamcenter. The project archive must be created before calling this function.

Required Arguments

ArchiveFileName    Archive file name
    Type     string
TeamcenterUserName    Teamcenter User Name
    Type     string
TeamcenterUserPassword    Teamcenter User Password
    Type     string

Optional Arguments

DatasetDescription    Item description
    Type     string
DatasetName    Dataset name. ArchiveFileName will be considered as the Dataset name, if (ItemName and ItemRevision) or Dataset name is not specified
    Type     string
DeleteArchiveOnExit    Deletes the archive file name on exiting the process
    Type     bool
    Default Value    False
ItemName    Teamcenter Item name
    Type     string
ItemRevision    Teamcenter Item Revision
    Type     string
ItemRevisionUID    Teamcenter Item Revision UID
    Type     string
ItemSequence    Item sequence number
    Type     string
ItemUID    Teamcenter Item UID
    Type     string
SSLCACertificateFile    Teamcenter SSL CA Certificate File for HTTPS connections
    Type     string
TeamcenterDiscriminator    Teamcenter Discriminator
    Type     string
    Default Value    ANSYSWBPlugInTC
TeamcenterGroup    Teamcenter Group
    Type     string
TeamcenterLocale    Teamcenter Locale. eg. en_US
    Type     string
TeamcenterRole    Teamcenter Role
    Type     string
WaitForExitMillisecond    Wait till teamcenter checkin is finished
    Type     int
    Default Value    30000
Example

Saves a project archive to Teamcenter

    SaveProjectArchiveToTeamcenter(ArchiveFileName=r"C:\Users\AnsUser\simpleStructural.wbpz",
            TeamcenterUserName="infodba",
            TeamcenterUserPassword="infodba",
            ItemName="ANS0048",
            ItemRevision="001",
            Decription="Workbench2 Project Archive")

SetDesignPointUpdateOption

Set the design point updates run mode.

Required Arguments

UpdateOption    Update option to be set.
    Type     JobRunMode

SetProjectUnitSystem

Sets the unit system for the current project.

Return     A reference to the UnitSystem entity that is now the project unit system.
    Type     DataReference

Required Arguments

UnitSystemName    The internal name of the unit system to be used in the project.
    Type     string

SetQuantityUnitForUnitSystem

Sets the unit for a Quantity in the specified unit system. Changing Base or Common units will change derived units if appropriate. Note: Quantity unit for a predefined unit system cannot be changed. Note: Only consistent units (SI or US Customary) are allowed.

Return     A dictionary of the Quantity names and new units for all resulting quantity changes. This will be more than just the target quantity if a base unit is changed.
    Type     Dictionary<string, string>

Required Arguments

QuantityName    The name of the Quantity to be changed.
    Type     string
Unit    The new Unit for the quantity.
    Type     string
UnitSystemName    The internal name of the unit system to be changed.
    Type     string
Example

The following example illustrates the setting of a quantity unit in a given unit system.

    changedUnits = SetQuantityUnitForUnitSystem(UnitSystemName="myUnitSystem",
                                                QuantityName="Temperature",
                                                Unit="C")

SetScriptVersion

Sets the command API version used when executing a script.

Required Arguments

Version    The command API version required to run the script. This string can either a 2 or 3 part version string.
    Type     string

SetTableData

SetData will overwrite the data in a table beginning at the specified location.

Required Arguments

Column    An Integer index or the String name of the column (case-sensitive) to begin setting data. The first column has an index of 0 (zero).
    Type     Object
Data    A String or List of Strings which specifies the data to set at the given row and column of the table. The String must be a valid Quantity string in the form "value [units]". If a List is used see the DataOrder argument for behavior.
    Type     List<Quantity>
Row    The Integer index of the row of the table to begin setting data. The first row has an index of 0 (zero).
    Type     int
Table    The DataReference of the table which will have data changed.
    Type     DataReference

Optional Arguments

DataOrder     An enum of Row or Column which indicates if the Data is entered in a row-major or column-major order. The default is Row.
   When the DataOrder is Row the data is set beginning at the specified position and continues in the row. If the operation for the List of data would exceed the number of columns an error will occur.
   When the DataOrder is Column the data is set beginning at the specified position and continues in the column. If the operation for the List of data would exceed the number of rows an error will occur.
    Type    DataOrder
    Default Value    Row
Example

This example illustrates setting data in a table.

    # NameSpace is the Addin namespace in use (e.g. Study, EngData, etc.)  which may have its specific CreateTable command
    # drParent is the DataReference of an object that has been previously created
    table1 = NameSpace.CreateTable(Parent=drParent, Columns=[("Temperature","Temperature"),("Displacement","Length")])
    table1.AddRow(Data=["100 [C]","1.0 [m]"])
    table1.AddRow(Data=["200 [C]",".02 [m]"])
    table1.AddRow(Data=["300 [C]",".06 [m]"])
    tableData = ["100 [C]","0.0 [m]"]
    table1.SetData(Row=0, Column=0, Data=tableData)

SetTabularData

Set tabular data associated with the data entity.

Required Arguments

TabularData    Data entity that has associated tabular data.
    Type     DataReference

Optional Arguments

Data    Sets the data using a dictionary form. The keys are the variable names and the values are the data. The use of this argument is mutually exclusive with "Values" and "Variables".
    Type     Dictionary<string, List<Object>>
Index    Specifies the starting location used to set the data (zero-based). A value of -1 indicates that the data should be appended to the existing data.
    Type     int
    Default Value    0
SheetName    Specifies the sheet name when the data contains multiple sheets.
    Type     string
SheetQualifiers    Used to pass in the qualifiers to select between multiple sheets with the same name. This is a dictionary of qualifiers and values.
    Type     Dictionary<string, string>
Values    List of data values set in conjunction with the "Variables" parameter. This parameter and the "Data" parameter are mutually exclusive.
    Type     List<List<Object>>
Variables    Names of the variables for which data is being set. This parameter and and the "Data" parameter are mutually exclusive.
    Type     List<string>
Example

    #
    # Create a new Engineering Data System and access Structural Steel
    #
    template1 = GetTemplate(TemplateName="EngData")
    system1 = template1.CreateSystem()
    engineeringData1 = system1.GetContainer(ComponentName="Engineering Data")
    matl1 = engineeringData1.GetMaterial(Name="Structural Steel")
    #
    # Change the value of a simple single-valued property
    #
    matlProp1 = matl1.GetProperty(Name="Density")
    matlProp1.SetData(
                      Variables="Density",
                      Values="8500 [kg m^-3]")
    #
    # Set Temperature-dependent data for Elasticity based
    # on lists of variables and values.
    matlProp2 = matl1.GetProperty(Name="Elasticity")
    temperature = ["400 [K]", "600 [K]", "800 [K]"] 
    E = ["2e5 [MPa]", "1.9e5 [MPa]", "1.6e5 [MPa]"]
    matlProp2.SetData(
                      Variables = ["Temperature","Young's Modulus"],
                      Values = [temperature, E])
    # 
    # Change the Temperature for the second table entry.
    #
    matlProp2.SetData(
                      Index = 1,
                      Variables = "Temperature",
                      Values = "625 [K]")
    # 
    # Set a list for Poisson's Ratio starting at the second table entry.
    #    
    matlProp2.SetData(
                      Index = 1,
                      Variables = "Poisson's Ratio",
                      Values = [0.3, 0.3])
    #
    # Set Temperature-dependent property data for the Coefficient of Thermal Expansion
    # using a dictionary. The dictionary key is the Variable name,
    # followed by the list of values for the variable.
    #
    matlProp3 = matl1.GetProperty(Name="Coefficient of Thermal Expansion")
    newData = {"Temperature": ["200 [F]","400 [F]","600 [F]","800 [F]","1000 [F]"],                   
    "Coefficient of Thermal Expansion" : ["6.3e-6 [F^-1]", "7.0e-6 [F^-1]", 
                                          "7.46e-6 [F^-1]", "7.8e-6 [F^-1]", 
                                          "8.04e-6 [F^-1]"]}
    matlProp3.SetData(
                      SheetName="Coefficient of Thermal Expansion",
                      SheetQualifiers={"Definition Method": "Secant", "Behavior": "Isotropic"},
                      Data = newData)

SetTabularDataQualifier

Changes the values of a specifiec qualifier in a data table.

Required Arguments

Qualifier    The Qualifier to Set.
    Type     string
TabularData    Data Entity that can be bound to ITabularDataWrite
    Type     DataReference
Value    The new value.
    Type     string

Optional Arguments

SheetName    The name of the tabular data sheet that contains the qualifier.
    Type     string
SheetQualifiers    SheetQualifiers can be used to pass in the qualifiers to select between multiple sheets witht the same name. This is a dictionary of the Qualifier and its Value.
    Type     Dictionary<string, string>
VariableName    The name of the Variable that contains the qualifier to be changed.
    Type     string
VariableQualifiers    VariableQualifiers can used to pass in the qualifiers to select between multiple variables witht the same name. This is a dictionary of the Qualifier and its Value.
    Type     Dictionary<string, string>
Example

The following example changes the 'Derive From' setting within an Isotropic Elasticity material property to be "Bulk Modulus and Poisson's Ratio".

    matl1 = engineeringData1.GetMaterial(Name="Structural Steel")
    matlProp1 = matl1.GetProperty(Name="Elasticity")
    matlProp1.SetQualifier(
       SheetName="Elasticity",
       Qualifier="Derive from",
       Value="Bulk Modulus and Poisson's Ratio")

SetUnitsDisplaySettings

Sets units display settings.

Required Arguments

DisplaySettings    The new value to be used for Unit display settings. Allowed values are:
  
DisplayValuesAsDefined
DisplayValuesInProjectUnits
    Type    string

SetUserPathRoot

Sets the current user path root. The root path facilitates portability of session journals by allowing relative rather than absolute paths to be recorded. During command journal replay, paths are reconstructed using the active user path root setting.

Required Arguments

DirectoryPath    The new root directory path.
    Type     string

Unarchive

Restores a project from an archive to the specified location.

Required Arguments

ArchivePath    The project archive file path to open.
    Type     string
Overwrite    Whether the project should be overwritten if it already exsits.
    Type     bool

Optional Arguments

ProjectPath    The path to which the archived project will be uncompressed. If not specified, it will be extracted to a directory under "ProjectTemporaryFilesFolder" set by user preference. If the "ProjectTemporaryFilesFolder" is not set, it will be extracted to a directory under system temp directory.
    Type     string
Example

This example illustrates an unarchive procedure. The specified archive will be un-archived to the specified project file path. If the project file path already exists, it will be overwritten since Overwrite=True.

    Unarchive(ArchivePath=r"C:\Users\anyuser\myProjectArchive.wbpz",
              ProjectFilePath=r"C:\Users\anyuser\myProject.wbpj",
              Overwrite=True)             

UpdateAllDesignPoints

Updates all design points or a subset of them if specified.

Return     The reference to the DesignPointUpdateBackgroundSession object, if the command is executed via RSM.
    Type     DataReference

Optional Arguments

CannotCompleteBehavior    Determines the action to take when a component cannot be updated but does not have an error, for example if it needs user intervention.
    Type     UpdateErrorBehavior
    Default Value    Continue
DesignPoints    The set of design points to update. If this parameter is not given, all out of date design points are updated.
    Type     List<DataReference>
ErrorBehavior    Determines the action to take when an error is encountered.
    Type     UpdateErrorBehavior
    Default Value    Continue
Parameters    The set of parameters to update. If this parameter is not given, all parameters are updated.
    Type     List<DataReference>
Example

The following example illustrates a more verbose usage of UpdateAllDesignPoints, as general users will typically call just UpdateAllDesignPoints(). The following call processes two design points for all parameters (all when None is specified), skips the executing design point when observing an error, and stops if a design point update cannot be completed.

    dps = []
    dp = Parameters.GetDesignPoint("1")
    dps.append(dp)
    dp = Parameters.GetDesignPoint("2")
    dps.append(dp)
    UpdateAllDesignPoints(DesignPoints=dps,
                          Parameters=None,
                          ErrorBehavior="SkipDesignPoint",
                          CannotCompleteBehavior="Stop")

Update

Updates all components in the project by refreshing all input data and performing local calcuations to produce new output if the component is out of date.

Optional Arguments

ContinueCalculation    A value indicating whether this update should include interrupted components
    Type     bool
    Default Value    False

UpdateSystems

Updates all components in the given systems by refreshing the input from all upstream sources, and then performing local calculation based on current data.

Required Arguments

Systems    No details are provided for this entry.
    Type     DataReferenceSet

Release 18.2 - © ANSYS, Inc. All rights reserved.