Assign project to object

This example pipeline demonstrates how to create a part and assign it to a Teamcenter project.


Pipeline consisting of JSON Generator Snap, Tc Create Snap and Tc Project Assign Snap.

Steps

1: Startpoint is a JSON Generator Snap which contains a small amount of data in a JSON document. The stored JSON document contains data necessarry for creating a Part.

JSON file

Snap configuration

[
  {
    "object_type": "Part",
    "attributes": {
		"object_desc": "Test Create with Snap",
		"object_name": "SL_Test_010426"
	},
	"expandAttributes": [
		"object_type",
		"object_name",
		"object_string",
		"object_desc",
		"item_id",
		"item_revision_id",
		"project_list"
	]
  }
]

Settings tab of JSON Generator Snap.

2: In the snap configuration following values has to fed into fields of the Tc Create Snap:

  • $object_type to field Object Type
  • $attributes to field Object Attributes Path
  • $expandAttributes to field Expand Attributes Path

Snap configuration

Snap output


Settings tab of Tc Create Snap.

[
  {
    "_id": "TC*Part Revision*null***AqAAANbH7hAnmD",
    "item_id": "052853",
    "item_revision_id": "A",
    "object_desc": "Test Create with Snap",
    "object_name": "SL_Test_010426",
    "object_string": "052853/A;1-SL_Test_010426",
    "object_type": "Part Revision",
    "object_type_DISPLAY": "Part Revision",
    "project_list": [],
    "UID": "AqAAANbH7hAnmD",
    "original": {
      "object_type": "Part",
      "attributes": {
        "object_desc": "Test Create with Snap",
        "object_name": "SL_Test_010426"
      },
      "expandAttributes": [
        "object_type",
        "object_name",
        "object_string",
        "object_desc",
        "item_id",
        "item_revision_id",
        "project_list"
      ]
    }
  }
]

3: JSON property "project_list" of the newly created object is empty. Output of Tc Create Snap includes property “UID” which is the unique ID for the object in Teamcenter. Its value is given to Tc Project Assign Snap field “Object ID”. Field 'Project' is hard coded with the name of an existing project.

Note:

UIDs in Teamcenter are as the name says UNIQUE. The UIDs in the example only exist in our Teamcenter system as expected for our example. Same is valid for Adapter ID "_id" since its base is the UID.

Snap configuration

Snap output


Settings tab of Tc Project Assign Snap.

[
  {
    "_id": "TC*Part Revision*null***AqAAANbH7hAnmD",
    "item_id": "052853",
    "item_revision_id": "A",
    "object_desc": "Test Create with Snap",
    "object_name": "SL_Test_010426",
    "object_string": "052853/A;1-SL_Test_010426",
    "object_type": "Part Revision",
    "object_type_DISPLAY": "Part Revision",
    "project_list": [
      "TC*TC_Project*null***Q2KAAAmY7hAnmD"
    ],
    "UID": "AqAAANbH7hAnmD",
    "original": {
      "_id": "TC*Part Revision*null***AqAAANbH7hAnmD",
      "item_id": "052853",
      "item_revision_id": "A",
      "object_desc": "Test Create with Snap",
      "object_name": "SL_Test_010426",
      "object_string": "052853/A;1-SL_Test_010426",
      "object_type": "Part Revision",
      "object_type_DISPLAY": "Part Revision",
      "project_list": [],
      "UID": "AqAAANbH7hAnmD",
      "original": {
        "object_type": "Part",
        "attributes": {
          "object_desc": "Test Create with Snap",
          "object_name": "SL_Test_010426"
        },
        "expandAttributes": [
          "object_type",
          "object_name",
          "object_string",
          "object_desc",
          "item_id",
          "item_revision_id",
          "project_list"
        ]
      }
    }
  }
]

Now output document of Tc Project Assign Snap shows project id of assigned project in “project_list”.