Hi guys,
I usually work with very large assemblies (about 20 - 25 thousand parts), and sometimes have to use assembly features to cut some of the components.
The problem is that it takes forever to include lots of components to participate of that feature. You may be thinking that I should cut through all and them remove the components I don't want to cut, but I have tried this many times and my Inventor Pro 2014 crashed every time I tried.
So, I got some parts of codes here and there (I am pretty noob at iLogic programming, I am sorry), and I got this code that works, but much slower than what I wanted:
Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition oDef = oAsmDoc.ComponentDefinition Dim oAssemblyFeatures As Features oAssemblyFeatures = oDef.Features Dim oAsyFeat As PartFeature oAsyFeat = oAssemblyFeatures.ExtrudeFeatures.Item(1) Dim compOcc As ComponentOccurrence 'InventorVb.DocumentUpdate(False) 'iLogicVb.UpdateWhenDone = True Try For Each compOcc In oAsmDoc.SelectSet oAsyFeat.AddParticipant (compOcc) Next Catch MessageBox.Show("Erro", "iLogic") Return End Try
I know, it adds the selected componens ONLY to the first feature of the assembly. In my case, I have only one feature.
It takes so long time to run because of the update of the assembly on every loop of the For Each ... Next. I tried to include the two commented lines above, but when I did it, the rule stoped working!
I would like to stop updating the assembly and update after the rule concludes, that I thought "iLogicVb.UpdateWhenDone = True" would do, but I don't know what I am doing wrong.
Any ideas?
Thank you very much!
You could try to use a global transaction, below is some VBA code that should also work in iLogic:
Public Sub RunGlobalTx() Dim Tx As Transaction Set Tx = ThisApplication.TransactionManager.StartGlobalTransaction( _ ThisApplication.ActiveDocument, _ "ADN") 'do some stuff ... Tx.End End Sub
Hope it helps,
Philippe.