Creating Multiple Part Usage Links with Occurrences
This example shows you how to create multiple part usage links with occurrences. To create part usage links, you must first check out the parent part. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:423109')/PTC.ProdMgmt.CreateUses
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"PartUses": [
{
"Quantity": 2,
"Unit": {
"Value": "ea",
"Display": "Each"
},
"FindNumber": "100",
"LineNumber": 100,
"TraceCode": {
"Value": "0",
"Display": "Untraced"
},
"Uses@odata.bind": "Parts('OR:wt.part.WTPart:496415')",
"Occurrences": [
{
"ReferenceDesignator": "R1",
"Location": {
"PointX": 0,
"PointY": 1,
"PointZ": 1,
"PointUnit": "m",
"AngleX": 1.04,
"AngleY": 1.04,
"AngleZ": 1.04,
"AngleUnit": "r"
}
},
{
"ReferenceDesignator": "R2",
"Location": {
"PointX": 1,
"PointY": 1,
"PointZ": 0,
"PointUnit": "m",
"AngleX": 3.14,
"AngleY": 3.14,
"AngleZ": 3.14,
"AngleUnit": "r"
}
}
]
},
{
"Quantity": 1,
"Unit": {
"Value": "ea",
"Display": "Each"
},
"FindNumber": "200",
"LineNumber": 200,
"TraceCode": {
"Value": "0",
"Display": "Untraced"
},
"Uses@odata.bind": "Parts('OR:wt.part.WTPart:222222')",
"Occurrences": [
{
"ReferenceDesignator": "R3",
"Location": {
"PointX": 0,
"PointY": 0,
"PointZ": 1,
"PointUnit": "m",
"AngleX": 0,
"AngleY": 0,
"AngleZ": 0,
"AngleUnit": "r"
}
}
]
}
]
}
Example: Creating Multiple Part Usage Links for the Same Child Part
This example shows you how to create part usage links between the specified parent part and the same child part twice with occurrences. To create part usage links, you must first check out the parent part. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:487525')/PTC.ProdMgmt.CreateUses
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"PartUses": [
{
"Quantity": 2,
"Unit": {
"Value": "ea",
"Display": "Each"
},
"FindNumber": "100",
"LineNumber": 10,
"TraceCode": {
"Value": "0",
"Display": "Untraced"
},
"Uses@odata.bind": "Parts('OR:wt.part.WTPart:190647')",
"Occurrences": [
{
"ReferenceDesignator": "R1"
},
{
"ReferenceDesignator": "R2"
}
]
},
{
"Quantity": 1,
"Unit": {
"Value": "ea",
"Display": "Each"
},
"FindNumber": "200",
"LineNumber": 20,
"TraceCode": {
"Value": "0",
"Display": "Untraced"
},
"Uses@odata.bind": "Parts('OR:wt.part.WTPart:190647')",
"Occurrences": [
{
"ReferenceDesignator": "R12"
}
]
}
]
}
Example: Creating Multiple Part Usage Links with Single-valued Attributes on Uses and Occurrences
This example shows you how to create multiple part usage links with single-valued custom attributes on uses and occurrences. To create part usage links, you must first check out the parent part. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:487525')/PTC.ProdMgmt.CreateUses
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"PartUses": [
{
"Quantity": 8,
"Unit": {
"Value": "ea",
"Display": "Each"
},
"FindNumber": null,
"LineNumber": 100,
"TraceCode": {
"Value": "0",
"Display": "Untraced"
},
"Uses@odata.bind": "Parts('OR:wt.part.WTPart:176342')",
"Occurrences": [
{
"TOPSIDE": true,
"DSTR": "creo2"
},
{
"ReferenceDesignator": "R1",
"Location": {
"PointX": 23.879879,
"PointY": 23.879879,
"PointZ": 23.879879,
"AngleX": 23.879879,
"AngleY": 23.879879,
"AngleZ": 23.879879
}
},
{
"ReferenceDesignator": "R2",
"Location": {
"PointX": 23.879879,
"PointY": 23.879879,
"PointZ": 23.879879,
"AngleX": 23.879879,
"AngleY": 23.879879,
"AngleZ": 23.879879
}
}
]
},
{
"Quantity": 6,
"Unit": {
"Value": "ea",
"Display": "Each"
},
"TOPSIDE": true,
"DSTR": "creo1",
"FindNumber": "200",
"LineNumber": 200,
"TraceCode": {
"Value": "0",
"Display": "Untraced"
},
"Uses@odata.bind": "Parts('OR:wt.part.WTPart:176349')",
"Occurrences": [
{
"ReferenceDesignator": "R9",
"Location": {
"PointX": 0,
"PointY": 0,
"PointZ": 1,
"PointUnit": "m",
"AngleX": 0,
"AngleY": 0,
"AngleZ": 0,
"AngleUnit": "r"
}
}
]
}
]
}
Example: Creating Multiple Part Usage Links with Multi-valued Attributes on Uses and Occurrences
This example shows you how to create multiple part usage links with multi-valued custom attributes on uses and occurrences. To create part usage links, you must first check out the parent part. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:487525')/PTC.ProdMgmt.CreateUses
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"PartUses": [
{
"Quantity": 8,
"Unit": {
"Value": "ea",
"Display": "Each"
},
"FindNumber": null,
"LineNumber": 100,
"TraceCode": {
"Value": "0",
"Display": "Untraced"
},
"Uses@odata.bind": "Parts('OR:wt.part.WTPart:176342')",
"Occurrences": [
{
"DSTR": [
"creo1",
"creo2"
],
"GINT": [
1,
2
],
"GREAL": [
1.1,
3.4
],
"GBOOL": [
true,
false
],
"GDATE": [
"2019-12-12T18:30:00Z",
"2019-11-12T18:30:00Z"
],
"GHYPR": [
{
"URL": "SSS",
"Label": "SSS"
},
{
"URL": "PPP",
"Label": "PPP"
}
],
"GRUNITS": [
{
"Value": 100.1,
"Unit": "m",
"Precision": 6
},
{
"Value": 170.1,
"Unit": "m",
"Precision": 6
}
]
},
{
"ReferenceDesignator": "R1",
"Location": {
"PointX": 23.879879,
"PointY": 23.879879,
"PointZ": 23.879879,
"AngleX": 23.879879,
"AngleY": 23.879879,
"AngleZ": 23.879879
}
},
{
"ReferenceDesignator": "R2",
"Location": {
"PointX": 23.879879,
"PointY": 23.879879,
"PointZ": 23.879879,
"AngleX": 23.879879,
"AngleY": 23.879879,
"AngleZ": 23.879879
}
}
]
},
{
"Quantity": 6,
"Unit": {
"Value": "ea",
"Display": "Each"
},
"DSTR": [
"creo1",
"creo2"
],
"GINT": [
1,
2
],
"GREAL": [
1.1,
3.4
],
"GBOOL": [
true,
false
],
"GDATE": [
"2019-12-12T18:30:00Z",
"2019-11-12T18:30:00Z"
],
"GHYPR": [
{
"URL": "SSS",
"Label": "SSS"
},
{
"URL": "PPP",
"Label": "PPP"
}
],
"GRUNITS": [
{
"Value": 100.1,
"Unit": "m",
"Precision": 6
},
{
"Value": 170.1,
"Unit": "m",
"Precision": 6
}
],
"FindNumber": "200",
"LineNumber": 200,
"TraceCode": {
"Value": "0",
"Display": "Untraced"
},
"Uses@odata.bind": "Parts('OR:wt.part.WTPart:176349')",
"Occurrences": [
{
"ReferenceDesignator": "R9",
"Location": {
"PointX": 0,
"PointY": 0,
"PointZ": 1,
"PointUnit": "m",
"AngleX": 0,
"AngleY": 0,
"AngleZ": 0,
"AngleUnit": "r"
}
}
]
}
]
}