Message 1 of 22
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
I am desperately trying to find a simple code and hope that you can help me out here.
public Application inventor;
public Document document;
inventor = (Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");
document = inventor.ActiveDocument;
PartDocument doc = (PartDocument)inventor.ActiveDocument;
//PartDocument doc = (PartDocument)inventor.Documents.Add(DocumentTypeEnum.kPartDocumentObject, inventor.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject), true);
var _count = doc.ComponentDefinition.Features.Count;
var _count2 = doc.ComponentDefinition.Features.ExtendFeatures.Count;
var _count3 = doc.ComponentDefinition.Features.ExtrudeFeatures.Count;
foreach (var feature in doc.ComponentDefinition.Features)
{
Console.WriteLine(feature.ToString());
var List = feature;
}
I would like to establish a connection to Inventor via VS and C#.
This has already worked.
Now I simply want to count all components and assemblies and save them in a list.
Unfortunately, this does not work.
I suspect there is already an error with PartDocument?
Unfortunately, I am stuck here and am grateful for any help.
Greetings
Solved! Go to Solution.