/// <summary> /// Copies a PagePropertyList and insert the locations /// </summary> /// <param name="pagePropertyListSource">PagePropertyList to copy</param> /// <returns>Duplicate of PagePropertyList</returns> public PagePropertyList CopyPagePropertyList(PagePropertyList pagePropertyListSource) { PagePropertyList pagePropertylistCopy = pagePropertyListSource; GetPagePropertyList(pagePropertylistCopy); return(pagePropertylistCopy); }
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); }
public IEnumerable <Page> FilterPage(Project targetProject, string functionalAssignment, string plant, string location, string docType) { try { DMObjectsFinder pageFinder = new DMObjectsFinder(targetProject); PagesFilter pageFilter = new PagesFilter(); PagePropertyList pageProperties = new PagePropertyList(); pageProperties.DESIGNATION_FUNCTIONALASSIGNMENT = functionalAssignment; pageProperties.DESIGNATION_PLANT = plant; pageProperties.DESIGNATION_LOCATION = location; pageProperties.DESIGNATION_DOCTYPE = docType; pageFilter.SetFilteredPropertyList(pageProperties); Page[] filteredPages = pageFinder.GetPages(pageFilter); int totalPageCount = filteredPages.Length; MessageBox.Show("페이지 필터가 성공적으로 실행되었습니다.", "페이지 필터 성공", MessageBoxButtons.OK, MessageBoxIcon.Information); for (int pageIndex = 0; pageIndex < totalPageCount; pageIndex++) { MessageBox.Show(string.Format("페이지[{0}] = [{1}]", pageIndex, filteredPages[pageIndex].Name), "페이지 필터 성공", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(filteredPages); } catch (Exception ex) { MessageBox.Show(ex.Message, "페이지 필터 에러", MessageBoxButtons.OK, MessageBoxIcon.Error); throw ex; } }
public Page CreatePage(Project targetProject, string functionalAssignment, string plant, string location, string docType, string pageDescription) { try { PagePropertyList oPagePropList = new PagePropertyList(); oPagePropList.DESIGNATION_FUNCTIONALASSIGNMENT = functionalAssignment; oPagePropList.DESIGNATION_PLANT = plant; oPagePropList.DESIGNATION_LOCATION = location; oPagePropList.DESIGNATION_DOCTYPE = docType; oPagePropList.PAGE_NOMINATIOMN = pageDescription.GetMultiLangString(); Page newPage = new Page(); newPage.Create(targetProject, DocumentTypeManager.DocumentType.Circuit, oPagePropList); newPage.Properties.PAGE_NOMINATIOMN = pageDescription.GetMultiLangString(); MessageBox.Show(string.Format("페이지 [{0}]이(가) 성공적으로 생성되었습니다.", newPage.Name), "페이지 생성 성공", MessageBoxButtons.OK, MessageBoxIcon.Information); return(newPage); } catch (Exception ex) { MessageBox.Show(ex.Message, "페이지 생성 에러", MessageBoxButtons.OK, MessageBoxIcon.Error); throw ex; } }
private Page[] SerachPage(Project targetProject, PagePropertyList properties, bool exactNameMatching = false) { #region Parameter Validation if (targetProject == null) { throw new ArgumentNullException(nameof(targetProject)); } if (properties == null) { throw new ArgumentNullException(nameof(properties)); } #endregion using (DMObjectsFinder finder = new DMObjectsFinder(targetProject)) using (PagesFilter filter = new PagesFilter()) { filter.ExactNameMatching = exactNameMatching; filter.SetFilteredPropertyList(properties); return(finder.GetPages(filter)); } }
public Page CopyPage(Page sourcePage, Project targetProject, string functionalAssignment, string plant, string location, string docType, string pageDescription) { try { PagePropertyList copyPageProperties = new PagePropertyList(); sourcePage.Properties.CopyTo(copyPageProperties); copyPageProperties.DESIGNATION_FUNCTIONALASSIGNMENT = functionalAssignment; copyPageProperties.DESIGNATION_PLANT = plant; copyPageProperties.DESIGNATION_LOCATION = location; copyPageProperties.DESIGNATION_DOCTYPE = docType; Page copiedPage = sourcePage.CopyTo(targetProject, copyPageProperties, PageMacro.Enums.NumerationMode.Ignore, true); copiedPage.Properties.PAGE_NOMINATIOMN = pageDescription.GetMultiLangString(); MessageBox.Show(string.Format("페이지 [{0}]이(가) 성공적으로 복사되었습니다.", copiedPage.Name), "페이지 복사 성공", MessageBoxButtons.OK, MessageBoxIcon.Information); return(copiedPage); } catch (Exception ex) { MessageBox.Show(ex.Message, "페이지 복사 에러", MessageBoxButtons.OK, MessageBoxIcon.Error); throw ex; } }
private static void GetDocumentType(PagePropertyList pagePropertylist, string location) { if (!string.IsNullOrEmpty(location)) { // There is no sub doctype pagePropertylist.DESIGNATION_DOCTYPE = location; } }
private static void GetInstallationNumber(PagePropertyList pagePropertylist, string location) { if (!string.IsNullOrEmpty(location)) { // There is no sub installation number pagePropertylist.DESIGNATION_INSTALLATIONNUMBER = location; } }
private Page CreatePage(Project targetProject, PagePropertyList namePartproperties, string pageDescription, DocumentType documentType = DocumentType.Circuit) { Page newPage = new Page(); newPage.Create(targetProject, documentType, namePartproperties); newPage.Properties.PAGE_NOMINATIOMN = pageDescription; return(newPage); }
private static void GetFunctionalAssignment(PagePropertyList pagePropertylist, string location) { if (!string.IsNullOrEmpty(location)) { var split = location.Split('.'); for (int index = 0; index < split.Length; index++) { var s = split[index]; switch (index) { case 0: pagePropertylist.DESIGNATION_FUNCTIONALASSIGNMENT = s; break; case 1: pagePropertylist.DESIGNATION_SUBFUNCTIONALASSIGNMENT1 = s; break; case 2: pagePropertylist.DESIGNATION_SUBFUNCTIONALASSIGNMENT2 = s; break; case 3: pagePropertylist.DESIGNATION_SUBFUNCTIONALASSIGNMENT3 = s; break; case 4: pagePropertylist.DESIGNATION_SUBFUNCTIONALASSIGNMENT4 = s; break; case 5: pagePropertylist.DESIGNATION_SUBFUNCTIONALASSIGNMENT5 = s; break; case 6: pagePropertylist.DESIGNATION_SUBFUNCTIONALASSIGNMENT6 = s; break; case 7: pagePropertylist.DESIGNATION_SUBFUNCTIONALASSIGNMENT7 = s; break; case 8: pagePropertylist.DESIGNATION_SUBFUNCTIONALASSIGNMENT8 = s; break; case 9: pagePropertylist.DESIGNATION_SUBFUNCTIONALASSIGNMENT9 = s; break; default: throw new Exception("Only 9 sub locations allowed: + " + location); } } } }
private static void GetLocation(PagePropertyList pagePropertylist, string location) { if (!string.IsNullOrEmpty(location)) { var split = location.Split('.'); for (int index = 0; index < split.Length; index++) { var s = split[index]; switch (index) { case 0: pagePropertylist.DESIGNATION_LOCATION = s; break; case 1: pagePropertylist.DESIGNATION_SUBLOCATION1 = s; break; case 2: pagePropertylist.DESIGNATION_SUBLOCATION2 = s; break; case 3: pagePropertylist.DESIGNATION_SUBLOCATION3 = s; break; case 4: pagePropertylist.DESIGNATION_SUBLOCATION4 = s; break; case 5: pagePropertylist.DESIGNATION_SUBLOCATION5 = s; break; case 6: pagePropertylist.DESIGNATION_SUBLOCATION6 = s; break; case 7: pagePropertylist.DESIGNATION_SUBLOCATION7 = s; break; case 8: pagePropertylist.DESIGNATION_SUBLOCATION8 = s; break; case 9: pagePropertylist.DESIGNATION_SUBLOCATION9 = s; break; default: throw new Exception("Only 9 sub locations allowed: + " + location); } } } }
private static void GetUserDefinied(PagePropertyList pagePropertylist, string location) { if (!string.IsNullOrEmpty(location)) { var split = location.Split('.'); for (int index = 0; index < split.Length; index++) { var s = split[index]; switch (index) { case 0: pagePropertylist.DESIGNATION_USERDEFINED = s; break; case 1: pagePropertylist.DESIGNATION_USERDEFINED_SUB1 = s; break; case 2: pagePropertylist.DESIGNATION_USERDEFINED_SUB2 = s; break; case 3: pagePropertylist.DESIGNATION_USERDEFINED_SUB3 = s; break; case 4: pagePropertylist.DESIGNATION_USERDEFINED_SUB4 = s; break; case 5: pagePropertylist.DESIGNATION_USERDEFINED_SUB5 = s; break; case 6: pagePropertylist.DESIGNATION_USERDEFINED_SUB6 = s; break; case 7: pagePropertylist.DESIGNATION_USERDEFINED_SUB7 = s; break; case 8: pagePropertylist.DESIGNATION_USERDEFINED_SUB8 = s; break; case 9: pagePropertylist.DESIGNATION_USERDEFINED_SUB9 = s; break; default: throw new Exception("Only 9 sub locations allowed: + " + location); } } } }
private PagePropertyList GetPagePropertyList(PagePropertyList pagePropertylistCopy) { GetFunctionalAssignment(pagePropertylistCopy, this.FunctionAssignment); GetPlant(pagePropertylistCopy, this.Plant); GetPlaceOfInstallation(pagePropertylistCopy, this.PlaceOfInstallation); GetLocation(pagePropertylistCopy, this.Location); GetUserDefinied(pagePropertylistCopy, this.UserDefinied); GetDocumentType(pagePropertylistCopy, this.DocType); GetInstallationNumber(pagePropertylistCopy, this.InstallationNumber); return(pagePropertylistCopy); }
/// <summary> /// All designations except DocType, because not available for installation space in 2.8 /// </summary> /// <param name="pagePropertyListCopy"></param> /// <returns></returns> public FunctionBasePropertyList GetFunctionBasePropertyListFromPagePropertyList( PagePropertyList pagePropertyListCopy) { var functionBasPropertyList = new FunctionBasePropertyList(); GetFunctionalAssignment(functionBasPropertyList, pagePropertyListCopy); GetPlant(functionBasPropertyList, pagePropertyListCopy); GetPlaceOfInstallation(functionBasPropertyList, pagePropertyListCopy); GetLocation(functionBasPropertyList, pagePropertyListCopy); GetInstallationNumber(functionBasPropertyList, pagePropertyListCopy); GetUserDefinied(functionBasPropertyList, pagePropertyListCopy); return(functionBasPropertyList); }
private static Page CreatePage(Project project) { PagePropertyList pagePropertyList = new PagePropertyList(); pagePropertyList.DESIGNATION_PLANT = "MYFUNCTION"; pagePropertyList.DESIGNATION_LOCATION = "MYLOCATION"; Page page = new Page(project, DocumentTypeManager.DocumentType.Circuit, pagePropertyList); page.Properties.PAGE_NOMINATIOMN = "My description"; return(page); // todo: Locking // todo: Check if exists }
/// <summary> /// Generates a project with the given GenerateablePageMacros /// </summary> /// <param name="projectLinkFilePath">EPLAN project file (*.elk)</param> /// <param name="projectTemplateFilePath">EPLAN template project (*.zw9)</param> /// <param name="generatablePageMacros">List of GeneratablePageMaros</param> public static void Generate(string projectLinkFilePath, string projectTemplateFilePath, List <GeneratablePageMacro> generatablePageMacros) { var project = Create(projectLinkFilePath, projectTemplateFilePath, false); project.RemoveAllPages(); Insert insert = new Insert(); var pageCount = project.Pages.Length; // needed cause of overwrite foreach (var generatablePageMacro in generatablePageMacros) { // Load pages from macro PageMacro pageMacro = new PageMacro(); pageMacro.Open(generatablePageMacro.Filename, project); foreach (var page in pageMacro.Pages) { // Rename pageCount++; PagePropertyList pagePropertyList = page.NameParts; if (generatablePageMacro.LocationIdentifierIdentifier != null) { pagePropertyList[Properties.Page.DESIGNATION_FUNCTIONALASSIGNMENT] = generatablePageMacro.LocationIdentifierIdentifier.FunctionAssignment; pagePropertyList[Properties.Page.DESIGNATION_PLANT] = generatablePageMacro.LocationIdentifierIdentifier.Plant; pagePropertyList[Properties.Page.DESIGNATION_PLACEOFINSTALLATION] = generatablePageMacro.LocationIdentifierIdentifier.PlaceOfInstallation; pagePropertyList[Properties.Page.DESIGNATION_LOCATION] = generatablePageMacro.LocationIdentifierIdentifier.Location; pagePropertyList[Properties.Page.DESIGNATION_USERDEFINED] = generatablePageMacro.LocationIdentifierIdentifier.UserDefinied; } pagePropertyList[Properties.Page.PAGE_COUNTER] = pageCount; page.NameParts = pagePropertyList; new NameService(page).EvaluateAndSetAllNames(); } // Insert pagemacro insert.PageMacro(pageMacro, project, null, PageMacro.Enums.NumerationMode.Number); } }
private void btnPage2Search_Click(object sender, EventArgs e) { if (!ValidateProjectSelected(this.txtProject)) { return; } try { using (PagePropertyList properties = new PagePropertyList()) { if (!string.IsNullOrWhiteSpace(this.txtPage2HLF.Text)) { properties.DESIGNATION_PLANT = this.txtPage2HLF.Text.Trim(); } if (!string.IsNullOrWhiteSpace(this.txtPage2ML.Text)) { properties.DESIGNATION_LOCATION = this.txtPage2ML.Text.Trim(); } if (!string.IsNullOrWhiteSpace(this.txtPage2PageName.Text)) { properties.PAGE_NAME = this.txtPage2PageName.Text.Trim(); } Page[] resultPages = SerachPage(ProjectHelper.GetProject(this.txtProject.Text), properties); if (resultPages.Length == 0) { MessageDisplayHelper.Show("No Page Found", "::: Page Search"); } else { foreach (var page in resultPages) { MessageDisplayHelper.Show(string.Format("{0} <{1}>", page.Name, page.Properties[Properties.Page.PAGE_NOMINATIOMN]), "::: Page Search"); } } } } catch (Exception ex) { MessageDisplayHelper.Show(string.Format("Search Page Failed!{0}{1}", Environment.NewLine, ex.Message), "::: Page Search", EnumDecisionIcon.eEXCLAMATION); } }
/// <summary> /// 페이지를 다시 생성하기 위하여 존재하는 페이지를 삭제하는 경우, 검색하기 위한 정확한 페이지 이름 생성 /// - To Page Creation, Serach Existing Page with its full page name /// </summary> /// <param name="properties"></param> /// <returns></returns> private string BulidSearchPageName(PagePropertyList namePartproperties) { StringBuilder nameBuilder = new StringBuilder(); if (!namePartproperties.DESIGNATION_PLANT.IsEmpty) { nameBuilder.AppendFormat("={0}", namePartproperties.DESIGNATION_PLANT); } if (!namePartproperties.DESIGNATION_LOCATION.IsEmpty) { nameBuilder.AppendFormat("+{0}", namePartproperties.DESIGNATION_LOCATION); } if (!namePartproperties.PAGE_COUNTER.IsEmpty) { nameBuilder.AppendFormat("/{0}", namePartproperties.PAGE_COUNTER); } return(nameBuilder.ToString()); }
private static void GetUserDefinied(FunctionBasePropertyList functionBasePropertyList, PagePropertyList pagePropertyList) { if (pagePropertyList != null) { if (!pagePropertyList.DESIGNATION_USERDEFINED.IsEmpty) { functionBasePropertyList.DESIGNATION_USERDEFINED = pagePropertyList.DESIGNATION_USERDEFINED; } if (!pagePropertyList.DESIGNATION_USERDEFINED_SUB1.IsEmpty) { functionBasePropertyList.DESIGNATION_USERDEFINED_SUB1 = pagePropertyList.DESIGNATION_USERDEFINED_SUB1; } if (!pagePropertyList.DESIGNATION_USERDEFINED_SUB2.IsEmpty) { functionBasePropertyList.DESIGNATION_USERDEFINED_SUB2 = pagePropertyList.DESIGNATION_USERDEFINED_SUB2; } if (!pagePropertyList.DESIGNATION_USERDEFINED_SUB3.IsEmpty) { functionBasePropertyList.DESIGNATION_USERDEFINED_SUB3 = pagePropertyList.DESIGNATION_USERDEFINED_SUB3; } if (!pagePropertyList.DESIGNATION_USERDEFINED_SUB4.IsEmpty) { functionBasePropertyList.DESIGNATION_USERDEFINED_SUB4 = pagePropertyList.DESIGNATION_USERDEFINED_SUB4; } if (!pagePropertyList.DESIGNATION_USERDEFINED_SUB5.IsEmpty) { functionBasePropertyList.DESIGNATION_USERDEFINED_SUB5 = pagePropertyList.DESIGNATION_USERDEFINED_SUB5; } if (!pagePropertyList.DESIGNATION_USERDEFINED_SUB6.IsEmpty) { functionBasePropertyList.DESIGNATION_USERDEFINED_SUB6 = pagePropertyList.DESIGNATION_USERDEFINED_SUB6; } if (!pagePropertyList.DESIGNATION_USERDEFINED_SUB7.IsEmpty) { functionBasePropertyList.DESIGNATION_USERDEFINED_SUB7 = pagePropertyList.DESIGNATION_USERDEFINED_SUB7; } if (!pagePropertyList.DESIGNATION_USERDEFINED_SUB8.IsEmpty) { functionBasePropertyList.DESIGNATION_USERDEFINED_SUB8 = pagePropertyList.DESIGNATION_USERDEFINED_SUB8; } if (!pagePropertyList.DESIGNATION_USERDEFINED_SUB9.IsEmpty) { functionBasePropertyList.DESIGNATION_USERDEFINED_SUB9 = pagePropertyList.DESIGNATION_USERDEFINED_SUB9; } } }
private static void GetLocation(FunctionBasePropertyList functionBasePropertyList, PagePropertyList pagePropertyList) { if (pagePropertyList != null) { if (!pagePropertyList.DESIGNATION_LOCATION.IsEmpty) { functionBasePropertyList.DESIGNATION_LOCATION = pagePropertyList.DESIGNATION_LOCATION; } if (!pagePropertyList.DESIGNATION_SUBLOCATION1.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBLOCATION1 = pagePropertyList.DESIGNATION_SUBLOCATION1; } if (!pagePropertyList.DESIGNATION_SUBLOCATION2.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBLOCATION2 = pagePropertyList.DESIGNATION_SUBLOCATION2; } if (!pagePropertyList.DESIGNATION_SUBLOCATION3.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBLOCATION3 = pagePropertyList.DESIGNATION_SUBLOCATION3; } if (!pagePropertyList.DESIGNATION_SUBLOCATION4.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBLOCATION4 = pagePropertyList.DESIGNATION_SUBLOCATION4; } if (!pagePropertyList.DESIGNATION_SUBLOCATION5.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBLOCATION5 = pagePropertyList.DESIGNATION_SUBLOCATION5; } if (!pagePropertyList.DESIGNATION_SUBLOCATION6.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBLOCATION6 = pagePropertyList.DESIGNATION_SUBLOCATION6; } if (!pagePropertyList.DESIGNATION_SUBLOCATION7.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBLOCATION7 = pagePropertyList.DESIGNATION_SUBLOCATION7; } if (!pagePropertyList.DESIGNATION_SUBLOCATION8.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBLOCATION8 = pagePropertyList.DESIGNATION_SUBLOCATION8; } if (!pagePropertyList.DESIGNATION_SUBLOCATION9.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBLOCATION9 = pagePropertyList.DESIGNATION_SUBLOCATION9; } } }
private static void GetPlaceOfInstallation(FunctionBasePropertyList functionBasePropertyList, PagePropertyList pagePropertyList) { if (pagePropertyList != null) { if (!pagePropertyList.DESIGNATION_PLACEOFINSTALLATION.IsEmpty) { functionBasePropertyList.DESIGNATION_PLACEOFINSTALLATION = pagePropertyList.DESIGNATION_PLACEOFINSTALLATION; } if (!pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION1.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION1 = pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION1; } if (!pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION2.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION2 = pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION2; } if (!pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION3.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION3 = pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION3; } if (!pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION4.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION4 = pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION4; } if (!pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION5.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION5 = pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION5; } if (!pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION6.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION6 = pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION6; } if (!pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION7.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION7 = pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION7; } if (!pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION8.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION8 = pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION8; } if (!pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION9.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION9 = pagePropertyList.DESIGNATION_SUBPLACEOFINSTALLATION9; } } }
private static void GetPlant(FunctionBasePropertyList functionBasePropertyList, PagePropertyList pagePropertyList) { if (pagePropertyList != null) { if (!pagePropertyList.DESIGNATION_PLANT.IsEmpty) { functionBasePropertyList.DESIGNATION_PLANT = pagePropertyList.DESIGNATION_PLANT; } if (!pagePropertyList.DESIGNATION_SUBPLANT1.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLANT1 = pagePropertyList.DESIGNATION_SUBPLANT1; } if (!pagePropertyList.DESIGNATION_SUBPLANT2.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLANT2 = pagePropertyList.DESIGNATION_SUBPLANT2; } if (!pagePropertyList.DESIGNATION_SUBPLANT3.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLANT3 = pagePropertyList.DESIGNATION_SUBPLANT3; } if (!pagePropertyList.DESIGNATION_SUBPLANT4.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLANT4 = pagePropertyList.DESIGNATION_SUBPLANT4; } if (!pagePropertyList.DESIGNATION_SUBPLANT5.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLANT5 = pagePropertyList.DESIGNATION_SUBPLANT5; } if (!pagePropertyList.DESIGNATION_SUBPLANT6.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLANT6 = pagePropertyList.DESIGNATION_SUBPLANT6; } if (!pagePropertyList.DESIGNATION_SUBPLANT7.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLANT7 = pagePropertyList.DESIGNATION_SUBPLANT7; } if (!pagePropertyList.DESIGNATION_SUBPLANT8.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLANT8 = pagePropertyList.DESIGNATION_SUBPLANT8; } if (!pagePropertyList.DESIGNATION_SUBPLANT9.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBPLANT9 = pagePropertyList.DESIGNATION_SUBPLANT9; } } }
private static void GetFunctionalAssignment(FunctionBasePropertyList functionBasePropertyList, PagePropertyList pagePropertyList) { if (pagePropertyList != null) { if (!pagePropertyList.DESIGNATION_FUNCTIONALASSIGNMENT.IsEmpty) { functionBasePropertyList.DESIGNATION_FUNCTIONALASSIGNMENT = pagePropertyList.DESIGNATION_FUNCTIONALASSIGNMENT; } if (!pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT1.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT1 = pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT1; } if (!pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT2.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT2 = pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT2; } if (!pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT3.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT3 = pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT3; } if (!pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT4.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT4 = pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT4; } if (!pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT5.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT5 = pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT5; } if (!pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT6.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT6 = pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT6; } if (!pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT7.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT7 = pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT7; } if (!pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT8.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT8 = pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT8; } if (!pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT9.IsEmpty) { functionBasePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT9 = pagePropertyList.DESIGNATION_SUBFUNCTIONALASSIGNMENT9; } } }
/// <summary> /// Copies a PagePropertyList and insert the locations /// </summary> /// <param name="pagePropertyListSource">PagePropertyList to copy</param> /// <returns>Duplicate of PagePropertyList</returns> public PagePropertyList CopyPagePropertyList(PagePropertyList pagePropertyListSource) { PagePropertyList pagePropertylistCopy = pagePropertyListSource; GetPagePropertyList(pagePropertylistCopy); return pagePropertylistCopy; }
/// <summary> /// Gets a PagePropertylist with the locations /// </summary> /// <returns>Duplicate of PagePropertyList</returns> public PagePropertyList GetPagePropertyList() { PagePropertyList pagePropertyList = new PagePropertyList(); return GetPagePropertyList(pagePropertyList); }
private PagePropertyList GetPagePropertyList(PagePropertyList pagePropertylistCopy) { GetFunctionalAssignment(pagePropertylistCopy, this.FunctionAssignment); GetPlant(pagePropertylistCopy, this.Plant); GetPlaceOfInstallation(pagePropertylistCopy, this.PlaceOfInstallation); GetLocation(pagePropertylistCopy, this.Location); GetUserDefinied(pagePropertylistCopy, this.UserDefinied); GetDocumentType(pagePropertylistCopy, this.DocType); GetInstallationNumber(pagePropertylistCopy, this.InstallationNumber); return pagePropertylistCopy; }
public bool Execute(ActionCallingContext oActionCallingContext) { // MessageBox.Show("Checkout Action"); SelectionSet selectionSet = new SelectionSet(); Project project = selectionSet.GetCurrentProject(true); //string creator = project.Properties[10013]; //MessageBox.Show(creator); //Location[] location = project.GetLocationObjects(Project.Hierarchy.Plant); //string strDesc1 = ISOCodeUtil.GetISOStringValue(location[0].Properties.LOCATION_DESCRIPTION_SUPPLEMENTARYFIELD[1]); //MessageBox.Show(strDesc1); Page[] pages = project.Pages; DMObjectsFinder finder = new DMObjectsFinder(project); PagePropertyList ppl = new PagePropertyList(); // ppl.DESIGNATION_LOCATION = "C1"; // ppl.DESIGNATION_DOCTYPE = "SINGLE"; // ppl.DESIGNATION_DOCTYPE = "MULTI"; ppl.PAGE_TYPE_NUMERIC = 1; PagesFilter pf = new PagesFilter(); pf.SetFilteredPropertyList(ppl); Page[] sPages = finder.GetPages(pf); // sPages[0]. //FunctionPropertyList fpl = new FunctionPropertyList(); //FunctionsFilter ff = new FunctionsFilter(); //ff.SetFilteredPropertyList() ArrayList list = new ArrayList(); Function[] ffss = finder.GetFunctions(null); foreach (Function f in ffss) { if (f.Category == Function.Enums.Category.Motor) { list.Add(f); ArticleReference[] ars = f.ArticleReferences; if (ars.Count() > 0) { int count = ars[0].Count; Article article = ars[0].Article; } } } ArticleReferencePropertyList arpl = new ArticleReferencePropertyList(); arpl.ARTICLE_MANUFACTURER = "RITTAL"; ArticleReferencesFilter arf = new ArticleReferencesFilter(); arf.SetFilteredPropertyList(arpl); ArticleReference[] fars = finder.GetArticleReferences(arf); foreach (ArticleReference item in fars) { // MessageBox.Show(string.Format("{0}[{1}]({2})", item.Properties.ARTICLEREF_PARTNO, item.Properties.ARTICLE_MANUFACTURER, item.Count)); } // ArticleReference[] farsws = finder.GetArticleReferencesWithFilterScheme("default"); // P8에서 정의한 스키마로 필터 //PagePropertyList newppl = new PagePropertyList(); //// newppl.DESIGNATION_LOCATION = "MULTI"; //newppl.DESIGNATION_DOCTYPE = "MULTI"; //newppl.PAGE_COUNTER = "11"; //newppl.PAGE_NOMINATIOMN = "Insert Macro By API"; //newppl.PAGE_IDENTNAME = "1011"; //newppl.PAGE_NUMBER = "11"; //newppl.PAGE_NAME = "Insert Macro By API"; //Page newPage = new Page(); //newPage.Create(project, DocumentTypeManager.DocumentType.Circuit, newppl); //Insert insert = new Insert(); //PointD point = new PointD(100, 250); //var resultObject = insert.WindowMacro(@"C:\Users\Public\EPLAN26\Data\Macros\EPlanKorea\m.ema", 0, newPage, point, Insert.MoveKind.Absolute); PagePropertyList newppl = new PagePropertyList(); newppl.DESIGNATION_DOCTYPE = "MULTI"; newppl.PAGE_COUNTER = "211"; newppl.PAGE_NOMINATIOMN = "Insert Page Macro By API"; newppl.PAGE_IDENTNAME = "2011"; newppl.PAGE_NUMBER = "211"; newppl.PAGE_NAME = "Insert Page Macro By API"; Page newPage = new Page(); newPage.Create(project, DocumentTypeManager.DocumentType.Circuit, newppl); Insert insert = new Insert(); var resultObject = insert.PageMacro(@"C:\Users\Public\EPLAN26\Data\Macros\EPlanKorea\mPage.emp", newPage, project, false, PageMacro.Enums.NumerationMode.Number); return(true); }
private void btnPage2Create_Click(object sender, EventArgs e) { #region Validation if (!ValidateProjectSelected(this.txtProject)) { return; } if (!ValidateProjectSelected(this.txtPage2PageName)) { MessageDisplayHelper.Show("Please Input Page Name!", "::: Page Create"); this.txtPage2PageName.Focus(); return; } if (!ValidateProjectSelected(this.txtPage2Description)) { MessageDisplayHelper.Show("Please Input Page Description!", "::: Page Create"); this.txtPage2Description.Focus(); return; } #endregion try { using (Project targetProject = ProjectHelper.GetProject(this.txtProject.Text)) using (PagePropertyList properties = new PagePropertyList()) { if (!string.IsNullOrWhiteSpace(this.txtPage2HLF.Text)) { properties.DESIGNATION_PLANT = this.txtPage2HLF.Text.Trim(); } if (!string.IsNullOrWhiteSpace(this.txtPage2ML.Text)) { properties.DESIGNATION_LOCATION = this.txtPage2ML.Text.Trim(); } if (!string.IsNullOrWhiteSpace(this.txtPage2PageName.Text)) { properties.PAGE_COUNTER = this.txtPage2PageName.Text.Trim(); } Page[] resultPages = SerachByFullPageName(ProjectHelper.GetProject(this.txtProject.Text), BulidSearchPageName(properties)); if (resultPages.Length > 0) { DeletePage(resultPages); } CreatePage(targetProject, properties, string.IsNullOrWhiteSpace(this.txtPage2Description.Text) ? string.Empty : this.txtPage2Description.Text.Trim(), DocumentType.Circuit); RefreshProjectPages(this.cBoxPageCreatePages); MessageDisplayHelper.Show("Page Created!", "::: Page Create"); } } catch (Exception ex) { MessageDisplayHelper.Show(string.Format("Create Page Failed!{0}{1}", Environment.NewLine, ex.Message), "::: Page Create", EnumDecisionIcon.eEXCLAMATION); } }
private static void GetInstallationNumber(FunctionBasePropertyList functionBasePropertyList, PagePropertyList pagePropertyList) { if (pagePropertyList != null && !pagePropertyList.DESIGNATION_INSTALLATIONNUMBER.IsEmpty) { // There is no sub installation number functionBasePropertyList.DESIGNATION_INSTALLATIONNUMBER = pagePropertyList.DESIGNATION_INSTALLATIONNUMBER; } }
/// <summary> /// Gets a PagePropertylist with the locations /// </summary> /// <returns>Duplicate of PagePropertyList</returns> public PagePropertyList GetPagePropertyList() { PagePropertyList pagePropertyList = new PagePropertyList(); return(GetPagePropertyList(pagePropertyList)); }