Message 1 of 2
Inventor model tree structure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I wanted to create a multilevel tree structure for the model using an API. For creating the structure of the subassembly, I added the default template. and in those added parts. but in that subassembly, I wanted assembly again, but I am not able to insert the same template again, getting the error.
Document _document = inventorApp.ActiveDocument;
AssemblyDocument pDoc = _document as AssemblyDocument;
AssemblyComponentDefinition oPartCompDef = pDoc.ComponentDefinition;
inventorApp.PartOptions.EnableConstructionEnvironment = false;
pDoc.ObjectVisibility.Sketches = true;
ObjectCollection oBodies = inventorApp.TransientObjects.CreateObjectCollection();
TransientGeometry transientGeometry = inventorApp.TransientGeometry;
Matrix matrix = transientGeometry.CreateMatrix();
ComponentOccurrence derivedAssemblyOccurrence = oPartCompDef.Occurrences.Add("D:\\DemoImp\\DemoImp\\Standard.iam", matrix);
derivedAssemblyOccurrence.Name = "SubAssembly1";
ComponentOccurrence derivedAssemblyOccurrence_new1 = derivedAssemblyOccurrence.Definition.Occurrences.Add("D:\\DemoImp\\DemoImp\\Standard.iam", matrix);
derivedAssemblyOccurrence_new1.Name = "SubAssembly2";
ComponentOccurrence derivedAssemblyOccurrence_new2 = derivedAssemblyOccurrence_new1.Definition.Occurrences.Add("D:\\DemoImp\\DemoImp\\Standard.iam", matrix);
derivedAssemblyOccurrence_new2.Name = "SubAssembly3";