EPLAN API 入门系列- 提高篇(How to Insert WindowMacro?)
2013-03-28 17:55
549 查看
internal const string NAME = "Example insert WindowMacro"; 1 ProjectManager prjMngr = new ProjectManager(); SelectionSet oSelSet = new SelectionSet(); Page oPage = (Page)oSelSet.GetSelectedPages().GetValue(0); if (prjMngr.CurrentProject == null) { MessageBox.Show("No project is open.", ActionInsertMark.NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } // get window macro file OpenFileDialog dlg = new OpenFileDialog(); dlg.InitialDirectory = prjMngr.Paths.Macros; dlg.Title = "Select a window macro file"; dlg.Filter = "Window macros (*.ema)|*.ema|All files|*.*"; if (dlg.ShowDialog() != DialogResult.OK) return true; using (UndoStep us = (new UndoManager()).CreateUndoStep()) { //insert macro Eplan.EplApi.DataModel.MasterData.WindowMacro macro = new Eplan.EplApi.DataModel.MasterData.WindowMacro(); macro.Open(dlg.FileName, prjMngr.CurrentProject); Insert insrt = new Insert(); StorableObject[] arrInsertedObjs = insrt.WindowMacro(macro, 0, oPage, new PointD(), Insert.MoveKind.Relative); //if (MessageBox.Show(string.Format("{0} objects inserted on page '{1}'.\n Do you want to undo this operation ?", arrInsertedObjs.Length, oPage.Name) // , ActionInsertMark.NAME // , MessageBoxButtons.YesNo // , MessageBoxIcon.Question) == DialogResult.Yes) //{ // us.DoUndo(); //} }
相关文章推荐
- EPLAN API 入门系列- 提高篇(How to get all connections which are not in location box)
- EPLAN API 入门系列- 提高篇(How to get PropertyValue?)
- EPLAN API 入门系列- 提高篇(How to get Symbol via Function)
- EPLAN API 入门系列- 提高篇(How to Add/Remove GraphicalLayer?)
- EPLAN API 入门系列- 提高篇(How to get PartProperty via partNo)
- Go语言入门系列1:安装,How to Write Go Code
- EPLAN API 入门系列- 实战篇(How to Change Properties in EPlan?)
- Go语言入门系列1:安装,How to Write Go Code
- EPLAN API 入门系列- 提高篇(Common)
- [寒江孤叶丶的CrossApp之旅_04][入门系列]修改CrossApp默认打开的Window(窗口)
- nhibernate入门系列: one-to-many映射
- nhibernate入门系列: many-to-many映射
- How to Pop Open an image window that resizes to fit the image in ASP.net 1.x and 2.0 Beta 1
- How to develop a window mobile application
- WPF入门教程系列五——Window 介绍
- How to make an SDL window the child of another window in Win32
- c#window程序开发入门系列--自学笔记
- How to Make Windows Start Up Faster---如何提高windows启动速度
- How to use # inside a macro definition - 宏定义嵌套问题
- [新手入门]快速学习 ADO.NET Entity Framework系列文章 #3 -- LINQ-to-SQL、EntitySQL、查询产生器方法(Query builder)三种语法