Ejemplo n.º 1
0
 //记录的点击事件
 public string RecodeClick()
 {
     Program.MainForm.axMxDrawX1.SaveDwgFile(Program.MainForm.axMxDrawX1.DwgFilePath);
     if (_TreeView.SelectedNode != null)
     {
         if (Program.MainForm.Tag != null)
         {
             string         id      = _TreeView.SelectedNode.Tag.ToString();
             Project_Manage project = _HLT.Project_Manage_Tree.Find(x => x.id == id);
             if (project.type != Project_type.记录)
             {
                 return("");
             }
             XRecord        record  = _HLT.XRecords.Find(x => x.id == project.xrecord_id);
             Drawing_Manage drawing = _HLT.Drawing_Manage_Tree.Find(x => x.id == record.Drawing_Manage_id);
             if (drawing == null)
             {
                 return("");
             }
             dynamic Propath = Program.MainForm.Tag;
             string  file    = $@"{Propath.path}\src\{drawing.name}.dwg";
             if (!File.Exists(file))
             {
                 return("");
             }
             return(file);
         }
     }
     return("");
 }
Ejemplo n.º 2
0
        //保存梁识别数据
        public void SaveBeamData(string id, Beam_XRrecord beam)
        {
            Project_Manage project = _HLT.Project_Manage_Tree.Find(x => x.id == id);
            XRecord        record  = _HLT.XRecords.Find(x => x.id == project.xrecord_id);

            record.json = beam;
        }
Ejemplo n.º 3
0
        //编辑  只有记录能编辑
        public void EditRecode()
        {
            //编辑记录
            RecodeDialog recode = new RecodeDialog();

            recode.Text = "编辑记录";
            string         id      = _TreeView.SelectedNode.Tag.ToString();
            Project_Manage project = _HLT.Project_Manage_Tree.Find(x => x.id == id);

            recode.Tag = new
            {
                name = project.name,
                oner = new List <Drawing_Manage>(_HLT.Drawing_Manage_Tree.ToArray()),
                path = "",
            };
            recode.transf += (dynamic result) =>
            {
                project.name = result.name;
                XRecord record = _HLT.XRecords.Find(x => x.id == project.xrecord_id);
                if (result.file != "")
                {
                    FileInfo file = new FileInfo(result.file);
                    string   name = file.Name.Substring(0, file.Name.LastIndexOf('.'));
                    string   ext  = file.Name.Substring(file.Name.LastIndexOf('.') + 1, file.Name.Length - file.Name.LastIndexOf('.') - 1);
                    //Drawing_Manage drawing = _HLT.Drawing_Manage_Tree.Find(x=>x.id==record.Drawing_Manage_id);
                    Drawing_Manage drawing = new Drawing_Manage
                    {
                        id   = Guid.NewGuid().ToString(),
                        pid  = _DrawView.Nodes[0].FirstNode.Tag.ToString(),
                        type = Drawing_type.文件,
                        name = name,
                        ext  = ext
                    };
                    record.Drawing_Manage_id = drawing.id;
                    _HLT.Drawing_Manage_Tree.Add(drawing);
                    _DrawView.Nodes[0].FirstNode.Nodes.Add(new TreeNode {
                        Text = name, Tag = drawing.id
                    });
                }
                if (result.combo != "")
                {
                    record.Drawing_Manage_id = result.combo;
                }
                _TreeView.SelectedNode.Text = result.name;
            };
            recode.ShowDialog();
        }
Ejemplo n.º 4
0
        //创建记录
        public void CreateRecode()
        {
            //创建记录
            RecodeDialog recode = new RecodeDialog();

            recode.Tag = new
            {
                name = "",
                oner = new List <Drawing_Manage>(_HLT.Drawing_Manage_Tree.ToArray()),
                path = "",
            };
            recode.transf += (dynamic result) =>
            {
                Project_Manage project = new Project_Manage
                {
                    id           = Guid.NewGuid().ToString(),
                    pid          = _TreeView.SelectedNode.Tag.ToString(),
                    name         = result.name,
                    type         = Project_type.记录,
                    xrecord_type = Xrecord_type.梁
                };
                XRecord record = new XRecord();
                if (result.file != "" && result.combo == "")//导入的
                {
                    FileInfo       file    = new FileInfo(result.file);
                    string         name    = file.Name.Substring(0, file.Name.LastIndexOf('.'));
                    string         ext     = file.Name.Substring(file.Name.LastIndexOf('.') + 1, file.Name.Length - file.Name.LastIndexOf('.') - 1);
                    Drawing_Manage drawing = new Drawing_Manage
                    {
                        id   = Guid.NewGuid().ToString(),
                        pid  = _DrawView.Nodes[0].FirstNode.Tag.ToString(),
                        name = name,
                        type = Drawing_type.文件,
                        ext  = ext
                    };
                    record = new XRecord
                    {
                        id = Guid.NewGuid().ToString(),
                        Drawing_Manage_id = drawing.id,
                        type = Xrecord_type.梁
                    };
                    _DrawView.Nodes[0].FirstNode.Nodes.Add(new TreeNode {
                        Text = name, Tag = drawing.id
                    });
                    _HLT.Drawing_Manage_Tree.Add(drawing);
                }
                if (result.file == "" && result.combo != "")//基于图纸的
                {
                    record = new XRecord
                    {
                        id = Guid.NewGuid().ToString(),
                        Drawing_Manage_id = result.combo,
                        type = Xrecord_type.梁
                    };
                }
                if (_HLT.XRecords == null)
                {
                    _HLT.XRecords = new List <XRecord> {
                        record
                    }
                }
                ;
                else
                {
                    _HLT.XRecords.Add(record);
                }
                project.xrecord_id = record.id;
                _HLT.Project_Manage_Tree.Add(project);
                TreeNode node = new TreeNode();
                node.Tag  = project.id;
                node.Text = project.name;
                _TreeView.SelectedNode.Nodes.Add(node);
                //Program.MainForm.axMxDrawX1.OpenDwgFile();
                _TreeView.SelectedNode = node;
                Program.MainForm.axMxDrawX1.OpenDwgFile(RecodeClick());
            };
            recode.ShowDialog();
        }