Project
Project
This namespace holds top-level commands and queries related to the Project, File and Units.
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.
- 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.
- 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
No details are provided for this entry.
Required Arguments
- SourceComponent No details are provided for this entry.
- Type DataReference
- TargetComponent No details are provided for this entry.
- 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.
- 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]".
- 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
No details are provided for this entry.
Required Arguments
- Systems No details are provided for this entry.
- 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
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
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)
CopySystems
No details are provided for this entry.
-
Return
No details are provided for this entry. - Type DataReferenceSet
Required Arguments
- KeepConnections No details are provided for this entry.
- Type bool
- Systems No details are provided for this entry.
- Type List<DataReference>
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
- Example
This example illustrates the creation of a custom unit system.
myUnitSystem = CreateCustomUnitSystem(UnitSystemName="MyUnitSystem", UnitSystemDisplayName="My Custom Unit System", BaseUnitSystemName="SI")
CreateTemplateFromProject
No details are provided for this entry.
-
Return
No details are provided for this entry. - Type DataReference
Required Arguments
- Name No details are provided for this entry.
- 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)
DeleteSystems
No details are provided for this entry.
Required Arguments
- Systems No details are provided for this entry.
- Type List<DataReference>
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") DeleteTabularDataRow(matlProp1, Index = 0) # # Delete the first row in the Coefficient of Thermal Expansion property with # optional SheeetName and SheetQualifiers # matlProp2 = matl1.GetProperty(Name="Coefficient of Thermal Expansion") DeleteTabularDataRow(matlProp2, 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
ExportReport
Writes out project report containing both framework- and addin-supplied content. The report output is in XML format. Or if the file path extension is html, the XML will be converted to 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. If the extension is .html, the report will be poduced in XML and then translated into HTML format.
- 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.
GetAllSystems
No details are provided for this entry.
-
Return
No details are provided for this entry. - Type DataReferenceSet
GetMiscellaneousSettings
No details are provided for this entry.
-
Return
No details are provided for this entry. - Type DataReference
GetComponentTemplate
No details are provided for this entry.
-
Return
No details are provided for this entry. - Type DataReference
Required Arguments
- Name No details are provided for this entry.
- Type string
GetCurrentRegisteredFiles
Gets the files registered with the project.
-
Return
The set of data references to registered files. - Type DataReferenceSet
GetDesignPointUpdateSettings
No details are provided for this entry.
-
Return
No details are provided for this entry. - 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
No details are provided for this entry.
-
Return
No details are provided for this entry. - 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
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
No details are provided for this entry.
-
Return
No details are provided for this entry. - 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
No details are provided for this entry.
-
Return
No details are provided for this entry. - Type DataReference
Required Arguments
- Name No details are provided for this entry.
- 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
GetQuantityUnitsForUnitSystem
Gets the units for all quantities in the specified unit system.
-
Return
The units for all quantities - Type Dictionary<string, string>
Required Arguments
- UnitSystem The internal name of the unit system
- Type DataReference
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
GetSchematicSettings
No details are provided for this entry.
-
Return
No details are provided for this entry. - 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
No details are provided for this entry.
-
Return
No details are provided for this entry. - Type DataReference
Required Arguments
- Name No details are provided for this entry.
- Type string
GetTableData
GetData will return the data in a table.
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)
GetTemplate
No details are provided for this entry.
-
Return
No details are provided for this entry. - Type DataReference
Required Arguments
- TemplateName No details are provided for this entry.
- Type string
Optional Arguments
- Solver No details are provided for this entry.
- 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).
GetUserFilesDirectory
Gets the current user_files directory.
-
Return
The full path to the user_files directory. - 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 Schematic. Sometimes, the file is simply added to the Files pane. 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
No details are provided for this entry.
-
Return
No details are provided for this entry. - Type bool
Optional Arguments
- IncludeParametricComponents No details are provided for this entry.
- 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
RegisterFile
Registers the specified file with the project. FilePath 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)
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)
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
No details are provided for this entry.
Optional Arguments
- Session No details are provided for this entry.
- Type DataReference
RunScript
Executes a Workbench script file from the specified location.
Required Arguments
- FilePath Full path to the script file to execute.
- Type string
SetDesignPointUpdateOption
No details are provided for this entry.
Required Arguments
- UpdateOption No details are provided for this entry.
- 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
- 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.
- 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.
- Variables Names of the variables for which data is being set. This parameter and and the "Data" parameter are mutually exclusive.
- 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") SetTabularData(matlProp1, 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]"] SetTabularData(matlProp2, Variables = ["Temperature","Young's Modulus"], Values = [temperature, E]) # # Change the Temperature for the second table entry. # SetTabularData(matlProp2, Index = 1, Variables = "Temperature", Values = "625 [K]") # # Set a list for Poisson's Ratio starting at the second table entry. # SetTabularData(matlProp2, 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]"]} SetTabularData(matlProp3, 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") SetTabularDataQualifier(matlProp1, 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
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
No details are provided for this entry.
-
Return
No details are provided for this entry. - Type DataReference
Optional Arguments
- CannotCompleteBehavior No details are provided for this entry.
- Type UpdateErrorBehavior
- Default Value Continue
- DesignPoints No details are provided for this entry.
- Type List<DataReference>
- ErrorBehavior No details are provided for this entry.
- Type UpdateErrorBehavior
- Default Value Continue
- Parameters No details are provided for this entry.
- Type List<DataReference>
- ReupdateInterrupted No details are provided for this entry.
- Type bool
- Default Value False
- Example
Required example does not exist.
Update
No details are provided for this entry.
Optional Arguments
- ContinueCalculation No details are provided for this entry.
- Type bool
- Default Value False
UpdateDesignPointsInSteps
No details are provided for this entry.
Required Arguments
- UpdateOptions No details are provided for this entry.
- Type DpUpdateOptions
UpdateSystems
No details are provided for this entry.
Required Arguments
- Systems No details are provided for this entry.
- Type DataReferenceSet