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
Solved! Go to Solution.
Solved by mslosar. Go to Solution.
Figures, ask a question then figure it out yourself 15 minutes later 🙂
changed ActiveDocument to ActiveEditObject and all seems to work just fine.