zoukankan      html  css  js  c++  java
  • EPLAN API 入门系列 提高篇(How to Insert WindowMacro?)

                   internal const string NAME = "Example insert WindowMacro";                   
     1   ProjectManager prjMngr = new ProjectManager(); 2 SelectionSet oSelSet = new SelectionSet(); 3 Page oPage = (Page)oSelSet.GetSelectedPages().GetValue(0); 4 5 if (prjMngr.CurrentProject == null) 6 { 7 MessageBox.Show("No project is open.", ActionInsertMark.NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); 8 } 9 10 // get window macro file 11 OpenFileDialog dlg = new OpenFileDialog(); 12 dlg.InitialDirectory = prjMngr.Paths.Macros; 13 dlg.Title = "Select a window macro file"; 14 dlg.Filter = "Window macros (*.ema)|*.ema|All files|*.*"; 15 if (dlg.ShowDialog() != DialogResult.OK) 16 return true; 17 19 using (UndoStep us = (new UndoManager()).CreateUndoStep()) 20 { 21 //insert macro 22 Eplan.EplApi.DataModel.MasterData.WindowMacro macro = new Eplan.EplApi.DataModel.MasterData.WindowMacro(); 23 macro.Open(dlg.FileName, prjMngr.CurrentProject); 24 25 Insert insrt = new Insert(); 26 StorableObject[] arrInsertedObjs = insrt.WindowMacro(macro, 0, oPage, new PointD(), Insert.MoveKind.Relative); 27 28 //if (MessageBox.Show(string.Format("{0} objects inserted on page '{1}'.\n Do you want to undo this operation ?", arrInsertedObjs.Length, oPage.Name) 29 // , ActionInsertMark.NAME 30 // , MessageBoxButtons.YesNo 31 // , MessageBoxIcon.Question) == DialogResult.Yes) 32 //{ 33 // us.DoUndo(); 34 //} 35 }
  • 相关阅读:
    Xshell学习第九课:数组与字符串
    Xshell学习第八课:函数
    Xshell学习第七课:sed语句
    Xshell学习第六课:read与for语句循环
    Xshell学习第五课:if判断语句
    Xshell学习第四课:grep与正则表达式
    Xshell学习第三课:编程原理
    Xshell学习第二课:重定向和管道符
    iOS中坐标转换
    iOS工作笔记(十五)
  • 原文地址:https://www.cnblogs.com/AriLee/p/2987247.html
Copyright © 2011-2022 走看看