- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
I have a question regarding access via the INventor API.
I use VisualStudio Class Library with .NET 6.0 to access the API.
If I read here in the forum, you always access ComponentDefinition this way.
' Get the active assembly. Dim oAsmDoc As AssemblyDocument Set oAsmDoc = ThisApplication.ActiveDocument ' Get the definition of the assembly. Dim oAsmCompDef As AssemblyComponentDefinition Set oAsmCompDef = oAsmDoc.ComponentDefinition
For me in VS, it would look like this.
var _inventor = (Inventor.Application)obj;
var _document = _inventor.ActiveDocument;
var _componentDefinition = _document.CompnentDefinition;
Unfortunately, this does not work for me so to access it I have to go one level higher which I do not understand and therefore does not work as intended?
var _inventor = (Inventor.Application)obj;
var _document = _inventor.ActiveDocument;
foreach (Document refDoc in _document.AllReferencedDocuments)
{
if (refDoc.DocumentType == DocumentTypeEnum.kPartDocumentObject)
{
var doc = (PartDocument)refDoc;
var _doc.Add((doc )refDoc);
}
foreach (ComponentOccurrence occurence in _doc[i].ComponentDefinition.Occurrences)
I would be very grateful for your help or an explanation.
Greetings
Solved! Go to Solution.