public static bool IsProjectPart(this _I.ComponentDefinition oCompDef) { var filename = ((_I.Document)oCompDef.Document).FullFileName; var result = CAddIn.App.DesignProjectManager.IsFileInActiveProject(filename, out _I.LocationTypeEnum locationType, out string projectpath); return(locationType == _I.LocationTypeEnum.kWorkspaceLocation); }
private void rowDelete(BOMView bomView, DataGridView _dgv) { bool remove = true; foreach (DataGridViewRow dgvr in _dgv.Rows) { if (dgvr.Cells[3].Value != null && dgvr.Cells[2].Value.ToString() != "") { foreach (Inventor.BOMRow row in m_BOMView.BOMRows) { oCompDef = row.ComponentDefinitions[1]; oDoc = (Inventor.Document)oCompDef.Document; string partNumber = (string)oDoc.PropertySets[3][2].Value; string desc = (string)oDoc.PropertySets[3][14].Value; string key = (string)oDoc.PropertySets[1][4].Value.ToString(); string pos = (string)row.ItemNumber; partNumber = partNumber.Trim(); if (partNumber == dgvr.Cells[3].Value.ToString() && desc == dgvr.Cells[4].Value.ToString()) { remove = false; break; } } if (remove && dgvr.Cells[4].Value.ToString().StartsWith("p")) { _dgv.Rows.Remove(dgvr); } remove = true; } } }
private void Grid_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 3 || e.ColumnIndex == 4) { Inventor.Application invApp = Macros.StandardAddInServer.m_inventorApplication; Inventor.Document oDoc = invApp.ActiveDocument; Inventor.AssemblyDocument m_AsmDoc = (AssemblyDocument)InvDoc.u.referendedDoc(oDoc as Document); Inventor.BOM m_BOM = m_AsmDoc.ComponentDefinition.BOM; m_BOM.StructuredViewEnabled = true; if (!m_BOM.StructuredViewFirstLevelOnly) { m_BOM.StructuredViewFirstLevelOnly = true; } Inventor.BOMView m_BOMView = m_BOM.BOMViews["Структурированный"]; foreach (Inventor.BOMRow row in m_BOMView.BOMRows) { Inventor.ComponentDefinition oCompDef = row.ComponentDefinitions[1]; oDoc = (Inventor.Document)oCompDef.Document; string partNumber = (string)oDoc.PropertySets[3][2].Value; string desc = (string)oDoc.PropertySets[3][14].Value; if (partNumber == val1 && desc == val2) { switch (x) { case 3: oDoc.PropertySets[3][2].Value = ((DataGridView)sender)[x, y].Value.ToString(); break; case 4: oDoc.PropertySets[3][14].Value = ((DataGridView)sender)[x, y].Value.ToString(); break; } break; } } } }
public static InvComponentDefinition ByInvComponentDefinition(Inventor.ComponentDefinition invComponentDefinition) { return(new InvComponentDefinition(invComponentDefinition)); }
private InvComponentDefinition(Inventor.ComponentDefinition invComponentDefinition) { InternalComponentDefinition = invComponentDefinition; }