Exemplo n.º 1
0
        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;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        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");
            }
        }
Exemplo n.º 3
0
 public void Dispose()
 {
     if (_row != null)
     {
         Marshal.ReleaseComObject(_row);
         _row = null;
     }
 }
Exemplo n.º 4
0
        /// <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]);
        }
Exemplo n.º 5
0
        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);
                }
            }
        }
Exemplo n.º 6
0
 public InventorBomItem(BOMRow row)
 {
     _row = row;
 }