Exemplo n.º 1
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication            uiapp            = commandData.Application;
            UIDocument               uidoc            = uiapp.ActiveUIDocument;
            Document                 doc              = uidoc.Document;
            FilteredElementCollector qiaojiaCollector = EletricalQIntial.EletricalQCollector(doc);
            DataTable                dt = EletricalQIntial.CreateEletricalQExcelTitle();

            EletricalQIntial.EletricalQElementExcelPara(doc, qiaojiaCollector, dt);
            TaskDialog.Show("EXCEL放置位置", excelPath.ToString());
            LChuDemo.
            dataTableToCsv(dt, excelPath);
            System.Diagnostics.Process.Start(excelPath);
            dt           = null;
            dt           = EletricalQIntial.CreateEletricalQMySQLTitle();
            dt.TableName = "EletricalQTable";
            EletricalQIntial.EletricalQElementMySQLPara(doc, qiaojiaCollector, dt);
            string connStr = "server=localhost;database=mytest;uid=root;pwd=123456";
            var    result  = MySQLIntial.BulkInsert(connStr, dt, 9);

            if (result != 0.0)
            {
                TaskDialog.Show("导出到MYSQL中成功", "数据已经存入" + "数据库mytest" + dt.TableName + "中");
            }
            return(Result.Succeeded);
        }
Exemplo n.º 2
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication            uiapp         = commandData.Application;
            UIDocument               uidoc         = uiapp.ActiveUIDocument;
            Document                 doc           = uidoc.Document;
            FilteredElementCollector beamCollector = BeamIntial.BeamCollector(doc);
            DataTable                dt            = BeamIntial.CreateBeamExcelTitle();

            BeamIntial.
            BeamElementExcelPara(doc, beamCollector, dt);
            LChuDemo.dataTableToCsv(dt, excelPath);
            string savePath =
                LChuDemo.PickFolderInfo(excelPath);

            System.Diagnostics.Process.Start(savePath);
            dt           = BeamIntial.CreateBeamMySQLTitle();
            dt.TableName = "BeamTable";
            BeamIntial.BeamElementMySQLPara(doc, beamCollector, dt);
            string connStr = "server=localhost;database=mytest;uid=root;pwd=123456";
            var    result  = MySQLIntial.BulkInsert(connStr, dt, 6);

            if (result != 0.0)
            {
                TaskDialog.Show("导出到MYSQL中成功", "数据已经存入" + "数据库mytest" + "/n" + dt.TableName + "中");
            }
            return(Result.Succeeded);
        }