Example #1
0
        public static string CreateNewPage(ref Project refProject, ref Page refPage, EplPageProperties pageProperties)
        {
            string msg = EplDefinition.EPL_CREATE_PAGE.ToString();

            try
            {
                PagePropertyList pPropList = new PagePropertyList();
                pPropList[Properties.Page.PAGE_NAME]            = pageProperties.PageName;
                pPropList[Properties.Page.DESIGNATION_PLANT]    = pageProperties.DesignationPlant;
                pPropList[Properties.Page.DESIGNATION_LOCATION] = pageProperties.Location;
                if (refPage == null)
                {
                    refPage = new Page();
                }


                string pageNull = $"={pageProperties.DesignationPlant}+{pageProperties.Location}/{pageProperties.PageName}";

                var exsitedPage = refProject.Pages.Where(i => i.Properties.PAGE_FULLNAME == pageNull).FirstOrDefault();

                exsitedPage?.Remove();

                refPage.Create(refProject, pageProperties.DocumentType, pPropList);
                refPage.Properties.PAGE_NAME = pageProperties.PageName;
            }
            catch (Exception ex)
            {
                EplException("Create new page error.", ex);
                msg = EplError.EPL_ERROR.ToString();
            }

            return(msg);
        }
Example #2
0
        public EplPageProperties GetPageProperty(int row)
        {
            EplPageProperties EplPageProperties = new EplPageProperties();

            try
            {
                string pick = PageSheet.GetCellText($"B{row}");
                if (pick.ToLower() != "x")
                {
                    return(null);
                }

                EplPageProperties.Id               = EplPageProperties.PageNumber = PageSheet.GetCellValue <int>($"A{row}");
                EplPageProperties.PageName         = PageSheet.GetCellText($"C{row}");
                EplPageProperties.Location         = PageSheet.GetCellText($"D{row}");
                EplPageProperties.DesignationPlant = PageSheet.GetCellText($"E{row}");
                EplPageProperties.PlotFrame        = PageSheet.GetCellText($"F{row}");
                EplPageProperties.PageTitle        = PageSheet.GetCellText($"G{row}");
                EplPageProperties.PageDescription  = PageSheet.GetCellText($"H{row}");
                return(EplPageProperties);
            }
            catch (Exception ex)
            {
                Logger.WriteLine("Get project properties failed.", ex);
                return(null);
            }
        }
Example #3
0
 public void GetPageDetailDrawing(ref EplPageProperties EplPageProperties)
 {
     try
     {
         int pageIdResult = 0;
         int row          = 2;
         do
         {
             pageIdResult = GetPageDetailDrawing(ref EplPageProperties, EplPageProperties.Id, row++);
         } while (pageIdResult > 0);
     }
     catch (Exception ex)
     {
         Logger.WriteLine("Get page detail drawing failed.", ex);
     }
 }
        public static Page CreateNewPage(this Project project, ref Page page, string pageName, string title, int number, string plant, string location, string description, string[] userText = null)
        {
            EplPageProperties pageProperties = new EplPageProperties
            {
                DesignationPlant = plant,
                Location         = location,
                PageTitle        = title,
                PageNumber       = number,
                PageName         = pageName,
                PageDescription  = description,
            };

            if (userText != null)
            {
                pageProperties.UserDefinitionText = userText;
            }

            EplExtension.CreateNewPage(ref project, ref page, pageProperties);
            return(page);
        }
Example #5
0
        public int GetPageDetailDrawing(ref EplPageProperties EplPageProperties, int pageId, int row)
        {
            int PageId = 0;

            try
            {
                PageId = PageDetailSheet.GetCellValue <int>($"A{row}");
                if (pageId != PageId)
                {
                    return(PageId);
                }

                EplMacroProperties EplMacroProperties = new EplMacroProperties();
                EplMacroProperties.FileName   = PageDetailSheet.GetCellText($"B{row}");
                EplMacroProperties.Position.X = PageDetailSheet.GetCellValue <double>($"C{row}");
                EplMacroProperties.Position.Y = PageDetailSheet.GetCellValue <double>($"D{row}");
                EplMacroProperties.Tollerence = PageDetailSheet.GetCellValue <double>($"E{row}");
                EplMacroProperties.Quantity   = PageDetailSheet.GetCellValue <int>($"H{row}");

                string movekine = PageDetailSheet.GetCellText($"G{row}");
                if (movekine.ToLower().IndexOf("relative") > -1)
                {
                    EplMacroProperties.MoveKind = Eplan.EplApi.HEServices.Insert.MoveKind.Relative;
                }
                else
                {
                    EplMacroProperties.MoveKind = Eplan.EplApi.HEServices.Insert.MoveKind.Absolute;
                }

                EplPageProperties.EplMacroProperties.Add(EplMacroProperties);
            }
            catch (Exception ex)
            {
                Logger.WriteLine("Get page detail drawing failed.", ex);
            }

            return(PageId);
        }