Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete a iPart Table row Programatically

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
santoshr0114
1090 Views, 3 Replies

Delete a iPart Table row Programatically

Hi Guys,

 

In ipart there is an option to add and delete rows when working with inventor graphically.

 

I have displayed the iPart table and the values in gridview using VB.Net.

 

The user then selects the row in datagridview and clicks the button delete.

When the button onclick even is triggered i want to delete the selected row on ipart table inside inventor 

 

Does anybody has an idea of how to do it ???

Regards
Santosh
3 REPLIES 3
Message 2 of 4
ekinsb
in reply to: santoshr0114

Here's some sample code that illustrates deleting a row from the table of an iPart factory.  The example deletes the last row.  In your case I suspect you've loaded them into your grid in the same order as they are in the factory so you know the index of the row to delete.

 

Public Sub DeleteIPartRow()
    Dim partDoc As PartDocument
    Set partDoc = ThisApplication.ActiveDocument    

    If Not partDoc.ComponentDefinition.IsiPartFactory Then
        MsgBox "Must be an iPart factory."
        Exit Sub
    End If

    Dim factory As iPartFactory
    Set factory = partDoc.ComponentDefinition.iPartFactory

    factory.TableRows.Item(factory.TableRows.Count).Delete
End Sub

Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 4
santoshr0114
in reply to: ekinsb

ekinsb

 

I have already tried this, but i need the user to select the row from datagridview and then use the delete button.

And Yes I've added all the data in the same order as displayed in inventor, and also disabled the sorting of columns in datagridview.

 

Is there any way to pass the datagridview selected row index in the below code

factory.TableRows.Item(factory.TableRows.Count).Delete)

 


Regards
Santosh
Message 4 of 4
santoshr0114
in reply to: santoshr0114

ekinsb,

 

I got it solved...

 

Thanks for the hint provided.

 

 

Regards
Santosh

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report