Creating Associations Between Parts and CAD documents
You can create a single or multiple associations between parts and CAD documents.
* 
When the Calculated association type is specified along with other association types in the request body, the request skips the creation of the calculated association.
When only the Calculated association type is specified in the request body, the request skips the creation of the calculated association. Because there is no association to create, the request returns the 200 status code.
The creation of a calculated association is skipped even though you do not have access to the part or CAD document.
Example: Creating an Association Between a Part and a CAD Document
This example demonstrates how to create an owner association between a part and a CAD document. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/CreateAssociations HTTP/1.1
Request Header
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"PartDocAssociations": [
{
"AssociationType": {
"Value": "OWNER"
},
"RelatedPart@odata.bind": "Parts('OR:wt.part.WTPart:5248022')",
"RelatedCADDoc@odata.bind": "CADDocuments('OR:wt.epm.EPMDocument:5247851')"
}
]
}
Response
The created association is returned in the response:
{
"@odata.context": "$metadata#PartDocAssociations",
"value": [
{
"ID": "OR:wt.epm.build.EPMBuildRule:2248022",
"AssociationType": {
"@odata.type": "#PTC.CADDocumentMgmt.AssociationTypeInfo",
"Value": "OWNER",
"Display": "Owner"
}
}
],
"@PTC.AppliedContainerContext.LocalTimeZone": "America/New_York"
}
Example: Creating Multiple Associations Between a Part and CAD Documents
This example demonstrates how to create associations between one part and three different documents.
Request Header
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"PartDocAssociations": [
{
"AssociationType": {
"Value": "OWNER"
},
"RelatedPart@odata.bind": "Parts('OR:wt.part.WTPart:58891420')",
"RelatedCADDoc@odata.bind": "CADDocuments('OR:wt.epm.EPMDocument:5891333')"
},
{
"AssociationType": {
"Value": "CONTRIBUTING_CONTENT"
},
"RelatedPart@odata.bind": "Parts('OR:wt.part.WTPart:58891420')",
"RelatedCADDoc@odata.bind": "CADDocuments('OR:wt.epm.EPMDocument:5891311')"
},
{
"AssociationType": {
"Value": "CONTENT"
},
"RelatedPart@odata.bind": "Parts('OR:wt.part.WTPart:58891420')",
"RelatedCADDoc@odata.bind": "CADDocuments('OR:wt.epm.EPMDocument:5891355')"
}
]
}
Response
{
"@odata.context": "$metadata#PartDocAssociations",
"value": [
{
"ID": "OR:wt.epm.build.EPMBuildRule:5891443",
"AssociationType": {
"@odata.type": "#PTC.CADDocumentMgmt.AssociationTypeInfo",
"Value": "CONTRIBUTING_CONTENT",
"Display": "Owner"
}
},
{
"ID": "OR:wt.epm.build.EPMBuildRule:5891442",
"AssociationType": {
"@odata.type": "#PTC.CADDocumentMgmt.AssociationTypeInfo",
"Value": "OWNER",
"Display": "Owner"
}
},
{
"ID": "OR:wt.epm.build.EPMDescribeLink:5891444",
"AssociationType": {
"@odata.type": "#PTC.CADDocumentMgmt.AssociationTypeInfo",
"Value": "CONTENT",
"Display": "Owner"
}
}
],
"@PTC.AppliedContainerContext.LocalTimeZone": "America/New_York"
}
Was this helpful?