Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Assembly AllLeafOccurrences using Apprentice

2 REPLIES 2
Reply
Message 1 of 3
NachitoMax
757 Views, 2 Replies

Assembly AllLeafOccurrences using Apprentice

Hi

 

I currently loop through my assembly and get iProperties using the AllLeafOccurrences method. I now need to do the exact same, but using apprentice so that the file doesnt open.

 

Reason:

I use the apprentice method to get a collection of file names and iproperties and populate a datagrid. This is super fast. When i iterate through my assembly as a normal document, the iteration is very slow compared to the apprentice iteration.

 

The only thing i cannot get working is my loop using Apprentice. Can it be done? I thought that once the document was opened by apprentice, you could access everything in the same way as you would if it was opened directly.

 

Dim apprentice As Inventor.ApprenticeServerComponent = New ApprenticeServerComponent
        Dim apprenticeDoc As Inventor.ApprenticeServerDocument = apprentice.Open(AssemblyPath)

        Dim oasmdef As ComponentDefinition = apprenticeDoc.ComponentDefinition
        Dim oLeafOccs As ComponentOccurrencesEnumerator = oasmdef.Occurrences.AllLeafOccurrences

        For Each oCompOcc As ComponentOccurrence In oLeafOccs
'EVERYTHING FROM HERE DOES NOT WORK

Nacho

Automation & Design Engineer

Inventor Programmer (C#, VB.Net / iLogic)


EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


2 REPLIES 2
Message 2 of 3
J-SHould
in reply to: NachitoMax

Hello,

 

can you explain what is not working cause from here, when I try your code, everything is fine.

 

Best regards,

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
--------------------------------------
Jean-Sébastien Hould
Autodesk Inventor 2014
Automation
Message 3 of 3
MechMachineMan
in reply to: J-SHould

It's hard to troubleshoot when you only give us the working part of your code..... ha!


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report