Importing Mesh-Based Databases

This section examines how to work with the finite element data that you import from an upstream External Model system. It examines the following topics for importing mesh-based databases.

User Interface Options

When you import an External Model source file that includes any of the finite element data listed below, Mechanical inserts an “Imported” folder (excluding Named Selections) beneath the corresponding Tree outline object. As illustrated in the example Outline pane below, this Imported folder object is a simple group folder and will contain a child object for the associated data type.

Selecting a child object of the Imported folder displays the model in the Geometry window with the imported data type highlighted as well as the Worksheet. An example of a selected imported spring is illustrated below. The Worksheet displays a summary of all imported data including column headings for the specific data associated with each data entry (connection Type, node ID, etc.). Each row of the Worksheet represents a different set of data. You can sort the table data by clicking on a column heading. The check-box for each Worksheet row enables you to deactivate (suppress) the row. And, based on the number of data items imported, the Worksheet displays 500 (default) data items per worksheet page. Use the display and/or navigational options at the bottom of the window to display more data items per page as well as to step through the available pages of data.

A graphical representation of the data is also shown in the Geometry window. You can choose which data is displayed in the Geometry window using the Show Rows property under Graphics Properties category in the Details view. The Show Rows property includes the following options:

In addition, for the following objects, you have the ability to select the color used for the displayed data in the Geometry window through a color selection property in the Details view:

Furthermore, when you select a Worksheet row, the graphical representation of the data in the Geometry window becomes highlighted, such as the green spring shown in the above image. You can also select the graphical representation directly in the Geometry window by activating the Label or Imported Objects option on the Graphics Toolbar. This selection option behaves as it does when it is used in other selection scenarios for the application. Normal mouse and key combinations for selecting, unselecting, modifying, or clearing selections act just as they do with geometry selections, etc. This selection feature is available for the following types of imported data:

In addition, for the above data types, when you select the graphical representation (Point Mass, Spring, etc.) in the Geometry window and right-click, the context menu provides the following applicable options:

When the finite element data is displayed in the Worksheet, there are common options you can employ when you right-click on a Worksheet row, including:


Note:  Currently, Mechanical supports the Promote and Copy options for the following imported data:

  • Contacts

  • Coordinate Systems

  • Element Orientations

  • Point Masses (when scoped to a node of the geometry only)


Finite Element Data Types

Mechanical enables you to import the following finite element data types from External Model. Select a link to jump to steps for working with that data type:

Reference Node Naming

For the imported FE data types listed below, Mechanical enables you to assign custom names to reference nodes in the Worksheet. This enables you to access the nodes in the solver file (through command snippets). Your name can contain only standard English letters and numbers, spaces, underscores, hyphens, and/or parenthesis characters.

Mechanical automatically makes the following changes to your custom name in order to prepare the new reference name for the Mechanical APDL application:

For example, a Reference Node in the Mechanical application called "1 Edge" appears as component "C_1_Edge" in the Mechanical APDL application input file.

Accessing Imported Mesh-Based Databases through ACT

The Mechanical application enables you to import supported finite element data types from External Model and represents them natively through various imported objects in the tree. In addition, imported databases almost always contain additional commands that are not natively supported by the application. Mechanical exposes these commands (along with the commands natively processed in Mechanical) through the ACT extensions and console window. The following APIs enable you to access the underlying commands repository for a file specified in External Model.

commands = ExtAPI.DataModel.Project.Model.GetFECommandsRepository("Setup", "File1");

Users familiar with ACT APIs for ANSYS Mechanical will notice that the command GetFECommandsRepository on the Model object provides access to the commands repository. The two arguments ("Setup" and "File1") specify the source External Model Component Id and "File Identifier" in the External Model Component.

The return object commands is an instance of the interface ICommandRepository.

Once user has access to the commands database, you can access:

User can access the unprocessed commands names using the combination of following commands:

unprocessedCmdNamesCount = commands.GetCommandNamesCount(Ansys.ACT.Automation.Mechanical.FE.CommandsType.UnProcessed);

And...

unprocessedCmdName = commands.GetCommandName(Ansys.ACT.Automation.Mechanical.FE.CommandsType.UnProcessed, index);

As you might notice, the command GetCommandNamesCount on ICommandRepository provides the count of the command names of type specified as first argument:

Ansys.ACT.Automation.Mechanical.FE.CommandsType.UnProcessed

Or...

Ansys.ACT.Automation.Mechanical.FE.CommandsType.Processed

And the command GetCommandName provides the command name given the type and index (index is 1 based, therefore, if the unprocessedCmdNamesCount = n, the valid index value are (1,n)).

Given a command name, user can access all instances of a command with a given name as:

namedCommands = commands.GetCommandsByName(commandName);

The return value namedCommands is an instance of the interface ICommandColl. A command can be accessed from the namedCommands as:

namedCommand = namedCommands.Item(index);

The index argument is 1 based, therefore valid index value are (1,namedCommands.Count()))

The return value namedCommand is a derived instance of the interface ICommand, i.e. the namedCommand instance exposes the methods available on the ICommand interface:

Name(): Command name
Index(): 1 based global index of the command in command repository

And any additional methods exposed the specific instance of the command. For example, if the namedCommand is an instance of ICECommand (a type of processed command from CDB file), then the following additional methods are available:

Nce(): Constraint Equation ID
Constant(): Constant Term
TermCount(): Number of Terms
GetTerm(int index): Term at Index

Similarly, if the namedCommand is an instance of IGenericCommand (unprocessed command from CDB file), then the following additional methods are available:

