Enterprise Administration > Windchill Data Loading > Loading Product Objects and Parts: Windchill PDMLink Example > Loading Parts
  
Loading Parts
Adding Existing Parts to Another Existing Part in a Product
This example assumes the following:
Part-1 exists in the product MyProduct-1. This part may have been loaded previously or added through the user interface.
ExistingPart-1 and ExistingPart-2 reside in some other product or library.
MyProduct-1 exists in the organization, MyOrg.
The XML data resides in the file DataFile.xml.
Given these assumptions, the load can be performed using the following command:
windchill wt.load.LoadFromFile -d DataFile.xml -u wcadmin
-p wcadmin -CONT_PATH /wt.inf.container.OrgContainer=MyOrg
/wt.pdmlink.PDMLinkProduct=MyProduct-1
The load can also be performed with a library context using the following command:
windchill wt.load.LoadFromFile -d DataFile.xml -u wcadmin
-p wcadmin -CONT_PATH /wt.inf.container.OrgContainer=MyOrg
/wt.inf.library.WTLibrary=MyLib
Example
The following is an example data file:
<?xml version="1.0"?>
<!DOCTYPE NmLoader SYSTEM "standardX20.dtd">
<NmLoader>
<csvAssemblyAddLoad handler="wt.part.LoadPart.addPartToAssemblyLoad">
<csvassemblyPartNumber>0000000022</csvassemblyPartNumber>
<csvconstituentPartNumber>0000000002</csvconstituentPartNumber>
<csvconstituentPartQty>1</csvconstituentPartQty>
<csvconstituentPartUnit>ea</csvconstituentPartUnit>
<csvassemblyPartVersion>D</csvassemblyPartVersion>
<csvassemblyPartIteration>1</csvassemblyPartIteration>
<csvassemblyPartView>Manufacturing</csvassemblyPartView>
<csvorganizationName></csvorganizationName>
<csvorganizationID></csvorganizationID>
</csvAssemblyAddLoad>
</NmLoader>
Creating a New Part Called LoadedAssm-1 and Adding Existing Parts as Constituent Parts
This example assumes the following:
ExistingPart-1 resides in some other product or library.
MyProduct-1 exists in the organization, MyOrg.
The XML data resides in the file DataFile.xml.
Given these assumptions, the load can be performed using the following command:
windchill wt.load.LoadFromFile -d DataFile.xml -u wcadmin
-p wcadmin -CONT_PATH /wt.inf.container.OrgContainer=MyOrg
/wt.pdmlink.PDMLinkProduct=MyProduct-1
Example
The following is an example data file:
<?xml version="1.0"?>
<!DOCTYPE NmLoader SYSTEM "standardX20.dtd">
<NmLoader>
<csvBeginWTPart handler="wt.part.LoadPart.beginCreateWTPart" >
<csvuser></csvuser>
<csvpartName>LoadedAssm-1</csvpartName>
<csvpartNumber>LoadedAssm-1</csvpartNumber>
<csvtype>separable</csvtype>
<csvsource>make</csvsource>
<csvfolder>/Default</csvfolder>
<csvlifecycle>Default</csvlifecycle>
<csvview></csvview>
<csvteamTemplate>System.TestTeamForLoads</csvteamTemplate>
<csvlifecyclestate>INWORK</csvlifecyclestate>
<csvtypedef></csvtypedef>
<csvversion></csvversion>
<csviteration></csviteration>
<csvparentContainerPath></csvparentContainerPath>
</csvBeginWTPart>
<csvEndWTPart handler="wt.part.LoadPart.endCreateWTPart" >
<csvpublishFlag></csvpublishFlag>
<csvparentContainerPath></csvparentContainerPath>
</csvEndWTPart>
<csvAssemblyAddLoad handler="wt.part.LoadPart.addPartToAssemblyLoad" >
<csvassemblyPartNumber>LoadedAssm-1</csvassemblyPartNumber>
<csvconstituentPartNumber>ExistingPart-1</csvconstituentPartNumber>
<csvconstituentPartQty>1</csvconstituentPartQty>
<csvconstituentPartUnit>ea</csvconstituentPartUnit>
</csvAssemblyAddLoad>
</NmLoader>
If you are an MPMLink user, the enterprise data objects may get automatically created when creating a part using a loader. To disable automatic creation of the objects, add the elements DisableEnterpriseDataServiceForPartLoader and EnableEnterpriseDataServiceForPartLoader after and before the NmLoader tags, respectively, in the XML data file. This action ignores the preferences set for creating enterprise data and plant-specific functional data objects. For more information, see Preferences in MPMLink.
The following example illustrates the usage of the elements EnableEnterpriseDataServiceForPartLoader and DisableEnterpriseDataServiceForPartLoader.
<?xml version="1.0"?>
<!DOCTYPE NmLoader SYSTEM "standardX20.dtd">
<NmLoader>
<!-- This tag disables the preferences for creating enterprise data while loading the parts -->
<csvDisableEnterpriseDataServiceForPartLoader
handler="com.ptc.windchill.enterprise.data.load.LoadEnterpriseDataPlantFunctionalData.disableEnterpriseDataServiceForPartLoader"/>
<csvBeginWTPart handler="wt.part.LoadPart.beginCreateWTPart" >
<csvuser></csvuser>
<csvpartName>LoadedAssm-1</csvpartName>
<csvpartNumber>LoadedAssm-1</csvpartNumber>
<csvtype>separable</csvtype>
<csvsource>make</csvsource>
<csvfolder>/Default</csvfolder>
<csvlifecycle>Default</csvlifecycle>
<csvview></csvview>
<csvteamTemplate>System.TestTeamForLoads</csvteamTemplate>
<csvlifecyclestate>INWORK</csvlifecyclestate>
<csvtypedef></csvtypedef>
<csvversion></csvversion>
<csviteration></csviteration>
<csvparentContainerPath></csvparentContainerPath>
</csvBeginWTPart>
<csvEndWTPart handler="wt.part.LoadPart.endCreateWTPart" >
<csvpublishFlag></csvpublishFlag>
<csvparentContainerPath></csvparentContainerPath>
</csvEndWTPart>
<csvAssemblyAddLoad handler="wt.part.LoadPart.addPartToAssemblyLoad" >
<csvassemblyPartNumber>LoadedAssm-1</csvassemblyPartNumber>
<csvconstituentPartNumber>ExistingPart-1</csvconstituentPartNumber>
<csvconstituentPartQty>1</csvconstituentPartQty>
<csvconstituentPartUnit>ea</csvconstituentPartUnit>
</csvAssemblyAddLoad>
<!-- This tag enables the preferences for creating enterprise data after loading the parts -->
<csvEnableEnterpriseDataServiceForPartLoader
handler="com.ptc.windchill.enterprise.data.load.LoadEnterpriseDataPlantFunctionalData.enableEnterpriseDataServiceForPartLoader"/>
</NmLoader>
Tag Descriptions
Following are descriptions of the tags for the <csvBeginWTPart> tag:
user—The name of the user to assign as the creator of the part.
partName—The name of the part. A value is required.
partNumber—The number of the part. A value is required.
type—Identifies whether the part is an assembly or component. A value is required when you create a new part, and it can be updated. Values include:
Separable—The part is an assembly that can be disassembled without destroying it. For example, a mechanical assembly put together with removable fasteners such as screws.
Inseparable—The part is an assembly that, once built, cannot be disassembled without destroying it. For example, a welded metal assembly.
Component—A part with no child parts.
source—Where the part is acquired. The following options are available:
Make—The new part is made internally.
Buy—The new part is purchased externally.
Buy—Single Source—The new part is purchased externally from a single source.
folder—The location of the part in the container, such as /Default.
lifecycle—The life cycle of the part.
view—The view of the part.
teamTemplate—The team template, such as System.TestTeamForLoads.
lifecyclestate—The life cycle state of the part, such as INWORK.
typedef—The type definition for creating soft part. For example, com.ptc.ptcnet.SoftPart1.
version—The version of the part. If no value is specified, the first version defined in the object initialization rules (OIR) is used.
iteration—The iteration of the part. If no value is specified, the first iteration defined in the object initialization rules (OIR) is used.
parentContainerPath—The context where the parent part is located.