Retrieving Associations Between a CAD Document and Parts
You can retrieve associations between a CAD document and parts. Additionally, you can retrieve calculated associations between a CAD drawing and parts.
|
• Calculated associations cannot be retrieved when the wt.epm.displayCalculatedLink property is set to false in Windchill.
• The request returns the calculated associations based on the preferences configured in the system. For more information, see the Drawing-Part Relationships topic in the Windchill Help Center.
|
Example: Retrieving Multiple Parts Associated to a CAD Document
The following example demonstrates how to retrieve multiple parts associated to the specified CAD document. In this example, three different parts are associated to the specified multi-modeled CAD drawing. Use the following GET URI:
URI
GET /Windchill/servlet/odata/CADDocumentMgmt/CADDocuments('OR:wt.epm.EPMDocument:172687')/PartDocAssociations?$expand=RelatedPart($select=Name,Version,Number,ObjectType)
Response
The response to the request URI is as follows:
{
"PartDocAssociations": [
{
"ID": "OR:wt.epm.build.EPMBuildRule:173213",
"AssociationType": {
"Value": "CONTRIBUTING_CONTENT",
"Display": "Contributing Content"
},
"RelatedPart": {
"@odata.type": "#PTC.ProdMgmt.ElectricalPart",
"@odata.id": "http://<host>:<port>/Windchill/servlet/odata/v5/ProdMgmt/Parts('OR:wt.part.WTPart:173168')",
"ID": "OR:wt.part.WTPart:173168",
"Name": "cad333.prt",
"Number": "CAD333.PRT",
"ObjectType": "Electrical Part",
"Version": "A.1 (Design)"
}
},
{
"ID": "OR:wt.part.WTPart:173169_Calculated_OR:wt.epm.EPMDocument:173234",
"AssociationType": {
"Value": "CALCULATED",
"Display": "Calculated"
},
"RelatedPart": {
"@odata.type": "#PTC.ProdMgmt.ElectricalPart",
"@odata.id": "http://<host>:<port>/Windchill/servlet/odata/v5/ProdMgmt/Parts('OR:wt.part.WTPart:173169')",
"ID": "OR:wt.part.WTPart:173169",
"Name": "cad222.prt",
"Number": "CAD222.PRT",
"ObjectType": "Electrical Part",
"Version": "A.1 (Design)"
}
},
{
"ID": "OR:wt.part.WTPart:173170_Calculated_OR:wt.epm.EPMDocument:173234",
"AssociationType": {
"Value": "CALCULATED",
"Display": "Calculated"
},
"RelatedPart": {
"@odata.type": "#PTC.ProdMgmt.ElectricalPart",
"@odata.id": "http://<host>:<port>/Windchill/servlet/odata/v5/ProdMgmt/Parts('OR:wt.part.WTPart:173170')",
"ID": "OR:wt.part.WTPart:173170",
"Name": "cad111.prt",
"Number": "CAD111.PRT",
"ObjectType": "Electrical Part",
"Version": "A.1 (Design)"
}
}
]
}
Example: Retrieving Calculated Associations Between a CAD Drawing and Multiple Parts
The following example demonstrates how to retrieve calculated associations between the specified CAD drawing and two parts related to the drawing's model with the Owner and Images association type. Use the following GET URI:
URI
GET /Windchill/servlet/odata/CADDocumentMgmt/CADDocuments('OR:wt.epm.EPMDocument:172318')/PartDocAssociations
Response
The response returns two calculated associations:
{
"PartDocAssociations": [
{
"ID": "OR:wt.part.WTPart:172342_Calculated_OR:wt.epm.EPMDocument:172318",
"AssociationType": {
"Value": "CALCULATED",
"Display": "Calculated"
}
},
{
"ID": "OR:wt.part.WTPart:172343_Calculated_OR:wt.epm.EPMDocument:172318",
"AssociationType": {
"Value": "CALCULATED",
"Display": "Calculated"
}
}
]
}
Example: Retrieving a Specific Calculated Association Along with the Related Part
The following example demonstrates how to retrieve a specific calculated association by specifying the ID of the calculated link between the specified CAD drawing and part. The example also shows you how to retrieve the related part.
|
For a specific calculated association, the calculated link ID returned in the response may change if the associated part is revised.
The request returns the calculated link ID with a part ID of the later version of the associated part. The request returns the related part ID corresponding to the later version of the associated part.
|
Use the following GET URI with expand:
URI
GET /Windchill/servlet/odata/CADDocumentMgmt/CADDocuments('OR:wt.epm.EPMDocument:172687')/PartDocAssociations('OR:wt.part.WTPart:172691_Calculated_OR:wt.epm.EPMDocument:172687')?$expand=RelatedPart($select=Number,Version,Name,ObjectType)
Response
The response returns the specified calculated association and related part:
{
"PartDocAssociations": [
{
"ID": "OR:wt.part.WTPart:172691_Calculated_OR:wt.epm.EPMDocument:172687",
"AssociationType": {
"Value": "CALCULATED",
"Display": "Calculated"
},
"RelatedPart": {
"@odata.type": "#PTC.ProdMgmt.ElectricalPart",
"@odata.id": "http://<host>:<port>/Windchill/servlet/odata/v5/ProdMgmt/Parts('OR:wt.part.WTPart:172691')",
"ID": "OR:wt.part.WTPart:172691",
"Name": "cad222.prt",
"Number": "CAD222.PRT",
"ObjectType": "Electrical Part",
"Version": "A.1 (Design)"
}
}
],
"@PTC.AppliedContainerContex,t.LocalTimeZone": "Asia/Kolkata"
}