Ejemplo n.º 1
0
        public void AddInformation()
        {
            m_insertXportForm.btnsure.Enabled        = false;
            m_insertXportForm.checkfirstFace.Checked = true;
            string[] getresult = new string[25];
            string   sql;

            if (m_insertXportForm.radiobtn2.Checked == true)
            {
                sql = @"select * from ExpanderPlugPort";
                //m_insertXportForm.comBXport.Text = "M-20-16";
                codenumber = "1801";
                indexname  = "ExpanderPlugPort";
            }
            else
            {
                sql = @"select * from OrificePlugPort";
                //m_insertXportForm.comBXport.Text = "M12x1.75-6H";
                codenumber = "1901";
                indexname  = "OrificePlugPort";
            }
            m_connectToaccess = new ConnectToAccess(filepath, "CavityLibrary");
            m_connectToaccess.GetInformation(sql, "编码", out getresult);
            m_insertXportForm.comBXport.Items.Clear();
            int i = 0;

            while (getresult[i] != null)
            {
                m_insertXportForm.comBXport.Items.Add(getresult[i]);
                i++;
            }
            m_insertXportForm.comBXport.Text = m_insertXportForm.comBXport.Items[0].ToString();
        }
        private void cmbIndexName_TextChanged(object sender, EventArgs e)
        {
            string IndexName = cmbIndexName.Text.ToString();
            string sql       = @"select 索引编号 from " + IndexName + " group by 索引编号";

            string[] getresult = new string[25];
            int      i         = 0;

            m_connectToAccess = new ConnectToAccess(deFaultpath, "CavityLibrary");
            m_connectToAccess.GetInformation(sql, "索引编号", out getresult);
            while (getresult[i] != null)
            {
                combcodenumber.Items.Add(getresult[i]);
                i++;
            }
        }
Ejemplo n.º 3
0
        public void AddInformation()
        {
            PartDocument oPartDocument;

            oPartDocument = (PartDocument)m_inventorApplication.ActiveDocument;
            PartComponentDefinition oPartCompDef;

            oPartCompDef = oPartDocument.ComponentDefinition;

            AttributeSets atr = m_selectiFeature.AttributeSets;
            int           insertPlane;
            int           insertFace;

            this.GetInsertFace(oPartCompDef, m_selectFace, out insertPlane, out insertFace);
            m_insertFace = oPartCompDef.Features.ExtrudeFeatures["拉伸1"].Faces[insertFace];
            AttributeSet abs = atr["MyAttribSet"];

            Inventor.Attribute internalname = abs["InternalName"];
            Inventor.Attribute footprint    = abs["Footprint"];
            Inventor.Attribute pointX       = abs["PointX"];
            Inventor.Attribute pointY       = abs["PointY"];
            Inventor.Attribute pointZ       = abs["PointZ"];
            TransientGeometry  oTransGeo;

            oTransGeo = m_inventorApplication.TransientGeometry;
            m_Point   = oTransGeo.CreatePoint(pointX.Value, pointY.Value, pointZ.Value);
            Inventor.Attribute indexname = abs["IndexName"];
            m_indexname = indexname.Value;
            Inventor.Attribute codename = abs["CodeName"];
            m_codename = codename.Value;
            Inventor.Attribute codenumber = abs["CodeNumber"];
            m_codenumber      = codenumber.Value;
            m_connectToaccess = new ConnectToAccess(m_filepath, m_filename, m_codename, m_indexname, m_codenumber);
            string sql = @"select 生产厂家 from Outlines where Outlines.标准='" + m_indexname + "'";

            string [] result = new string[25];
            m_connectToaccess.GetInformation(sql, "生产厂家", out result);
            int i = 0;

            while (result[i] != null)
            {
                m_insertOutlineForm.listBoxName.Items.Add(result[i]);
                i++;
            }
        }
