Error while adding iAssembly members to occurrences
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to add iAssembly occurrences but it is throwing an exception. Please find the below code
AssemblyDocument oDoc = (AssemblyDocument)invApp.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject, "", false);
ComponentOccurrences oOccs = oDoc.ComponentDefinition.Occurrences;
Matrix oPos = invApp.TransientGeometry.CreateMatrix();
double oStep = 0;
iAssemblyFactory oiAssemblyFactory = assmComponentDefinition.iAssemblyFactory;
var tableRowCount = oiAssemblyFactory.TableRows.Count;
for (double iRow = 1; iRow <= (oiAssemblyFactory.TableRows.Count); iRow++)
{
oStep = oStep + 10;
oPos.SetTranslation(invApp.TransientGeometry.CreateVector(oStep, oStep, 0), false);
string filenameis = assmDocument.DisplayName;
string getParent=Directory.GetParent(assmDocument.FullDocumentName).FullName;
string parentPath = getParent + "\\" + System.IO.Path.GetFileNameWithoutExtension(assmDocument.DisplayName);
if (!Directory.Exists(parentPath))
{
Directory.CreateDirectory(parentPath);
}
//Exception at below line
ComponentOccurrence occs = oOccs.AddiAssemblyMember(assmDocument.FullDocumentName, oPos, iRow);
Also same code is working for exporting 2D drawing views and step files but failed for 3D export on the same system.
I have reinstalled Inventor and also run it in Administrative mode but it didn't work for me.
Please help for this
Attachment