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 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 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); }