Hi,
I have lot of iPart and iAssembly files. Could I generate files without clicking every member? Now I right click member and I choose "Generate files"
I mean that Could I use for example task scheduler to this works?
Solved! Go to Solution.
Solved by karthur1. Go to Solution.
Check out the following code, it is not mine but written by Bob Van der Donck our Technical Lead who also write Blog postings; http://beinginventive.typepad.com/being-inventive/
Here is the API equivalent of what you can do through the UI:
Code that uses a For…next loop
Public Sub ipart_member_generation()
Dim odoc As Inventor.PartDocument
Set odoc = ThisApplication.ActiveDocument
Dim rowindex As Long
For i = 1 To odoc.ComponentDefinition.iPartFactory.TableRows.Count
rowindex = odoc.ComponentDefinition.iPartFactory.TableRows.Item(i).index
Call odoc.ComponentDefinition.iPartFactory.CreateMember(rowindex)
Next i
End Sub
Code that uses a For each.. Next loop
Public Sub ipart_member_generation()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim factory As iPartFactory
Set factory = oDoc.ComponentDefinition.iPartFactory
Dim row As iPartTableRow
For Each row In factory.TableRows
Dim member As iPartMember
Set member = factory.CreateMember(row)
Next
End Sub
Code to generate all member of an iAssembly factory
Public Sub iassembly_member_generation()
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
Dim factory As iAssemblyFactory
Set factory = oDoc.ComponentDefinition.iAssemblyFactory
Dim rowindex As Long
For i = 1 To oDoc.ComponentDefinition.iAssemblyFactory.TableRows.count
rowindex = oDoc.ComponentDefinition.iAssemblyFactory.TableRows.Item(i).index
Call oDoc.ComponentDefinition.iAssemblyFactory.CreateMember(rowindex)
Next i
End Sub
Maybe you can adapt the code to work for you.
Jon
Here is something that I have used in the past when I need to "Re" generate my ipart members.
Thanks jon.dean for reposting this. You just saved me at least a days worth of work. I have hundreds of ipart configurations that needed to be Re-generated.