Ejemplo n.º 4
0
        private void AddIndexName()
        {
            assembly = System.Reflection.Assembly.GetExecutingAssembly();
            FileInfo asmFile = new FileInfo(assembly.Location);

            deFaultpath = asmFile.DirectoryName + "\\CavityLibrary";
            string sql = @"select * from ComponentsDb";

            string[] getresult = new string[25];
            int      i         = 0;

            m_connectToAccess = new ConnectToAccess(deFaultpath, "CavityLibrary");
            m_connectToAccess.GetInformation(sql, "IndexName", out getresult);

            while (getresult[i] != null)
            {
                m_cavityLibraryAddForm.cmbIndexName.Items.Add(getresult[i]);
                i++;
            }
        }
Ejemplo n.º 5
0
        public void AddInformation()
        {
            m_boltHoleForm.radioFour.Checked    = true;
            m_boltHoleForm.btnsure.Enabled      = false;
            m_boltHoleForm.checkBoxFace.Checked = true;
            string[] getresult = new string[25];

            string indexname = m_boltHoleForm.comBLibrary.Text;
            string sql       = @"select * from " + indexname;

            m_connectToAccess = new ConnectToAccess(deFaultpath, "CavityLibrary");
            m_connectToAccess.GetInformation(sql, "编码", out getresult);
            int i = 0;

            while (getresult[i] != null)
            {
                m_boltHoleForm.comBNumber.Items.Add(getresult[i]);
                i++;
            }
        }
Ejemplo n.º 6
0
 private void btnsure_Click(object sender, EventArgs e)
 {
     m_connectToaccess = new ConnectToAccess(m_filepath, m_filename);
     if (listBoxName.SelectedItem.ToString() != null)
     {
         string   name      = listBoxName.SelectedItem.ToString();
         string   sql       = @"select * from Outlines where Outlines.生产厂家='" + name + "'";
         string[] getresult = new string[25];
         m_connectToaccess.GetInformation(sql, "型号", out getresult);
         listBoxName.Items.Clear();
         int i = 0;
         while (getresult[i] != null)
         {
             listBoxName.Items.Add(getresult[i]);
             i++;
         }
     }
     else
     {
         MessageBox.Show("请选择元件的生产厂家");
     }
 }
Ejemplo n.º 7
0
        //-----------------------------------------------------------------------------------
        //从项目数据库加载油路信息
        private void AddNetInformationFrommdb()
        {
            Document oDoc = default(Document);

            oDoc = m_inventorApplication.ActiveDocument;

            BrowserPanes oPanes = default(BrowserPanes);

            oPanes = oDoc.BrowserPanes;
            int delete = 15;
            ClientBrowserNodeDefinition deleteoDef = oPanes.GetClientBrowserNodeDefinition(m_ClientId, delete);

            while (deleteoDef != null)
            {
                deleteoDef.Delete();
                delete++;
                deleteoDef = oPanes.GetClientBrowserNodeDefinition(m_ClientId, delete);
            }

            ClientNodeResources oRscs = oPanes.ClientNodeResources;
            ClientNodeResource  oRsc  = oRscs.ItemById(m_ClientId, 14);

            string[] getresult = new string[25];
            m_connectToaccess = new ConnectToAccess(deFaultpath + "\\CavityLibrary", "项目数据库");
            string sql    = @"select * from NETList";
            int    number = 15;

            #region
            m_connectToaccess.GetInformation(sql, "NET1", out getresult);
            int i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[1];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET2", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[2];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET3", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[3];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET4", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[4];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET5", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[5];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET6", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[6];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET7", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[7];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET8", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[8];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET9", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[9];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET10", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[10];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET11", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[11];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NET12", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[12];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }

            m_connectToaccess.GetInformation(sql, "NULLNET", out getresult);
            i = 0;
            while (getresult[i] != null)
            {
                if (getresult[i].ToString().Length > 0)
                {
                    BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc);
                    Inventor.BrowserNode  node  = oPanes["油路"].TopNode.BrowserNodes[13];
                    node.AddChild(oDef1);
                    number++;
                }
                i++;
            }
            #endregion//加载油孔网络信息
            foreach (Inventor.BrowserNode node in oPanes["油路"].TopNode.BrowserNodes)
            {
                if (node.BrowserNodes.Count == 0)
                {
                    node.Visible = false;
                }
            }
            oPanes["油路"].Update();
            oPanes["油路"].Activate();
        }