private string GetRevision(InventorApprentice.ApprenticeServerDocument Doc) { InventorApprentice.PropertySets propSets; InventorApprentice.PropertySet propSet; InventorApprentice.Property revProp; string revValue; propSets = Doc.PropertySets; propSet = propSets["Inventor Summary Information"]; revProp = propSet["Revision Number"]; revValue = revProp.Value; return(revValue); }
private void OpenFile() { try { invApp = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application"); } catch { System.Type oType = System.Type.GetTypeFromProgID("Inventor.Application"); invApp = (Inventor.Application)System.Activator.CreateInstance(oType); invApp.Visible = false; } try { GetFiles(); drawingListView.Columns.Add("File Name"); drawingListView.Columns.Add("Revision"); drawingListView.Columns[0].Width = 250; drawingListView.Columns[1].Width = 150; drawingListView.BeginUpdate(); foreach (ReferenceDoc rd in referenceDocs) { ListViewItem lv = new ListViewItem(rd.DrawingName, 0); lv.SubItems.Add(rd.Revision); drawingListView.Items.Add(lv); } drawingListView.EndUpdate(); assemblyDoc = apprentice.Open(assemblyPath); btnOK.Enabled = true; } catch (System.Runtime.InteropServices.COMException ex) { MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }