예제 #1
0
        public void dump_csv()
        {
            _Db.HostApplicationServices hs = _Db.HostApplicationServices.Current;
            string dwg_path = hs.FindFile(_c.doc.Name, _c.doc.Database, _Db.FindFileHint.Default);
            string dwg_dir  = Path.GetDirectoryName(dwg_path);
            string dwg_name = Path.GetFileNameWithoutExtension(dwg_path);

            if (!dwg_dir.EndsWith(@"\"))
            {
                dwg_dir = dwg_dir + @"\";
            }
            string csv_dir  = dwg_dir + @"temp_excel\";
            string csv_path = csv_dir + dwg_name + ".csv";

            if (local_stats == null || local_stats.Count == 0)
            {
                return;
            }

            if (!Directory.Exists(Path.GetDirectoryName(csv_path)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(csv_path));
            }
            if (File.Exists(csv_path))
            {
                File.Delete(csv_path);
            }

            StringBuilder txt = new StringBuilder();

            write(csv_path);
            txt.AppendLine("alexi programmi ajutine file");
            txt.AppendLine("");
            txt.AppendLine("RITN_NR_23; DATUM_23; REV_23; REV_DATE_23; ELEMENT; LENGTH; HEIGHT; WIDTH; ; RITN_NR_27; DATUM_27; REV_27; REV_DATE_27; ELEMENT; ; SUMMA_NATARMERING; SUMMA_OVRIG_ARMERING");
            txt.AppendLine("");
            txt.AppendLine("SUMMARY");
            foreach (element e in local_stats)
            {
                txt.AppendLine(e.ToString());
            }

            txt.AppendLine("!---SUMMARY");

            string csvText = txt.ToString();

            File.AppendAllText(csv_path, csvText);

            if (_open)
            {
                try
                {
                    Process.Start(csv_path);
                }
                catch
                {
                }
            }
        }
예제 #2
0
        private string createFileName()
        {
            _Db.HostApplicationServices hs = _Db.HostApplicationServices.Current;
            string dwg_path = hs.FindFile(_c.doc.Name, _c.doc.Database, _Db.FindFileHint.Default);
            string dwg_dir  = Path.GetDirectoryName(dwg_path);
            string dwg_name = Path.GetFileNameWithoutExtension(dwg_path);

            if (!dwg_dir.EndsWith(@"\"))
            {
                dwg_dir = dwg_dir + @"\";
            }
            string csv_dir  = dwg_dir + output_dir;
            string csv_path = csv_dir + dwg_name + ".csv";

            return(csv_path);
        }
예제 #3
0
        public XML_Filter_command(ref _CONNECTION c)
        {
            _c = c;

            _Db.HostApplicationServices hs = _Db.HostApplicationServices.Current;
            string dwg_path = hs.FindFile(_c.doc.Name, _c.doc.Database, _Db.FindFileHint.Default);

            dwg_dir = Path.GetDirectoryName(dwg_path);
            if (!dwg_dir.EndsWith(@"\"))
            {
                dwg_dir = dwg_dir + @"\";
            }

            xml_full      = dwg_dir + name + ".xml";
            xml_lock_full = dwg_dir + name + ".LCK";
        }
예제 #4
0
        public WEIGHT_command_v2(ref _CONNECTION c)
        {
            _c = c;

            local_stats = new Dictionary <_Area_v2, int>();

            _Db.HostApplicationServices hs = _Db.HostApplicationServices.Current;
            string dwg_path = hs.FindFile(_c.doc.Name, _c.doc.Database, _Db.FindFileHint.Default);

            dwg_dir = Path.GetDirectoryName(dwg_path);
            if (!dwg_dir.EndsWith(@"\"))
            {
                dwg_dir = dwg_dir + @"\";
            }

            xml_full      = dwg_dir + name + ".xml";
            xml_lock_full = dwg_dir + name + ".LCK";
        }
예제 #5
0
        private void dump()
        {
            _Db.HostApplicationServices hs = _Db.HostApplicationServices.Current;
            string dwg_path = hs.FindFile(_c.doc.Name, _c.doc.Database, _Db.FindFileHint.Default);
            string dwg_dir  = Path.GetDirectoryName(dwg_path);
            string dwg_name = Path.GetFileNameWithoutExtension(dwg_path);

            if (!dwg_dir.EndsWith(@"\"))
            {
                dwg_dir = dwg_dir + @"\";
            }
            string csv_dir  = dwg_dir + @"temp_armering\";
            string csv_path = csv_dir + dwg_name + ".csv";

            if (total_stats == null || total_stats.Count == 0)
            {
                return;
            }

            if (!Directory.Exists(Path.GetDirectoryName(csv_path)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(csv_path));
            }
            if (File.Exists(csv_path))
            {
                File.Delete(csv_path);
            }

            StringBuilder txt = new StringBuilder();

            write(csv_path);
            txt.AppendLine("alexi programmi ajutine file");
            txt.AppendLine("shape; positsioon; kogus; diameter");
            txt.AppendLine("");
            txt.AppendLine("SUMMARY");
            txt.AppendLine("");

            foreach (_Mark u in total_stats)
            {
                if (u.Number == 0 && u.Diameter == 0)
                {
                    continue;
                }
                txt.AppendLine(u.Position_Shape.ToString() + ";" + u.Position_Nr.ToString() + ";" + u.Number.ToString() + ";" + u.Diameter.ToString());
            }

            txt.AppendLine("");
            txt.AppendLine("!---SUMMARY");

            int i = 1;

            foreach (_Area_v1 a in local_stats.Keys)
            {
                txt.AppendLine("");
                txt.AppendLine("");
                txt.AppendLine("drawing nr: " + i.ToString());
                txt.AppendLine("");
                List <_Mark> stats = local_stats[a];

                if (stats.Count == 0)
                {
                    txt.AppendLine("empty");
                }
                else
                {
                    foreach (_Mark u in stats)
                    {
                        if (u.Number == 0 && u.Diameter == 0)
                        {
                            continue;
                        }
                        txt.AppendLine(u.Position_Shape.ToString() + ";" + u.Position_Nr.ToString() + ";" + u.Number.ToString() + ";" + u.Diameter.ToString());
                    }
                }
                i++;
            }

            string csvText = txt.ToString();

            File.AppendAllText(csv_path, csvText);
        }
예제 #6
0
        private void dump()
        {
            _Db.HostApplicationServices hs = _Db.HostApplicationServices.Current;
            string dwg_path = hs.FindFile(_c.doc.Name, _c.doc.Database, _Db.FindFileHint.Default);
            string dwg_dir  = Path.GetDirectoryName(dwg_path);
            string dwg_name = Path.GetFileNameWithoutExtension(dwg_path);

            if (!dwg_dir.EndsWith(@"\"))
            {
                dwg_dir = dwg_dir + @"\";
            }
            string csv_dir  = dwg_dir + @"temp_armering\";
            string csv_path = csv_dir + dwg_name + ".csv";

            if (total_stats == null || total_stats.Count == 0)
            {
                return;
            }

            if (!Directory.Exists(Path.GetDirectoryName(csv_path)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(csv_path));
            }
            if (File.Exists(csv_path))
            {
                File.Delete(csv_path);
            }

            StringBuilder txt = new StringBuilder();

            write(csv_path);
            txt.AppendLine("alexi programmi ajutine file");
            txt.AppendLine("shape; positsioon; kogus; diameter");
            txt.AppendLine("");
            txt.AppendLine("SUMMARY");

            foreach (_Mark u in total_stats)
            {
                if (u.Number == 0 && u.Diameter == 0)
                {
                    continue;
                }
                txt.AppendLine(u.Position_Shape.ToString() + ";" + u.Position_Nr.ToString() + ";" + u.Number.ToString() + ";" + u.Diameter.ToString());
            }

            txt.AppendLine("!---SUMMARY");

            // LOCAL

            foreach (_Area_v2 a in local_stats.Keys)
            {
                string ritn_nr = "x";

                _Db.DBObject currentEntity = _c.trans.GetObject(a.ID, _Db.OpenMode.ForWrite, false) as _Db.DBObject;

                if (currentEntity is _Db.BlockReference)
                {
                    _Db.BlockReference blockRef = currentEntity as _Db.BlockReference;

                    foreach (_Db.ObjectId arId in blockRef.AttributeCollection)
                    {
                        _Db.DBObject           obj = _c.trans.GetObject(arId, _Db.OpenMode.ForWrite);
                        _Db.AttributeReference ar  = obj as _Db.AttributeReference;
                        if (ar != null)
                        {
                            if (ar.Tag == "RITN_NR")
                            {
                                ritn_nr = ar.TextString;
                            }

                            if (blockRef.Name == "KN-V23")
                            {
                                if (ar.Tag == "RITN_23_NR")
                                {
                                    ritn_nr = ar.TextString;
                                }
                            }
                            else if (blockRef.Name == "KN-V27")
                            {
                                if (ar.Tag == "RITN_27_NR")
                                {
                                    ritn_nr = ar.TextString;
                                }
                            }
                        }
                    }
                }


                txt.AppendLine("");
                txt.AppendLine("[" + ritn_nr + "]");
                List <_Mark> stats = local_stats[a];

                if (stats.Count == 0)
                {
                    txt.AppendLine("empty");
                }
                else
                {
                    foreach (_Mark u in stats)
                    {
                        if (u.Number == 0 && u.Diameter == 0)
                        {
                            continue;
                        }
                        txt.AppendLine(u.Position_Shape.ToString() + ";" + u.Position_Nr.ToString() + ";" + u.Number.ToString() + ";" + u.Diameter.ToString());
                    }
                }
            }

            string csvText = txt.ToString();

            File.AppendAllText(csv_path, csvText);
        }