Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC CAD Document Management Domain > Retrieving the Consolidated Components List for a CAD Document Structure
  
Retrieving the Consolidated Components List for a CAD Document Structure
Using the GetMultiLevelComponentsReport action, you can retrieve any of the following lists depending on the value specified for the ShowSingleLevelReport flag:
A consolidated flat list of leaf node components and their total quantity within an entire CAD document structure (multi-level component list).
A consolidated flat list of components and their total quantity that are directly used by the specified CAD document structure (single-level consolidated BOM).
You can retrieve the consolidated multi-level component list when the value of ShowSingleLevelReport is false.
* 
When the ShowSingleLevelReport flag is not specified in the request body, its default value is false.
You can retrieve the single-level consolidated BOM when ShowSingleLevelReport is specified as true in the request body.
If you specify BOMMembersOnly as true in the request body, only the CAD document components that participate in the BOM structure are returned.
* 
When the BOMMembersOnly flag is not specified in the request body, its default value is false.
Example: Retrieving the Multi-Level Component List for a CAD Document Structure
This example shows you how to retrieve the consolidated leaf node components with the total quantity and unit within the entire CAD document structure. In this example, the ShowSingleLevelReport and BOMMembersOnly attributes are specified as false in the request body.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/CADDocumentMgmt/CADDocuments('OR:wt.epm.EPMDocument:191238')/PTC.CADDocumentMgmt.GetMultiLevelComponentsReport?$count=true
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"BOMMembersOnly": false,
"ShowSingleLevelReport": false
}
The request returns the consolidated leaf node components with the total Quantity and Unit for the CAD document structure specified in the request URI.
Example: Retrieving the Multi-Level Component List for a CAD Document Structure with Navigation Criteria
This example shows you how to retrieve the consolidated leaf node components in the Released state with the total quantity and unit within the entire CAD document structure with navigation criteria. In this example, BOMMembersOnly is specified as true in the request body.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/CADDocumentMgmt/CADDocuments('OR:wt.epm.EPMDocument:191238')/PTC.CADDocumentMgmt.GetMultiLevelComponentsReport?$select=Name,Number,Quantity,Unit,Resolved,HasUnresolvedObjectsByAccessRights,HasChildren&$orderby=Quantity desc&$count=true&$expand=CADDocument($select=Identity,SubCategory,FileName,State)
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"NavigationCriteria": {
"ApplicableType": "PTC.CADDocumentMgmt.CADDocument",
"ApplicationName": null,
"ApplyToTopLevelObject": false,
"Centricity": false,
"ConfigSpecs": [
{
"@odata.type": "#PTC.NavCriteria.EPMDocStandardConfigSpec",
"WorkingIncluded": false,
"LifeCycleState": {
"Value": "RELEASED",
"Display": "Released"
}
}
],
"Filters": [],
"HideUnresolvedDependents": false,
"UseDefaultForUnresolved": false
},
"BOMMembersOnly": true
}
The request returns only the consolidated leaf node components with the total Quantity and Unit that participate in the CAD document structure specified in the request URI.
Example: Retrieving the Single-Level Consolidated BOM for a CAD Document Structure
This example shows you how to retrieve the single-level consolidated components with the total quantity and unit for the specified CAD document structure. In this example, ShowSingleLevelReport is specified as true in the request body.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/CADDocumentMgmt/CADDocuments('OR:wt.epm.EPMDocument:191238')/PTC.CADDocumentMgmt.GetMultiLevelComponentsReport?$count=true
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"ShowSingleLevelReport": true
}
Example: Retrieving the Multi-Level Component List and the Related Drawings Using Navigation Criteria
This example shows you how to retrieve the consolidated leaf node components in the Released state with the total quantity and unit within the entire CAD document structure with navigation criteria. This example also shows you how to retrieve their related drawings in the Released state using an expand on Drawings.
Use the following POST URI and the request body.
URI
POST /Windchill/servlet/odata/CADDocumentMgmt/CADDocuments('OR:wt.epm.EPMDocument:195550')/PTC.CADDocumentMgmt.GetMultiLevelComponentsReport?$select=ID,Quantity,Name,Number,Unit,Quantity&$orderby=Quantity desc&$expand=CADDocument($select=Identity,Version,Name,FileName,Number,Version,CheckoutState;$expand=Drawings($select=Name,Number,FileName,Version,State,CheckOutStatus))
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"NavigationCriteria": {
"ApplicableType": "PTC.CADDocumentMgmt.CADDocument",
"ApplicationName": null,
"ApplyToTopLevelObject": false,
"Centricity": false,
"ConfigSpecs": [
{
"@odata.type": "#PTC.NavCriteria.EPMDocStandardConfigSpec",
"WorkingIncluded": false,
"LifeCycleState": {
"Value": "RELEASED",
"Display": "Released"
}
}
],
"Filters": [],
"HideUnresolvedDependents": false,
"UseDefaultForUnresolved": false
}
}
The request returns the consolidated leaf node components with the total Quantity and Unit along with their related drawings within the entire CAD document structure.
Example: Retrieving the Multi-Level Component List When Path Filters Are Applied As Navigation Criteria in a CAD Document Structure
This example shows you how to retrieve the consolidated leaf node components with the total quantity and unit when path filters are applied in a CAD document structure.
In this example, a path filter is applied as a navigation criterion to a leaf node each in two different subassemblies.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/CADDocumentMgmt/CADDocuments('OR:wt.epm.EPMDocument:173865')/PTC.CADDocumentMgmt.GetMultiLevelComponentsReport?$select=ID,Quantity,Name,Number,Unit,Quantity&$orderby=Quantity desc&$expand=CADDocument($select=Identity,Version,Name,FileName,Number,Version,CheckoutState)
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"NavigationCriteria": {
"ApplicableType": "PTC.CADDocumentMgmt.CADDocument",
"Filters": [
{
"@odata.type": "#PTC.NavCriteria.UsesPathFilter",
"RootIdentifier": "wt.epm.EPMDocument:173865",
"Paths": [
{
"DisplayPath": "/M|child2.asm|43/M|Child21.prt|46",
"InternalPath": "/M|child2.asm|43/M|Child21.prt|46"
},
{
"DisplayPath": "/M|child3.asm|44/M|Child31.prt|40",
"InternalPath": "/M|child3.asm|44/M|Child31.prt|40"
}
]
}
]
}
}
The request consolidates different uses of Child21 of the same unit within the subassembly for which the path filter is applied, and returns them as one Child21 leaf node with the total quantity and its unit.
The request consolidates different uses of Child31 of the same unit within the subassembly for which the path filter is applied, and returns them as one Child31 leaf node with the total quantity and its unit.
The request returns each consolidated Child21 and Child31 leaf component with their total Quantity and Unit, respectively.
For example, consider a car assembly CAD document in which a path filter is applied to the engine subassembly component and another path filter is applied to the exhaust system subassembly component. The request consolidates the same leaf nodes, such as valve components of the unit “each” within the engine subassembly, and lists the “valve” component only once with the total quantity and a unit “each”. Similarly, the request consolidates the same leaf nodes, such as sleeve components of the unit “each” within the exhaust system subassembly, and lists the “sleeve” component only once with the total quantity and a unit “each”. When both the engine and exhaust system subassemblies use a common fastener such as “bolt”, this request consolidates the common leaf node component “bolt” of the unit “each” within both the engine and exhaust system subassemblies and returns it only once with the total quantity and unit of “each”.