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: 

Editing part from within Assembly error

1 REPLY 1
SOLVED
Reply
Message 1 of 2
mslosar
266 Views, 1 Reply

Editing part from within Assembly error

My guess is i'm missing something, but, I've got a small bit of code that allows me to pull a full parts list from our ERP system (which doesn't integrate with inventor at all), and when i find the part number i'm after, i double click and it assigns that part number the part number of the ipt file i'm working on.

 

If I open an .ipt file, this has worked 100%

 

If i place a part in an assembly, and then double click that part to directly edit it, it generates an error every time. My guess is that for some reason the iam file is still the active document, but i'm not sure about that.

 

What exactly needs changed to allow this to work when editing the part inside an assembly?

 

Thanks

 

 

Private Sub DataGridView1_CellDoubleClick(sender As Object, e As Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellDoubleClick
        Dim oDoc As Inventor.PartDocument = g_inventorApplication.ActiveDocument

        Dim oSet As PropertySet = oDoc.PropertySets(3)

        Dim pNumber As String = ""
        If DataGridView1.CurrentCellAddress.X.ToString = "0" Then
            Dim pNans As Integer
            pNumber = DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value
        pNumber = pNumber.Trim()
        pNans = MsgBox("Do you want to assign " & pNumber & " to Part Number?", vbYesNo)
            If pNans = vbYes Then
                oSet.Item("Part Number").Value = pNumber
                MsgBox("Part Number Set")
            End If

        Else
            MsgBox("Can't click this cell")
        End If

    End Sub

 

1 REPLY 1
Message 2 of 2
mslosar
in reply to: mslosar

Figures, ask a question then figure it out yourself 15 minutes later 🙂

 

changed ActiveDocument to ActiveEditObject and all seems to work just fine.

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

Post to forums  

Autodesk Design & Make Report