private void balloon() { string partNumber, desc, note; dic = dic ?? new Dictionary <string, string>(); dic.Clear(); foreach (Balloon ball in m_DrwDoc.ActiveSheet.Balloons) { foreach (BalloonValueSet item in ball.BalloonValueSets) { BOMRow row = item.ReferencedRow.BOMRow; dic = tbl.propDoc(row); partNumber = dic["PartNumber"]; desc = dic["desc"]; note = dic["note"]; TableRow tr = tbl.rows.Find(r => r.cells[3].value == partNumber && r.cells[4].value == desc); if (tr != null) { if (tr.group < 100) { dgv[0, tr.dvgRow].Style.BackColor = System.Drawing.Color.Green; } else { dgvVar[0, tr.dvgRow].Style.BackColor = System.Drawing.Color.Green; } } } } }
public void BomAccess() { AssemblyDocument oDoc = (AssemblyDocument)_InvApplication.ActiveDocument; AssemblyComponentDefinition oDef = oDoc.ComponentDefinition; BOM oBOM = default(BOM); oBOM = oDef.BOM; oBOM.StructuredViewEnabled = true; BOMView oBomView = oBOM.BOMViews["Structured"]; int rowIdx = 0; for (rowIdx = 1; rowIdx <= oBomView.BOMRows.Count; rowIdx++) { BOMRow oRow = oBomView.BOMRows[rowIdx]; Debug.Print("ItemNumber: " + oRow.ItemNumber + " TotalQuantity = " + oRow.TotalQuantity); ComponentDefinition oCompDef = oRow.ComponentDefinitions[1]; PropertySet oDesignPropSet = default(PropertySet); oDesignPropSet = oCompDef.Document.PropertySets("Design Tracking Properties"); } }
public void Dispose() { if (_row != null) { Marshal.ReleaseComObject(_row); _row = null; } }
/// <summary> /// Returns the BOM row's primary component definition, or <c>null</c> /// if the row doesn't contain one. /// </summary> /// <param name="row">The <see cref="BOMRow"/> instance that this extension method affects.</param> /// <exception cref="ArgumentNullException"><paramref name="BOMRow"/> is <c>null</c>.</exception> public static ComponentDefinition PrimaryComponentDefinition(this BOMRow row) { if (row == null) { throw new ArgumentNullException(nameof(row)); } if (row.ComponentDefinitions.Count == 0) { return(null); } return(row.ComponentDefinitions[1]); }
private void QueryBOM(BOMRowsEnumerator bomRows) { for (int i = 1; i < bomRows.Count + 1; i++) { try { BOMRow bomRow = bomRows[i]; ComponentDefinition compDef = bomRow.ComponentDefinitions[1]; Document doc = (Document)compDef.Document; PropertySets propertySets = doc.PropertySets; PropertySet propertySet = propertySets["Design Tracking Properties"]; Property descProp = propertySet["Description"]; //Property weightProp Property materialProp = propertySet["Material"]; Property costProp = propertySet["Cost"]; matBreakdown.Rows.Add(bomRow.ItemQuantity, descProp.Value, materialProp.Value, costProp.Value); Marshal.ReleaseComObject(costProp); costProp = null; Marshal.ReleaseComObject(materialProp); materialProp = null; Marshal.ReleaseComObject(descProp); descProp = null; Marshal.ReleaseComObject(propertySet); propertySet = null; Marshal.ReleaseComObject(propertySets); propertySets = null; Marshal.ReleaseComObject(doc); doc = null; Marshal.ReleaseComObject(compDef); compDef = null; Marshal.ReleaseComObject(bomRow); bomRow = null; } catch (Exception ex) { Console.WriteLine(ex.Message); } } }
public InventorBomItem(BOMRow row) { _row = row; }