iLogic Rule to Generate All iAssembly members

iLogic Rule to Generate All iAssembly members

lodgera
Explorer Explorer
496 Views
5 Replies
Message 1 of 6

iLogic Rule to Generate All iAssembly members

lodgera
Explorer
Explorer

I'm trying to write a simple rule to generate all iAssy members.  Can someone tell me what's wrong here?  Whenever I run this Inventor just crashes . . .

 

Dim factory As iAssemblyFactory = ThisAssembly.Document.ComponentDefinition.iAssemblyFactory
Dim rows As iAssemblyTableRows = factory.TableRows
Dim row As iAssemblyTableRow

 

For Each row In rows
factory.CreateMember(row)
Next

0 Likes
497 Views
5 Replies
Replies (5)
Message 2 of 6

A.Acheson
Mentor
Mentor

Any errors in the members? The rule works  fine in 2020. Does it generate any error messages? What inventor version are you using? 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 6

fidel.makatiaD5W7V
Alumni
Alumni

Hi @lodgera check this link for a VBA code that implements iAssembly occurence  in Inventor 2022. 

Inventor 2022 Help | Adding iAssembly occurrences | Autodesk

Let me know in case of any questions



Fidel Makatia
Developer Advocate

href=https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-0BD48573-7193-4285-87B7-6727555D053E rel= "noopener noreferrer">Inventor 2022 Documentation |
0 Likes
Message 4 of 6

lodgera
Explorer
Explorer

I'm running 2021.  In the file I was using there were lots of errors so let's forget about that one for now.  I'm now running in a 7 member iAssembly with zero errors.  When I run the rule, it seems to generate members randomly.  The member files already exist on my machine, but my understanding is CreateMember should overwrite/replace any existing file for that member.  On the file I'm in now, the first time I ran it, it created/updated one member file in the middle of the table (member 4 out of 7).  Subsequent attempts to run the rule don't seem to do anything at all.

0 Likes
Message 5 of 6

A.Acheson
Mentor
Mentor

Yes there is consistent issues with running generate members by code and manually. Try perform a manage  rebuild all and save then generate members. If that still doesn't work then change an item in the table and then change it back. Some users add an other column just for this update to actually get an update to happen. 

And to top it all I have had files that only a manual generate worked. 

 

Hope that helps.  

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 6 of 6

lodgera
Explorer
Explorer

I appreciate the input thus far.  I'm trying to figure out some solution to the fact that Inventor wants to 'initial save' iAssembly members for seemingly no reason.  I had read somewhere in this forum that the code-initiated member generation just auto-saves and doesn't give you the prompt you have to click.  But at this point that doesn't seem to be much help given the hit-or-miss the code is.  Any other ideas I'd love to hear them!

0 Likes