Assembly creation is a necessity when creating products that have parts in common with other designs or exist independently in other libraries. This tip will show how the wt.load.LoadFromFile utility be used to load assemblies.
It’s important to note that the <csvAssemblyAddLoad> tag can only be used to create new assemblies using existing parts. The <csvAssemblyAddLoad> cannot be used to create a brand new part. To create a brand new part,
<csvProduct handler="wt.part.LoadPart.beginCreateWTPart" > must first be used to create the part and then you can add constituent parts.
In this example, we will look at two approaches.
1. Adding pre-existing parts to another part from an existing product
You should assume:
· Part-1 exists in Product MyProduct-1. This part may have been loaded previously, or added through the UI
· ExistingPart-1 and ExistingPart-2 reside in another product or library
· MyProduct-1 exists in Organization MyOrg
· The XML data resides in file DataFile.xml
Then the load can be performed with 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
<?xml version="1.0"?>
<!DOCTYPE NmLoader SYSTEM "standard70.dtd">
<NmLoader>
<csvAssemblyAddLoad handler="wt.part.LoadPart.addPartToAssemblyLoad" >
<csvassemblyPartNumber>Part-1</csvassemblyPartNumber>
<csvconstituentPartNumber>ExistingPart-1</csvconstituentPartNumber>
<csvconstituentPartQty>1</csvconstituentPartQty>
<csvconstituentPartUnit>ea</csvconstituentPartUnit>
</csvAssemblyAddLoad>
<NmLoader>
<csvAssemblyAddLoad handler="wt.part.LoadPart.addPartToAssemblyLoad" >
<csvassemblyPartNumber>Part-1</csvassemblyPartNumber>
<csvconstituentPartNumber>ExistingPart-2</csvconstituentPartNumber>
<csvconstituentPartQty>2</csvconstituentPartQty>
<csvconstituentPartUnit>ea</csvconstituentPartUnit>
</csvAssemblyAddLoad>
</NmLoader>
2. Create a brand new part called LoadedAssm-1 and then add existing parts as constituent parts
You should assume:
· ExistingPart-1 resides in another product or library
· MyProduct-1 exists in Organization MyOrg
· The XML data resides in file DataFile.xml
Then the load can be performed with 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
<?xml version="1.0"?>
<!DOCTYPE NmLoader SYSTEM "standard70.dtd">
<NmLoader>
<csvProduct handler="wt.part.LoadPart.beginCreateWTPart" >
<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>
</csvProduct>
<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>
You can gain complete access to the PTC Knowledge Base by becoming an active maintenance customer. Learn more.
Was this Knowledge Base Exclusive helpful? Let us know.