VBA: Convert an iPartMember to PartDocument

VBA: Convert an iPartMember to PartDocument

Anonymous
Not applicable
588 Views
2 Replies
Message 1 of 3

VBA: Convert an iPartMember to PartDocument

Anonymous
Not applicable

If I have an iPartMember, how can a create a PartDocument from it? It seems to me like there should be a way to do so but I can't find a method (no pun intended).

0 Likes
589 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Seems like the only way is to create an assembly document and use addipartmember under componentoccurences. This seems to automatically create a folder with the corresponding ipartmembers.
0 Likes
Message 3 of 3

frederic.vandenplas
Collaborator
Collaborator

I found a solution, but i don't know if it will work for you

Generate files

Dim oDoc As PartDocument = ThisDoc.Document
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim initRowIndex As Integer
Dim oFactory As iPartFactory = oDef.iPartFactory
' Edit row 1 & 2 of table
oFactory.TableRows.Item(1).Item(3).Value = 2322
oFactory.TableRows.Item(2).Item(3).Value = 4444
' Iterate All Rows of iPart
Dim oRow As iPartTableRow
For Each oRow In oFactory.TableRows
' Generate the member and file, (overwrites member file or creates new file)
oFactory.CreateMember(oRow)
Next
iLogicVb.UpdateWhenDone = True
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes