Пример #1
0
        public ListForm(UIDocument ui_doc)
        {
            InitializeComponent();

            InitControls();
            UI_Doc = ui_doc;
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(WarnSettings), ui_doc.Document);
            var str = recorder.GetValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.WarnSettings, 1), "", 1000);

            if (!string.IsNullOrEmpty(str))
            {
                WarnSettings = JsonConvert.DeserializeObject <WarnSettings>(str);
            }

            string dataStr = "";

            recorder = PMSoftHelper.GetRecorder(nameof(ListForm), ui_doc.Document);
            recorder.ReadValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.ListForm, 1), ref dataStr, 1000);
            ListFormData data = JsonConvert.DeserializeObject <ListFormData>(dataStr);

            if (data != null)
            {
                var typeNames = Enum.GetNames(typeof(EIssueType));
                if (typeNames.Contains(data.IssueType))
                {
                    cb_IssueType.Text = data.IssueType;
                }
                if (!string.IsNullOrEmpty(data.StartTime))
                {
                    btn_IssueMonth.Text = data.StartTime;
                }
            }
        }
Пример #2
0
        public WarnSettingsForm(Document document)
        {
            InitializeComponent();

            Document = document;
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(WarnSettings), Document);
            var str = recorder.GetValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.WarnSettings, 1), "", 1000);

            if (!string.IsNullOrEmpty(str))
            {
                WarnSettings = JsonConvert.DeserializeObject <WarnSettings>(str);
                tb_BuildingSubsidence_Day.Text             = WarnSettings.BuildingSubsidence_Day.ToString();
                tb_BuildingSubsidence_DailyMillimeter.Text = WarnSettings.BuildingSubsidence_DailyMillimeter.ToString();
                tb_BuildingSubsidence_SumMillimeter.Text   = WarnSettings.BuildingSubsidence_SumMillimeter.ToString();
                tb_SurfaceSubsidence_Day.Text             = WarnSettings.SurfaceSubsidence_Day.ToString();
                tb_SurfaceSubsidence_DailyMillimeter.Text = WarnSettings.SurfaceSubsidence_DailyMillimeter.ToString();
                tb_SurfaceSubsidence_SumMillimeter.Text   = WarnSettings.SurfaceSubsidence_SumMillimeter.ToString();
                tb_STBAP_MaxAxle.Text = WarnSettings.STBAP_MaxAxle.ToString();
                tb_STBAP_MinAxle.Text = WarnSettings.STBAP_MinAxle.ToString();
                tb_StressedPipeLineSubsidence_Day.Text = WarnSettings.PressedPipeLineSubsidence_Day.ToString();
                tb_StressedPipeLineSubsidence_PipelineMillimeter.Text = WarnSettings.PressedPipeLineSubsidence_PipelineMillimeter.ToString();
                tb_StressedPipeLineSubsidence_WellMillimeter.Text     = WarnSettings.PressedPipeLineSubsidence_WellMillimeter.ToString();
                tb_StressedPipeLineSubsidence_SumMillimeter.Text      = WarnSettings.PressedPipeLineSubsidence_SumMillimeter.ToString();
                tb_UnstressedPipeLineSubsidence_Day.Text = WarnSettings.UnpressedPipeLineSubsidence_Day.ToString();
                tb_UnstressedPipeLineSubsidence_PipelineMillimeter.Text = WarnSettings.UnpressedPipeLineSubsidence_PipelineMillimeter.ToString();
                tb_UnstressedPipeLineSubsidence_WellMillimeter.Text     = WarnSettings.UnpressedPipeLineSubsidence_WellMillimeter.ToString();
                tb_UnstressedPipeLineSubsidence_SumMillimeter.Text      = WarnSettings.UnpressedPipeLineSubsidence_SumMillimeter.ToString();
                tb_SkewBack_WellMillimeter.Text     = WarnSettings.SkewBack_WellMillimeter.ToString();
                tb_SkewBack_StandardMillimeter.Text = WarnSettings.SkewBack_StandardMillimeter.ToString();
                tb_SkewBack_Speed.Text = WarnSettings.SkewBack_Speed.ToString();
                tb_SkewBack_Day.Text   = WarnSettings.SkewBack_Day.ToString();
            }
        }
Пример #3
0
        //public void UpdateBlockName(int index, string name)
        //{
        //    Blocks[index].Name = name;
        //    if (Blocks[index].ImplementationInfo.IsSettled)
        //    {
        //        Blocks[index].ImplementationInfo.Unsettle();
        //    }
        //}
        public override void Commit(EarthworkBlockingForm storage)
        {
            BlockIdIndexMapper = new Dictionary <int, int>();
            int index = 0;

            foreach (var block in Blocks)
            {
                BlockIdIndexMapper.Add(block.Id, index);
                index++;
                if (block.IsChanged)
                {
                    block.Commit(storage);
                }
            }
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(EarthworkBlockingForm), storage.m_Doc);
            var jsonObj = JsonConvert.SerializeObject(this);

            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlocking_Size, 1), jsonObj.Length.ToString());
            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlocking, 1), jsonObj);
            foreach (var block in Deletes)
            {
                //TODO ???Block的删除或需优化 Block总是新增节点,会造成数据量一致增加
                recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlock_Size, block.Id), "");
                recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlock, block.Id), "");
                recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlockCPSettings_Size, block.Id), "");
                recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlockCPSettings, block.Id), "");
            }
            Adds.Clear();
            Deletes.Clear();
        }
Пример #4
0
        public override void Commit(EarthworkBlockingForm storage)
        {
            PmSoft.Common.CommonClass.FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(EarthworkBlockingForm), storage.m_Doc);
            var jsonObj = JsonConvert.SerializeObject(this);

            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlock_Size, Id), jsonObj.Length.ToString());
            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlock, Id), jsonObj);
        }
Пример #5
0
        public override void Commit(EarthworkBlockingForm storage)
        {
            //更新视图内容
            ApplySetting(storage.Blocking, storage.Block.ElementIds);
            //保存数据
            PmSoft.Common.CommonClass.FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(EarthworkBlockingForm), storage.m_Doc);
            var jsonObj = JsonConvert.SerializeObject(this);

            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlockCPSettings_Size, storage.Block.Id), jsonObj.Length.ToString());
            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlockCPSettings, storage.Block.Id), jsonObj);
        }
Пример #6
0
        private void ListForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            //当前页面选项的备份,下次加载上次打开的
            ListFormData data = new ListFormData()
            {
                IssueType = cb_IssueType.Text,
                StartTime = btn_IssueMonth.Text,
            };
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(ListForm), UI_Doc.Document);
            var jsonObj = JsonConvert.SerializeObject(data);

            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.ListForm, 1), jsonObj);
        }
Пример #7
0
        public ListForm(UIDocument ui_doc)
        {
            InitializeComponent();

            InitControls();
            UI_Doc = ui_doc;
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(WarnSettings), ui_doc.Document);
            var str = recorder.GetValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.WarnSettings, 1), "", 1000);

            if (!string.IsNullOrEmpty(str))
            {
                WarnSettings = JsonConvert.DeserializeObject <WarnSettings>(str);
            }
        }
Пример #8
0
        private void btn_Submit_Click(object sender, EventArgs e)
        {
            //当前页面选项的备份,下次加载上次打开的
            ChartFormData data = new ChartFormData()
            {
                ReportName = tb_ReportName.Text,
                IssueType  = cb_IssueType.Text,
                NodeCode   = cb_NodeCode.Text,
                Depth      = cb_Depth.Text,
                YField     = cb_Y.Text,
                StartTime  = btn_StartDate.Text,
            };
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(WarnSettings), Doc);
            var jsonObj = JsonConvert.SerializeObject(data);

            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.ChartForm, 1), jsonObj);
            this.Close();
        }
Пример #9
0
        public ChartForm(Autodesk.Revit.DB.Document doc)
        {
            InitializeComponent();

            InitControls();

            Doc = doc;
            string dataStr = "";
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(WarnSettings), Doc);

            recorder.ReadValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.ChartForm, 1), ref dataStr, 1000);
            ChartFormData data = JsonConvert.DeserializeObject <ChartFormData>(dataStr);

            if (data != null)
            {
                tb_ReportName.Text = data.ReportName;
                var typeNames = Enum.GetNames(typeof(EIssueType));
                if (typeNames.Contains(data.IssueType))
                {
                    cb_IssueType.Text = data.IssueType;
                }
                if ((cb_NodeCode.DataSource as List <string>) != null && (cb_NodeCode.DataSource as List <string>).Contains(data.NodeCode))
                {
                    cb_NodeCode.Text = data.NodeCode;
                }
                if ((cb_Depth.DataSource as List <string>) != null && (cb_Depth.DataSource as List <string>).Contains(data.Depth))
                {
                    cb_Depth.Text = data.Depth;
                }
                if ((cb_Y.DataSource as System.Data.DataTable) != null)
                {
                    foreach (DataRow row in (cb_Y.DataSource as System.Data.DataTable).Rows)
                    {
                        if (row[nameof(TypeKeyDdscription.Description)].ToString() == data.YField)
                        {
                            cb_Y.Text = data.YField;
                            break;
                        }
                    }
                }
                btn_StartDate.Text = data.StartTime;
            }
        }
Пример #10
0
        private void btn_Submit_Click(object sender, System.EventArgs e)
        {
            //int $1;\r\nif(int.TryParse(tb_$1.Text, out $1))\r\nWarnSettings.$1 = $1;\r\nelse\r\n ShowMessage(ShowTitle, "$1" + "不是有效的数值");
            //建筑物沉降
            int BuildingSubsidence_Day;

            if (int.TryParse(tb_BuildingSubsidence_Day.Text, out BuildingSubsidence_Day))
            {
                WarnSettings.BuildingSubsidence_Day = BuildingSubsidence_Day;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_BuildingSubsidence_Day + MessageSuffix);
                return;
            }
            int BuildingSubsidence_DailyMillimeter;

            if (int.TryParse(tb_BuildingSubsidence_DailyMillimeter.Text, out BuildingSubsidence_DailyMillimeter))
            {
                WarnSettings.BuildingSubsidence_DailyMillimeter = BuildingSubsidence_DailyMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_BuildingSubsidence_DailyMillimeter + MessageSuffix);
                return;
            }
            int BuildingSubsidence_SumMillimeter;

            if (int.TryParse(tb_BuildingSubsidence_SumMillimeter.Text, out BuildingSubsidence_SumMillimeter))
            {
                WarnSettings.BuildingSubsidence_SumMillimeter = BuildingSubsidence_SumMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_BuildingSubsidence_SumMillimeter + MessageSuffix);
                return;
            }
            //地表沉降
            int SurfaceSubsidence_Day;

            if (int.TryParse(tb_SurfaceSubsidence_Day.Text, out SurfaceSubsidence_Day))
            {
                WarnSettings.SurfaceSubsidence_Day = SurfaceSubsidence_Day;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_SurfaceSubsidence_Day + MessageSuffix);
                return;
            }
            int SurfaceSubsidence_DailyMillimeter;

            if (int.TryParse(tb_SurfaceSubsidence_DailyMillimeter.Text, out SurfaceSubsidence_DailyMillimeter))
            {
                WarnSettings.SurfaceSubsidence_DailyMillimeter = SurfaceSubsidence_DailyMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_SurfaceSubsidence_DailyMillimeter + MessageSuffix);
                return;
            }
            int SurfaceSubsidence_SumMillimeter;

            if (int.TryParse(tb_SurfaceSubsidence_SumMillimeter.Text, out SurfaceSubsidence_SumMillimeter))
            {
                WarnSettings.SurfaceSubsidence_SumMillimeter = SurfaceSubsidence_SumMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_SurfaceSubsidence_SumMillimeter + MessageSuffix);
                return;
            }
            //钢支撑轴力
            int STBAP_MaxAxle;

            if (int.TryParse(tb_STBAP_MaxAxle.Text, out STBAP_MaxAxle))
            {
                WarnSettings.STBAP_MaxAxle = STBAP_MaxAxle;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_STBAP_MaxAxle + MessageSuffix);
                return;
            }
            int STBAP_MinAxle;

            if (int.TryParse(tb_STBAP_MinAxle.Text, out STBAP_MinAxle))
            {
                WarnSettings.STBAP_MinAxle = STBAP_MinAxle;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_STBAP_MinAxle + MessageSuffix);
                return;
            }
            //管线沉降(有压)
            int StressedPipeLineSubsidence_Day;

            if (int.TryParse(tb_StressedPipeLineSubsidence_Day.Text, out StressedPipeLineSubsidence_Day))
            {
                WarnSettings.PressedPipeLineSubsidence_Day = StressedPipeLineSubsidence_Day;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_PressedPipeLineSubsidence_Day + MessageSuffix);
                return;
            }
            int StressedPipeLineSubsidence_PipelineMillimeter;

            if (int.TryParse(tb_StressedPipeLineSubsidence_PipelineMillimeter.Text, out StressedPipeLineSubsidence_PipelineMillimeter))
            {
                WarnSettings.PressedPipeLineSubsidence_PipelineMillimeter = StressedPipeLineSubsidence_PipelineMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_PressedPipeLineSubsidence_PipelineMillimeter + MessageSuffix);
                return;
            }
            int StressedPipeLineSubsidence_WellMillimeter;

            if (int.TryParse(tb_StressedPipeLineSubsidence_WellMillimeter.Text, out StressedPipeLineSubsidence_WellMillimeter))
            {
                WarnSettings.PressedPipeLineSubsidence_WellMillimeter = StressedPipeLineSubsidence_WellMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_PressedPipeLineSubsidence_WellMillimeter + MessageSuffix);
                return;
            }
            int StressedPipeLineSubsidence_SumMillimeter;

            if (int.TryParse(tb_StressedPipeLineSubsidence_SumMillimeter.Text, out StressedPipeLineSubsidence_SumMillimeter))
            {
                WarnSettings.PressedPipeLineSubsidence_SumMillimeter = StressedPipeLineSubsidence_SumMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_PressedPPipeLineSubsidence_SumMillimeter + MessageSuffix);
                return;
            }
            //管线沉降(无压)
            int UnstressedPipeLineSubsidence_Day;

            if (int.TryParse(tb_UnstressedPipeLineSubsidence_Day.Text, out UnstressedPipeLineSubsidence_Day))
            {
                WarnSettings.UnpressedPipeLineSubsidence_Day = UnstressedPipeLineSubsidence_Day;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_UnpressedPipeLineSubsidence_Day + MessageSuffix);
                return;
            }
            int UnstressedPipeLineSubsidence_PipelineMillimeter;

            if (int.TryParse(tb_UnstressedPipeLineSubsidence_PipelineMillimeter.Text, out UnstressedPipeLineSubsidence_PipelineMillimeter))
            {
                WarnSettings.UnpressedPipeLineSubsidence_PipelineMillimeter = UnstressedPipeLineSubsidence_PipelineMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_UnpressedPipeLineSubsidence_PipelineMillimeter + MessageSuffix);
                return;
            }
            int UnstressedPipeLineSubsidence_WellMillimeter;

            if (int.TryParse(tb_UnstressedPipeLineSubsidence_WellMillimeter.Text, out UnstressedPipeLineSubsidence_WellMillimeter))
            {
                WarnSettings.UnpressedPipeLineSubsidence_WellMillimeter = UnstressedPipeLineSubsidence_WellMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_UnpressedPipeLineSubsidence_WellMillimeter + MessageSuffix);
                return;
            }
            int UnstressedPipeLineSubsidence_SumMillimeter;

            if (int.TryParse(tb_UnstressedPipeLineSubsidence_SumMillimeter.Text, out UnstressedPipeLineSubsidence_SumMillimeter))
            {
                WarnSettings.UnpressedPipeLineSubsidence_SumMillimeter = UnstressedPipeLineSubsidence_SumMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_UnpressedPipeLineSubsidence_SumMillimeter + MessageSuffix);
                return;
            }
            //墙体水平位移(侧斜)
            int SkewBack_WellMillimeter;

            if (int.TryParse(tb_SkewBack_WellMillimeter.Text, out SkewBack_WellMillimeter))
            {
                WarnSettings.SkewBack_WellMillimeter = SkewBack_WellMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_SkewBack_WellMillimeter + MessageSuffix);
                return;
            }
            int SkewBack_StandardMillimeter;

            if (int.TryParse(tb_SkewBack_StandardMillimeter.Text, out SkewBack_StandardMillimeter))
            {
                WarnSettings.SkewBack_StandardMillimeter = SkewBack_StandardMillimeter;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_SkewBack_StandardMillimeter + MessageSuffix);
                return;
            }
            int SkewBack_Speed;

            if (int.TryParse(tb_SkewBack_Speed.Text, out SkewBack_Speed))
            {
                WarnSettings.SkewBack_Speed = SkewBack_Speed;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_SkewBack_Speed + MessageSuffix);
                return;
            }
            int SkewBack_Day;

            if (int.TryParse(tb_SkewBack_Day.Text, out SkewBack_Day))
            {
                WarnSettings.SkewBack_Day = SkewBack_Day;
            }
            else
            {
                ShowMessage(ShowTitle, WarnSettings.Tag_SkewBack_Day + MessageSuffix);
                return;
            }
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(WarnSettings), Document);
            var jsonObj = JsonConvert.SerializeObject(WarnSettings);

            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForSubsidenceMonitor.WarnSettings, 1), jsonObj);
            this.Close();
        }
