Beispiel #1
0
        private void открытьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InvDoc.InvDocument <AssemblyDocument> iDoc = new InvDoc.InvDocument <AssemblyDocument>(m_AsmDoc);
            string n = "";

            tbl.loadDataFromXML(iDoc.path, false, ref n);
        }
Beispiel #2
0
        public static void saveData(AssemblyDocument m_AsmDoc)
        {
            XDocument xd = new XDocument();

            InvDoc.InvDocument <AssemblyDocument> iDoc = new InvDoc.InvDocument <AssemblyDocument>(m_AsmDoc);
            iDoc.doc = (Document)m_AsmDoc;
            string name = iDoc.path + iDoc.getProp("Part Number").Value + ".xml";
            //tbl.saveDataInXML(xd,"Data",name, false);
            BOM    m_BOM         = m_AsmDoc.ComponentDefinition.BOM;
            string partNumberAsm = m_AsmDoc.PropertySets[3][2].Value.ToString();

            m_BOM.StructuredViewEnabled = true;
            // if (!m_BOM.StructuredViewFirstLevelOnly)
            // m_BOM.StructuredViewFirstLevelOnly = true;
            if (m_BOM.StructuredViewFirstLevelOnly)
            {
                m_BOM.StructuredViewFirstLevelOnly = false;
            }
            BOMView  m_BOMView = m_BOM.BOMViews["Структурированный"];
            TableInv tbl       = null;

            tbl = new TableInv(m_AsmDoc, @"C:\ProgramData\Autodesk\Inventor Addins\Sequence.xml");
            tbl.addTable(m_BOMView);
            tbl.saveDataInXML(xd, "Data", name, false);
        }
Beispiel #3
0
        private void экспортВXMLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InvDoc.InvDocument <AssemblyDocument> iDoc = new InvDoc.InvDocument <AssemblyDocument>(m_AsmDoc);
            iDoc.doc = (Document)m_AsmDoc;
            string name = iDoc.path + iDoc.getProp("Part Number").Value + "(variable).xml";

            tbl.saveDataInXML(new XDocument(), "Variable", name, true, false);
        }
Beispiel #4
0
        private void импортИзXMLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InvDoc.InvDocument <AssemblyDocument> iDoc = new InvDoc.InvDocument <AssemblyDocument>(m_AsmDoc);
            string n = "";

            tbl.loadDataFromXML(iDoc.path, true, ref n);
            tbl.saveInAsm();
            //dgvVar.Rows.Clear();
            //tbl.showTable(dgvVar, 100, 5000, tbl.group, varData: true);
        }
Beispiel #5
0
        private void загрузитьДанныеToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            DataGridViewRow dgvr;

            InvDoc.InvDocument <AssemblyDocument> iDoc = new InvDoc.InvDocument <AssemblyDocument>(m_AsmDoc);
            iDoc.doc = (Document)m_AsmDoc;
            dgvr     = dgvVar.CurrentRow;
            TableRow tr = tbl.rows.OfType <TableRow>().FirstOrDefault(t => t.group > 100 && t.dvgRow == dgvr.Index);

            if (tr == null)
            {
                return;
            }
            //OpenFileDialog ofd = new OpenFileDialog();
            //ofd.InitialDirectory = iDoc.path;
            //ofd.Filter = "(*.iam, *.ipt)|*.iam;*.ipt";
            //ofd.ShowDialog();
            string fileName = InvDoc.u.OFD(iDoc.path, "(*.iam, *.ipt)|*.iam;*.ipt");
            //string fileName = ofd.FileName;
            Document doc = Macros.StandardAddInServer.m_inventorApplication.Documents.Open(fileName, false);
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic = TableInv.propDoc(doc);
            try
            {
                tr.cells[3].value  = dic["PartNumber"];
                tr.cells[4].value  = dic["desc"];
                tr.cells[6].value  = dic["note"];
                tr.cells[7].value  = dic["dxf"];
                tr.cells[8].value  = dic["thickness"];
                tr.cells[9].value  = dic["FPLength"];
                tr.cells[10].value = dic["FPWidth"];
            }
            catch (Exception)
            {
            }
            doc.Close();
            tbl.showTable(dgvVar, 100, 5000, tbl.group, varData: true);
            //tbl.addVarRows(dgvr.Cells[3].Value.ToString(), dgvr.Cells[4].Value.ToString(), tbl.countPerf);
            //dgv.Rows.Remove(dgvr);
            //tbl.showTable(dgv, 0, 99, tbl.group, varData: false);
            //tbl.showTable(dgvVar, 100, 5000, tbl.groupVar, varData: true);
            //balloon();
        }