Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
chandra.shekar.g
in reply to: Anonymous

@Anonymous,

 

Actually, iPartMember is generated by placing in an assembly. The same iPartMember can be used to change row. For more details, please refer the screencast video which is uploaded to below link.

 

http://autode.sk/2nEZZnE

 

In video demonstration, the used Custom iPart contains 4 table row. It is changed from 1st row to 3rd row. Currently, iPartmeber is in 3rd iPartTableRow. Custom iPart (iPart_Custom.ipt) and iPart member(Part1-01.ipt) which are used for demonstration are attached with this post.

 

 

Try the same VBA code.

 

Sub Test_iPartFolder()
    
    Dim sFile As String
    Const sPath As String = "Path of iPartMember folder\"
    Dim oDoc As Document
    Dim oIpart As iPartMember
 
    sFile = Dir(sPath & "*.ipt*")
    Do Until sFile = ""
        Set oDoc = ThisApplication.Documents.Open(sPath & sFile, False)
        If oDoc.ComponentDefinition.IsiPartMember = False Then GoTo NextFile
        Set oIpart = oDoc.ComponentDefinition.iPartMember
        If oIpart.HealthStatus <> kUpToDateHealth Then GoTo NextFile
    If oIpart.CustomMember = False Then GoTo NextFile

        Dim iPart As PartDocument
        Set iPart = oIpart.ReferencedDocumentDescriptor.ReferencedDocument
        
        Dim oDef As PartComponentDefinition
        Set oDef = iPart.ComponentDefinition
        
        Dim iFactory As iPartFactory
        Set iFactory = oDef.iPartFactory
        
        Dim oRow As iPartTableRow
        Set oRow = iFactory.TableRows.Item(3)
        
        Call oIpart.ChangeRow(oRow) 'works if I only call an int, but not if I use other arguments
            'in this specific test case, I know I need to call row 668. Later I will add logic to determine what row is needed.
        oDoc.Update
        oDoc.Save
        
NextFile:
        oDoc.Close
        DoEvents
        sFile = Dir
    Loop
    
End Sub

 

Change the location of iPart member after downloading in above code.

 

Please feel free to contact if there is any queries.

 

If solves problem, click on "Accept as solution" / give a "Kudo".

 

Thanks and regards,

 

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network