Пример #11
0
        public void InitByDocument(Document doc)
        {
            Doc = doc;
            string viewName = "土方分块";

            View3D = Revit_Document_Helper.GetElementByNameAs <View3D>(doc, viewName);
            if (View3D == null)
            {
                using (var transaction = new Transaction(doc, "EarthworkBlocking." + nameof(InitByDocument)))
                {
                    transaction.Start();
                    try
                    {
                        var viewFamilyType = new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType)).ToElements()
                                             .First(c => c.Name == "三维视图");
                        View3D      = View3D.CreateIsometric(doc, viewFamilyType.Id);
                        View3D.Name = viewName;
                        transaction.Commit();
                        TaskDialog.Show("消息", "三维视图(土方分块)新建成功");
                    }
                    catch (Exception ex)
                    {
                        transaction.RollBack();
                        TaskDialog.Show("消息", "视图(土方分块)新建失败,错误详情:" + ex.ToString());
                    }
                }
            }
            //加载 EarthworkBlock
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(EarthworkBlockingForm), doc);
            var orderedBlockIdIndexs      = BlockIdIndexMapper.OrderBy(c => c.Value);

            foreach (var orderedBlockIdIndex in orderedBlockIdIndexs)
            {
                string blockStr = "";
                recorder.ReadValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlock, orderedBlockIdIndex.Key), ref blockStr, recorder.GetValueAsInt(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlock_Size, orderedBlockIdIndex.Key), 1000) + 2);
                var block = JsonConvert.DeserializeObject <EarthworkBlock>(blockStr);
                if (block == null)
                {
                    return;
                }
                string cpSettingsStr = "";
                recorder.ReadValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlockCPSettings, orderedBlockIdIndex.Key), ref cpSettingsStr, recorder.GetValueAsInt(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlockCPSettings_Size, orderedBlockIdIndex.Key), 1000) + 2);
                var cpSettings = JsonConvert.DeserializeObject <EarthworkBlockCPSettings>(cpSettingsStr);
                if (cpSettings != null)
                {
                    block.CPSettings = cpSettings;
                }
                //foreach (KeyValuePair<int,int> elementIdValue in block.ElementIdValues)
                //{
                //    var element = doc.GetElement(new ElementId(elementIdValue.Key));
                //    if (element!=null)
                //    {
                //        block.ElementIds.Add(element.Id);
                //    }
                //    else
                //    {
                //        block.info
                //    }
                //}
                var elements = block.ElementIdValues.Select(c => doc.GetElement(new ElementId(c)));
                foreach (var element in elements)
                {
                    if (element != null)
                    {
                        block.ElementIds.Add(element.Id);
                    }
                }
                //var implementationStr = "";
                //recorder.ReadValue(SaveKeyHelper.GetSaveKeyOfEarthworkBlockImplementationInfo(orderedBlockIdIndex.Key), ref implementationStr, int.MaxValue);
                //var implementationInfo = JsonConvert.DeserializeObject<EarthworkBlockImplementationInfo>(implementationStr);
                //if (implementationInfo != null)
                //{
                //    implementationInfo.Name = block.Name;
                //    block.ImplementationInfo = implementationInfo;
                //}
                Blocks.Add(block);
            }
        }