ArgumentCount(): Number of arguments
GetArgument(int index): Argument at index

Refer to the External Model CDB Commands and the External Model ABAQUS Commands section s for all the available processed and unprocessed commands from CDB and ABAQUS databases.

In addition, you can traverse the command repository by going to the next and previous commands in the database using the following APIs:

prevCommand = commands.GetCommandByIndex(currentCommand.Index()-1);

nextCommand = commands.GetCommandByIndex(currentCommand.Index()+1);

Given the information provided in the above section, let's take a look at some examples.

CBD File Examples

The following examples describe how to query the command repository.

commands = ExtAPI.DataModel.Project.Model.GetFECommandsRepository("Setup", "File1")

Example: List All Command Names

This example enables you to generate a listing all command names in the command repository.

commandType = Ansys.ACT.Automation.Mechanical.FE.CommandsType.All
commandCount = commands.GetCommandNamesCount(commandType)
commandsNames = []
for iCommand in range(0, commandCount):
	commandsNames.append(commands.GetCommandName(commandType, iCommand+1))
commandsNames

Example: List All Nodes

This example enables you to generate a listing all nodes in the command repository.

NBLOCK,6,SOLID,     430,     10
(3i9,6e21.13e3)
      421        0        0 6.3203350000000E+004-4.2985880000000E+004 6.3500000000000E+004
      422        0        0 6.1696900000000E+004-4.5619000000000E+004 6.3500000000000E+004
      423        0        0 5.9365700000000E+004-4.7562160000000E+004 6.3500000000000E+004
      424        0        0 5.6517810000000E+004-4.8605830000000E+004 6.3500000000000E+004
      425        0        0 5.3482670000000E+004-4.8603130000000E+004 6.3500000000000E+004
      426        0        0 5.0634300000000E+004-4.7562160000000E+004 6.3500000000000E+004
      427        0        0 4.8295410000000E+004-4.5625390000000E+004 6.3500000000000E+004
      428        0        0 4.6795660000000E+004-4.2986070000000E+004 6.3500000000000E+004
      429        0        0 4.6250000000000E+004-4.0000000000000E+004 6.3500000000000E+004
      430        0        0 4.6795660000000E+004-3.7013930000000E+004 6.3500000000000E+004
N,R5.3,LOC,       -1,
	  
/*Commands*/	  
nodeIds = []
nblockCommands = commands.GetCommandsByName("NBLOCK")
nblockCount = nblockCommands.Count
for iNBlock in range(0, nblockCount):
	nblock = nblockCommands[iNBlock+1]
	nodeCount = nblock.NodeCount()	
	for iNode in range(0, nodeCount):
		node = nblock.GetNode(iNode+1)
		nodeIds.append(node.Id())
nodeIds		
		
/*Output*/		
[421, 422, 423, 424, 425, 426, 427, 428, 429, 430]

Example: Extract Analysis Settings

This example enables you to extract all Analysis Setting in the command repository.

ANTYPE, 2
MODOPT,LANB,     6,  0.00000000    ,  0.00000000    ,     0, 0,  0.00000000    , 0

/*Commands*/
antypeCommands = commands.GetCommandsByName("ANTYPE")
if(antypeCommands.Count > 0):
    antypeCommand = antypeCommands[1]
    if(antypeCommand.ArgumentCount() > 0):
        antype = antypeCommand.GetArgument(1)
        print antype
        if(antype == "2"):
            modoptCommands = commands.GetCommandsByName("MODOPT")
            if(modoptCommands.Count > 0):
                modoptCommand = modoptCommands[1]
                for iArg in range(0, modoptCommand.ArgumentCount()):
                    print modoptCommand.GetArgument(iArg+1)

/*Output*/						
2
LANB
6
0.00000000
0.00000000
0
0
0.00000000
0

Abaqus File Example

This example enables you to generate a listing all nodes in the command repository.

/*Input*/
*NODE, NSET=nset_csys2
       421, 6.320335E+01,-4.298588E+01, 6.350000E+01
       422, 6.169690E+01,-4.561900E+01, 6.350000E+01
       423, 5.936570E+01,-4.756216E+01, 6.350000E+01
       424, 5.651781E+01,-4.860583E+01, 6.350000E+01
       425, 5.348267E+01,-4.860313E+01, 6.350000E+01
       426, 5.063430E+01,-4.756216E+01, 6.350000E+01
       427, 4.829541E+01,-4.562539E+01, 6.350000E+01
       428, 4.679566E+01,-4.298607E+01, 6.350000E+01
       429, 4.625000E+01,-4.000000E+01, 6.350000E+01
       430, 4.679566E+01,-3.701393E+01, 6.350000E+01
	  
/*Commands*/	  
nodeIds = []
nodeKeywords = commands.GetCommandsByName("NODE")
nodeKeywordCount = nodeKeywords.Count
for iNodeKeyword in range(0, nodeKeywordCount):
	nodeKeyword = nodeKeywords[iNodeKeyword+1]
	arguments = nodeKeyword.Arguments()
	for iArg in range(0, arguments.Count()):
		arg = arguments.Item(iArg+1)
		print arg.Key()+"="+arg.Value()
	datalines = nodeKeyword.DataLines()
	for iLine in range(0, datalines.Count()):
		dataline = datalines.Item(iLine+1)
		nodeIds.append(dataline.Item(1))	
nodeIds		
		
/*Output*/		
NSET=nset_csys2
[421, 422, 423, 424, 425, 426, 427, 428, 429, 430]


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