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

 

There is one more checking required to perform iPartMember.ChangeRow() method. That is whether iPartMember is Custom member or not. This can be verified by iPartMember.CustomMember Property. This returns true if the iPartMember is a Custom member. The modified VBA code looks like below.

 

Sub Test_iPartFolder()
    
    Dim sFile As String
    Const sPath As String = "C:\users\ntonkinson\desktop\102767\"
    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(4)
           
    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

In your case, "Length" is a custom parameter column as shown below.

 

Custom paremeter column.png

Desire iPartTableRow can be searched through TableRows of iPartFactory by comparing the "Length" parameter. iPartTableRow is also a Input parameter for iPartMember.ChangeRow() method.

 

Can you please provide sample iPart and iPartMember files to select desire iPartTableRow? Please make sure that files are non confidential.

 

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