TeamcenterKnowledge

MBSE Integration Services for Integrating Modeling Tools

bhmSaveOperation API

Use the following API to save and check in models to Teamcenter.

List<BHMOperationOutput> bhmSaveOperation (List<String> dataSaveInputXML, String toolType)

Inputs

  • dataSaveInputXML — Specifies a list of input strings that are based on the BHMOperationsSchema.xsd file. Do not specify files that do not exist or are internal data such as the ModelFolder organization file — this may cause an error. You can generate the xml string using the JAXB utility available with the BHMOperationData and BHMDesign classes in the com.teamcenter.behaviormodeling.common.xml package.
  • toolType — Specifies the behavior modeling tool, for example, MATLAB.

In your Java code, you must specify the following:

  • In the BHMOperations element, specify the values for rootModelFolder, rootModelName, and rootModelIdentifier.
  • In the Model element:
    • Specify the values for modelName and modelIdentifier.
    • Specify the value of tcuid for an existing model. Do not specify a value for tcuid in new models.
  • In the Attributes element, specify the value of the item_id for items and revisions. If you do not specify the IDs, Teamcenter automatically generates them. Do not specify values for tcrevId and tcitemId as they are for internal use.
  <Attributes>
    <Key name="item_id">
      <Value>001001</Value>
    </Key>
    <RevisionAttributes>
      <Key name=" item_id ">
        <Value>P</Value>
      </Key>
    </RevisionAttributes>
  </Attributes>

You can also specify the description of the model in the Attributes element as follows:

  <Attributes>
    <Key name="object_desc">
      <Value>This is S1 Desc</Value>
    </Key>
  </Attributes>
  • Specify the submodel information in the ModelElement element.
  • Specify the ID and revision of the submodel in the Attributes element of ModelElement. If you do not specify the ID and revision for the submodel, Teamcenter automatically generates them.
  • In the saveOperationOptions element, specify the values of the following variables:
    • folderUID — Saves the model to the Teamcenter folder specified by the folder UID.
    • checkIn — To check in the root model, set the value to true.
    • addAdditionalData — To attach additional data, set the value to true, and specify the additional data details in the AdditionalData element.

Outputs

The output is a list of BHMOperationOutput objects (com.teamcenter.behaviormodeling.common package). Each object corresponds to one of the input XML strings sent through dataSaveInputXML.

BHMOperationOutput variable Description
OperationStatus Returns one of: OPERATION_FAILED, OPERATION_WARNING, OPERATION_SUCCESSFUL, OPERATION_SUCCESSFUL_WITH_INFO
message Specifies the cause of the API failure.
inputXML Specifies the input XML string based on BHMOperationsSchema.xsd.
outputXML Specifies an XML string based on BHMDesignSchema.xsd.
rootModelName Specifies the root model to be saved.
rootModelIdentifier Specifies the identifier of the root model.
rootModelFullFilePath Specifies the full path of the root model.

Example

To save a new model to Teamcenter, you can pass the following string through the dataSaveInputXML list of the bhmSaveOperation API.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BHMOperations xmlns="http://www.plmxml.org/Schemas/bhm"
  rootModelFolder="D:\Models\MatlabModels" rootModelName="MyModel"
  rootModelIdentifier="MyModel">
  <modelInfo>
    <Model toolId="" teamcenterVersion="1.1" tcType="Bhm0BehaviorModlRevision"
      tcItemName="MyModel" tcrevId="" tcitemId="" tcuid=""
      modelIdentifier="MyModel"
      modelName="MyModel">
      <Attributes>
        <Key name="object_name">
          <Value>MyModel</Value>
        </Key>
        <Key name="object_desc">
          <Value></Value>
        </Key>
        <Key name="item_id">
          <Value>000041</Value>
        </Key>
        <RevisionAttributes>
          <Key name="item_revision_id">
            <Value>A</Value>
          </Key>
        </RevisionAttributes>
      </Attributes>
      <AdditionalData>
        <File description="" relationType="Bhm0AdditionalData"
          reservation="true" path="D:\Models\MatlabModels\AdditionalData"
          fileext="txt" fileName="ReviewComments.txt" namedReferenceType="Text"
          tcDatasetType="Text" tcuid="" action="add" />
      </AdditionalData>
      <Contents>
        <ModelElements>
          <ModelElement parent="S1" tcType="Bhm0BehaviorModlRevision"
            instanceType="MATLAB:ModelReference" instanceUid="" tcuid=""
            modelIdentifier="MyChild" modelName="MyChild" name="Model">
            <Attributes>
              <Key name="object_name">
                <Value>MyChild</Value>
              </Key>
              <Key name="object_desc">
                <Value>This is MyChild Desc</Value>
              </Key>
              <Key name="item_id">
                <Value>001003</Value>
              </Key>
              <RevisionAttributes>
                <Key name="item_revision_id">
                  <Value>Q</Value>
                </Key>
              </RevisionAttributes>
            </Attributes>
          </ModelElement>
        </ModelElements>
      </Contents>
    </Model>
  </modelInfo>
  <options>
    <saveOperationOptions folderUID="" checkIn="true"
      addAdditionalData="true" />
  </options>
</BHMOperations>

Source: https://docs.sw.siemens.com/en-US/doc/282219420/PL20251212545240207.xid1913857/xid720971 · retrieved Fri Jul 10 2026 00:00:00 GMT+0000 (Coordinated Universal Time)