Autodesk Vault Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Remove tertiary links
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Historically we have included views of parts on our assembly drawings. Now when we come to itemise the parts we are getting 100+ drawings referenced to the item as tertiary links. I want to write a little routine to do this but can't get the UpdateandCommitItem action to work. I am asusming its something to do with the last parameter (active inputs)
here's the function. I have used active input values of 0,1,2 and 4 to no avail
/// <summary>
/// Remove the unwanted tertiary linked files. These are extracted when a part is explicitly referenced in a Drawing
/// </summary>
/// <param name="itemId"></param>
public void RemoveUnwantedTertiaryLinks(long itemId)
{
Item selItem = m_itemSvc.GetItemsByIds(new long[] { itemId })[0];
//Get the primary linked file
ItemFileAssoc primaryFile = m_itemSvc.GetItemFileAssociationsByItemIds(new long[] { selItem.Id }, ItemFileLnkTypOpt.Primary)[0];
//Get all the tertiary assocs for the item
ItemFileAssoc[] itemFileAssocs = m_itemSvc.GetItemFileAssociationsByItemIds(new long[] { selItem.Id }, ItemFileLnkTypOpt.Tertiary);
IEnumerable<long> fileIds = from fileassoc in itemFileAssocs select fileassoc.CldFileId;
File[] files = m_docSvc.GetFilesByIds(fileIds.ToArray<long>());
File drawingFile = null;
//now match the drawing name to the primary fiule name and remove all the others
foreach (File fle in files)
{
//If the filename matches either the item number or the primary linked filename then keep it
if (System.IO.Path.GetFileNameWithoutExtension(fle.Na me).ToLower() == System.IO.Path.GetFileNameWithoutExtension(primary File.FileName).ToLower() || System.IO.Path.GetFileNameWithoutExtension(fle.Nam e).ToLower() == selItem.ItemNum.ToLower())
{
drawingFile = fle;
break;
}
if (drawingFile != null) break;
}
//now edit the item to update links
Item editItem = m_itemSvc.EditItem(selItem.RevId);
Item updateItem = m_itemSvc.UpdateAndCommitItem(editItem, primaryFile.CldFileId, false, null, null, null, null, null, new long[] { drawingFile.Id }, 1);
}Any one got any pointers?
Greg
Greg Heeley
CAD Administrator
temperzone Ltd
Inventor Pro, Vault Pro, ACADE
Solved! Go to Solution.
Re: Remove tertiary links
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You are correct, it's related to the "active inputs" parameter. Unfortunately, you have run into another documentation bug. The CHM doesn't mention that 8 is the bit value for making the 'tertLinks' input active.
In the code you showed, 'secondary' is the only active field because you pass in 1. If you want both 'secondary' and 'tertLinks' to be active, pass in 9.
Re: Remove tertiary links
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
After you have deleted those links don't you have problem that they return on each Item update?