Пример #12
0
        private void InitForm()
        {
            //初始化参数
            ShowDialogType = ShowDialogType.Idle;
            //dgv_Blocks
            dgv_Blocks.AutoGenerateColumns = false;
            Node_Name.DataPropertyName     = nameof(EarthworkBlock.Name);
            Node_Name.Tag        = nameof(EarthworkBlock.Name);
            Node_Description.Tag = nameof(EarthworkBlock.Description);
            Node_Description.DataPropertyName = nameof(EarthworkBlock.Description);
            PmSoft.Common.CommonClass.FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(EarthworkBlockingForm), m_Doc);
            var blockingStr = "";

            recorder.ReadValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlocking, 1), ref blockingStr, recorder.GetValueAsInt(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlocking_Size, 1), 1000) + 2);
            if (blockingStr != "")
            {
                Blocking = Newtonsoft.Json.JsonConvert.DeserializeObject <EarthworkBlocking>(blockingStr);
            }
            else
            {
                Blocking = new EarthworkBlocking();
            }
            Blocking.InitByDocument(m_Doc);
            Blocking.Start();
            if (Blocking.Count() > 0)
            {
                dgv_Blocks.DataSource = Blocking.Blocks;
            }
            else
            {
                dgv_Blocks.DataSource = null;
            }
            //dgv_ConstructionInfo
            dgv_ImplementationInfo.AutoGenerateColumns     = false;
            ConstructionNode_Name.DataPropertyName         = nameof(EarthworkBlockImplementationInfo.Name);
            ConstructionNode_Name.ReadOnly                 = true;
            ConstructionNode_StartTime.DataPropertyName    = nameof(EarthworkBlockImplementationInfo.StartTimeStr);
            ConstructionNode_StartTime.Tag                 = nameof(DateTime);
            ConstructionNode_ExposureTime.DataPropertyName = nameof(EarthworkBlockImplementationInfo.ExposureTime);
            ConstructionNode_EndTime.DataPropertyName      = nameof(EarthworkBlockImplementationInfo.EndTimeStr);
            ConstructionNode_EndTime.Tag = nameof(DateTime);
            //初始化按钮
            ToolTip tip = new ToolTip();

            tip.SetToolTip(btn_AddNode, "新增节点");
            tip.SetToolTip(btn_DeleteNode, "删除选中节点");
            tip.SetToolTip(btn_UpNode, "上移节点");
            tip.SetToolTip(btn_DownNode, "下移节点");
            tip.SetToolTip(btn_AddElement, "新增构件");
            tip.SetToolTip(btn_DeleteElement, "删除构件");
            tip.SetToolTip(btn_ViewGt6, "查看(无支撑暴露时间)>6被标红的视图");
            tip.SetToolTip(btn_Preview, "查看按完工和未完工标注颜色的视图");
            //DatePicker
            DatePicker              = new DateTimePicker();
            DatePicker.Parent       = this;
            DatePicker.Width        = 100;
            DatePicker.Format       = DateTimePickerFormat.Custom;
            DatePicker.CustomFormat = "yyyy/MM/dd";
            DatePicker.ShowCheckBox = true;
            DatePicker.Hide();
            DatePicker.LostFocus   += DatePicker_LostFocus;
            DatePicker.TextChanged += DatePicker_TextChanged;
            //DateTimePicker
            DateTimePicker    = new DateTimePicker();
            DatePicker.Parent = this;
            DateTimePicker.Hide();
            DateTimePicker.Format       = DateTimePickerFormat.Custom;
            DateTimePicker.CustomFormat = "yyyy/MM/dd HH:mm";
            DateTimePicker.LostFocus   += DateTimePicker_LostFocus;
            dgv_ImplementationInfo.Controls.Add(DateTimePicker);
            this.FormClosing += EarthworkBlockingForm_FormClosing;
            //Color Buttons
            RenderColorButton(btn_Completed, Blocking.ColorForSettled);
            RenderColorButton(btn_Uncompleted, Blocking.ColorForUnsettled);
        }