private InvComponentOccurrences(Inventor.ComponentOccurrences invComponentOccurrences) { InternalComponentOccurrences = invComponentOccurrences; occurrenceList = new List <InvComponentOccurrence>(); foreach (var occurrenceDef in InternalComponentOccurrences) { occurrenceList.Add(InvComponentOccurrence.ByInvComponentOccurrence((Inventor.ComponentOccurrence)occurrenceDef)); } }
private void GetTreeComponents(Inventor.ComponentOccurrences inCollection, TreeNode objparentNode) //uses BuildTree iterate components TO FINISH { //iterate through the components in the current collection IEnumerator assemblyEnumerator = inCollection.GetEnumerator(); Inventor.ComponentOccurrence invCompOccurrence; while (assemblyEnumerator.MoveNext() == true) { invCompOccurrence = (Inventor.ComponentOccurrence)assemblyEnumerator.Current; int ImageType = 10; //determine if the current component is an assembly or part or iparts/iAssembly if (invCompOccurrence.IsiAssemblyMember || invCompOccurrence.IsiPartMember) { if (invCompOccurrence.IsiAssemblyMember) { ImageType = 1; } else { ImageType = 3; } } else { if (invCompOccurrence.DefinitionDocumentType == Inventor.DocumentTypeEnum.kAssemblyDocumentObject) { ImageType = 0; } else { ImageType = 2; } } TreeNode invCurrentNode = new TreeNode(invCompOccurrence.Name, ImageType, ImageType); invCurrentNode.Tag = invCompOccurrence.ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReferencedFile.FullFileName; objparentNode.Nodes.Add(invCurrentNode); //recursively call this function for the suboccurrences of the current component GetTreeComponents((Inventor.ComponentOccurrences)invCompOccurrence.SubOccurrences, invCurrentNode); invCurrentNode.Expand(); } }
public static InvComponentOccurrences ByInvComponentOccurrences(Inventor.ComponentOccurrences invComponentOccurrences) { return(new InvComponentOccurrences(invComponentOccurrences)); }