中国BDN社区

This is where you can find and contribute to discussions, ideas, and other information about 中国BDN社区.

中国BDN社区博客

中国BDN社区博客
  • 中国BDN社区博客

    一步步学习MDL[0]

    • 0 Comments
    本系列博客将由浅入深地帮助您学习MDL。按照本博客的步骤,相信您能很快地掌握这一开发MicroStation应用程序的最主要方法。本博客有中、英文两种版本,分别发布在中国BDN社区博客和Bentley Developer Netwrok社区博客。 第零章、介绍与必备条件 从MicroStation 4.0版开始就有MDL这一功能强大的开发手段了,那还要追溯到上世纪90年代初。那时的MDL是MicroStation Development Language(MicroStation开发语言)的简称,它是Bentley公司基于C语言的一种扩展语言,编译器和链接器均由Bentley公司提供。最终生成的程序扩展名为.MA,是MicroStation Application的缩写。我们把这样的开发方法叫做PureMDL,开发PureMDL您仅需要一个源代码编辑器,其它的工具(编译器、链接器以及调试器)都由Bentley提供了。 随着时间的推移,MDL也在与时俱进。今天的MDL已经完全可以基于C++来开发...
  • 中国BDN社区博客

    Learning MicroStation Addins Step by Step[9]

    • 0 Comments
    第九章、用C++/CLI编写Addins Chapter 9. Writing Addins using C++/CLI 从上一章我们能够看到,要调用MDL API函数需要通过DllImport属性对其进行声明。好在我们所演示的mdlMesh_newPolyfaceFromXYTriangulation函数还算简单,而且要生成一个网格曲面仅调用这一个函数即可。假如您要进行智能实体的编程可就没有这么幸运了,因为它往往需要调用多个MDL API函数才能实现一个功能。如果还对每个MDL函数进行DllImport属性声明,一则是比较繁琐,再者就是难度也不小。好在微软为我们提供了功能强大的混合程序集编程语言——C++/CLI。当我们改用C++/CLI写我们的程序集时,既可以调用.NET的功能也可以像本机代码C/C++那样直接调用MDL函数。下面就让我们来一步步编写一个C++/CLI的Addin程序,其中演示了绘制上一章的网格曲面以及绘制一个智能实体。 From the last...
  • 中国BDN社区博客

    Learning MicroStation Addins Step by Step[8]

    • 0 Comments
    第八章、在Addins中调用MDL API函数 Chapter 8. Calling MDL API function from Addins 或许您已经注意到了,在MicroStationDGN对象模型中找不到有关网格曲面和三维智能实体的对象。确实,直到MstnV8iSS2这个版本,这两项非常重要的三维功能还没有封装到我们的对象模型中。那是否就无法通过C#语言来实现这些高级功能了呢?答案当然是否定的。通过C#的PInvoke功能我们可以调用Win32 API中函数,当然也就能调用MDL API中的函数了。 Maybe you have noticed that neither mesh surface nor SmartSolid can be found in our MicroStationDGN object model. In fact, these two important 3D functions haven’t wrapped into current object...
  • 中国BDN社区博客

    Learning MicroStation Addins Step by Step[7]

    • 0 Comments
    第七章、响应MicroStation事件 Chapter 7. Responding to MicroStation events 上一章我们利用IPrimitiveCommandEvents和ILocateCommandEvents捕获到了鼠标的数据键和拒绝键(当然也能捕获到用户的键盘输入),这些都是在Mstn中发生的事件。其实,Mstn中还有更多的事件在发生而且我们可以来捕获它们。下表列出最常见的事件类型以及事件处理函数。 事件类型 事件处理函数 参考设计文件 IAttachmentEvents的方法 参考光栅文件 IRasterEvents的方法 打开或关闭设计文件 NewDesignFileEventHandler(附加到NewDesignFileEvent中) “另存为”命令 ISaveAsEvents的方法 激活模型 IModelActivateEvents的方法 跟踪元素的变化 IChangeTrackEvents的方法 视图更新 IViewUpdateEvents的方法...
  • 中国BDN社区博客

    Learning MicroStation Addins Step by Step[6]

    • 0 Comments
    第六章、用IPrimitiveCommandEvents和ILocateCommandEvents实现交互式命令 Chapter 6. Using IPrimitiveCommandEvents and ILocateCommandEvents to implement interactive commands 您肯定使用过Mstn中的放置直线和复制元素命令吧?其实Mstn中的命令分为视图命令和基本命令两大类,基本命令又分为放置类和修改类。这一章我们要实现的两个命令就分别属于放置类和修改类。它们分别需要用派生于IPrimitiveCommandEvents和ILocateCommandEvents接口的类来实现。第一个要实现的是动态绘制指定点的坐标,第二个要实现的是对指定元素执行多次缩放复制。这两个命令都具有一定的实用价值,是用户在实际工作中提出来的。 You must have used the PLACE LINE and MODIFY ELEMENT command. Actually...
  • 中国BDN社区博客

    Learning MicroStation Addins Step by Step[5]

    • 0 Comments
    第五章、给Addins添加Windows窗体 Chapter 5. Adding WinForms to Addins 本章我们将介绍如何在Mstn中使用模态(Modal)对话框、非模态(Modeless)对话框、工具设置(ToolSettings)对话框和可停靠(Dockable)对话框。模态、非模态和停靠类对话框在各种应用软件中都会用到,你能从互联网上找到许多与之相关的内容。工具设置对话框是Mstn特有的,它本身是一个非模态的,但其内容会随着用户选择工具的不同而自动改变。由于我们在Addins中使用的对话框都派生于WinForm,所以可以用VS中的可视化工具直接设计对话框界面,这会比使用传统的MDL的.r资源编程效率高得多。写过大量乏味的.r资源的人会感觉到用Addins编写界面简直是一种享受。下面我们来一步步扩展我们的csAddins应用程序。 We will introduce how to use modal, modeless, toolsettings and dockable...
  • 中国BDN社区博客

    Learning MicroStation Addins Step by Step[4]

    • 0 Comments
    第四章、给Addins添加命令 Chapter 4. Adding commands to Addins 在学习Addins之前如果您学习过MDL(MicroStation Development Language/Library)和MVBA(MicroStation Visual Basic for Application)的话,您可能会注意到在MDL中支持键入命令而在MVBA中则不支持。虽然Addins看起来很像MVBA,那是因为它目前调用的是和MVBA相同的一个COM库,但Addins实际上是先被转换成一个MDL应用后才被加载执行的。您能在…\MicroStation\mdlsys\asneeded文件夹下找到mdlseed.ma和mdlseed.dll,它们就是为此目的而设的。所以,Addins和MDL类似,它能支持键入命令。随着XML的流行,Addins中定义命令表不再使用MDL中的资源文件Table的格式,而是采用XML格式来定义。本章的主要内容之一就是详细介绍XML命令表的格式...
  • 中国BDN社区博客

    Learning MicroStation Addins Step by Step[3]

    • 0 Comments
    第三章、运行并调试Addin Chapter 3. Running and debugging Addins Addin应用程序是基于.NET框架的程序集,它会被装载到一个应用程序域内来运行。当您用默认的(此处的“默认”意思是指除了应用程序文件名外不带有额外的参数)MDL LOAD命令装载了一个Addin程序后,它被装载到了Mstn的默认应用程序域DefaultDomain中。可能正如您所了解的,程序集是不能被直接卸载的,只有程序域才能被卸载。因此,在Mstn中提供有未在公开文档中提及的CLR(CLR是“公共语言运行时”的缩写)命令,其中含有卸载程序域的命令。由于Mstn系统的程序集都是被装载在默认的DefaultDomain中,所以,当您将自己的程序装载在非默认程序域时有时会出现程序出错的情况。这也许就是CLR命令未在公开文档中提及的原因。不过,对于大多数Addins程序,该卸载命令都有效。学会卸载Addin能大大方便您调试程序,因为这样就不必反复退出和进入Mstn耽误时间了...
  • 中国BDN社区博客

    Learning MicroStation Addins Step by Step[2]

    • 0 Comments
    第二章、在Addin中创建元素 Chapter 2. Creating elements from Addins Mstn中有很多种类型的元素,我们可以将其分成图形元素和非图形元素。本章主要讨论如何在Addin中利用Mstn对象模型创建图形元素。有关DGN中可以有哪些图形元素类型可参考如下图表,黑色部分为目前版本的Mstn对象模型 (Bentley MicroStation DGN 8.9 Object Library)支持的图形元素,蓝色部分是该对象模型提供的与图形元素相关的九个接口,红色部分是该对象模型目前还不支持的图形元素。您可以调用MDL API来生成这部分元素,我们后续章节会有这方面的例子。 There are a lot of types of elements, graphical elements and non-graphical elements, in Mstn. We mainly discuss how to create graphical elements using...
  • 中国BDN社区博客

    Learning MicroStation Addins Step by Step[1]

    • 0 Comments
    第一章、建立一个最简单的Addin应用程序 Chapter 1. Creating a simplest Addin application 本章将带领您从零开始一步步建立一个最简单的Hello World应用程序,该程序能够在Mstn中装载运行。 This chapter will lead you to create a simplest 'Hello World' Addin application from scratch. This application can be loaded and executed in Mstn. 1、启动VS2010。 1. Start VS2010. 2、在VS2010中选菜单File > New > Project或直接按快捷键Ctrl+Shift+N弹出如下窗体。在该窗体左侧点击Visual C#,右侧点击Class Library。然后选取工程路径并输入工程名,最后在点击OK按钮前要记着将.NET Framework由默认的4...
  • 中国BDN社区博客

    Learning MicroStation Addins Step by Step[0]

    • 0 Comments
    本系列博客将分十几讲由浅入深地帮助您学习MicroStation Addins。按照本博客的步骤,相信您能很快地掌握这一新的开发MicroStation应用程序的方法。本博客以中英双语书写,以方便中国和非中国地区的开发者参考。中文读者请读蓝色文字,非中文读者请读黑色文字。限于作者英文水平有限,不能保证英文内容描述的正确性。 A series of posts in this blog will help you to learn the MicroStation Addins step by step, from elementary topics to advanced. According to the steps provided in these blogs, I believe you can quickly master this new approach of developing MicroStation application. I wrote these blogs in...
  • 中国BDN社区博客

    用VBA如何判断当前文件是否打开了设计历史(To know whether Design History is on by using VBA)?

    • 0 Comments
    从V8XM开始,MVBA增加了PropertyHandler功能,它主要的目的是通过ECFramework(EC——Engineering Content)来访问元素、设计文件、模型或参考的属性。这种方式完全不同于MVBA中固有的对象下的属性。下面这个例子就是通过PropertyHandler来监测当前文件是否打开了“设计历史”功能。 From MicroStation V8XM, there is a new object PropertyHandler which can be used to access the properties of element, model, reference and design file. It is a different way to access the properties. The following snippet demonstrates how to monitor the current...
  • 中国BDN社区博客

    V8i下建立含有ShxBigFont的TextStyle(Creating TextStyle contains ShxBigFont under V8i)

    • 0 Comments
    MicroStation V8i 公开了许多新的C++类,使用这些类使得编程更为简单。如下代码能建立一个含有ShxBigFont的文字样式。 There are many new MDL C++ classes unvealed under V8i. These classes make some programming jobs simpler than before. The below code show how to create a TextStyle which contains a ShxBigFont. DgnFileR dgnFile = TextStyleManager::GetActiveStyle()->GetFile(); DgnTextStylePtr pTextStyle = TextStyleManager::Create (L'MyTextStyle', dgnFile); FontP pShxFont = FontManager:...
  • 中国BDN社区博客

    阻止一个对话框的关闭(To prevent a dialogbox from closing)

    • 0 Comments
    总共有四种情况: There are four cases totally as below: 1、对于自己用.r资源写的对话框,可以直接在对话框的属性中"或"上DIALOGATTR_UNCLOSEABLE属性即可; 1. If the dialobox is written by your own .r resource, you can directly set the dailog's attribute to DIALOGATTR_UNCLOSABLE. 2、对于非自己设计的.r资源类的对话框,用mdlDialog_hookDialogSetSecondary (dbP, unCloseHook, NULL);关联上第二级钩函数。其中unCloseHook内容如下: 2. If the dialogbox is not your own, for example, it is a MicroStation system dialogbox, you can...
Page 1 of 1 (14 items)