Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
MicroStation
  • Product Communities
  • More
MicroStation
MicroStation Wiki MicroStation V8 XM Edition View Code Updates
    • Sign in

    • +MicroStation Wiki
    • +Administration Wiki
    • +Annotations Wiki
    • +Bentley View Wiki
    • +MicroStation PowerDraft
    • -Programming Wiki
      • A class to help create and modify text element
      • A Complete Example
      • A MicroStation VBA Example With Bentley ProjectWise
      • AddIn Development Using VB.NET
      • C# .NET Template with IPrimitiveCommandEvents Class
      • Capturing Graphics in Dynamic Views
      • Compiling MDL Applications
      • Database Manipulation
      • Debugging Native Code MDL Applications
      • Developing Code in VBA
      • Developing MicroStation Applications For DWG Files
      • Drag and Drop in MicroStation
      • Error: "Cannot save changes to VBA project 'Support' because it is read-only"
      • Getting And Setting Elements Using Graphic Groups In VBA [CS]
      • Getting Started with Visual Basic
      • How To Write A Recursive Routine In MicroStation VBA [CS]
      • Introducing Segment3D Methods In MicroStation V8 2004 Edition
      • Known issues in MDL and MicroStationAPI
      • Launching VBA Applications As Initapps Or Dgnapps [CS]
      • Learning MicroStation Addins Step by Step
      • MDL - Getting Started With XAttributes In MicroStation V8 XM Edition
      • MDL - Native Code Application Development
      • MDL Or MicroStation BASIC Choosing The Right Tool [TN]
      • MFC Dialog And Native Window Support
      • Microsoft Office VBA Patch Utility
      • MicroStation BASIC FAQ
      • MicroStation BASIC Limits [FAQ]
      • MicroStation Developer Documentation and Example Code
      • MicroStation Programming Advice
      • MicroStation SDK
      • MicroStation V8 Programming Tools Readme
      • MicroStation V8 VBA Programming Resources [CS]
      • MicroStation V8 XM Edition View Code Updates
      • MicroStation VBA Resources Revisited [CS]
      • Migrating Dimension Code To MicroStation V8
      • Migrating MDL Applications To Native Code
      • Mouse Wheel Events And The Visual Basic 6.0 IDE
      • Porting MDL Applications To MicroStation V8
      • Reading Elements From A Microsoft Access Database With VBA [CS]
      • Running MDL Applications
      • Scanning For MicroStation V8 Elements In VBA [CS]
      • Unleash A Workspace Wizard Automating Workspace Creation With MicroStation V8 And VBA [CS]
      • Using VBA To Detect The Current Or Last Used Command
      • Using VBA To Programmatically Export A VBA Project [CS]
      • Using VBA To Programmatically Import A VBA Projects Components And References [CS]
      • VBA -- Creating A Complex Application
      • VBA Interface Error: failed creating the comp manager - 0x80040583
      • VBA interface error: unable to get IDE
      • vba recording
      • Working With Levels In MicroStation VBA [CS]
      • Writing An MDL Application To Output Custom Placemarks To Google Earth
      • [V8i C++] PointCloud IPointCloudChannelDisplayHandler
    • +Visualization Wiki

     
     Questions about this article, topic, or product? Click here. 

    MicroStation V8 XM Edition View Code Updates

    One of the first things that you will likely notice with MicroStation V8 XM Edition is the change to the display subsystem. This new subsystem was designed and implemented to provide significant benefit to users and developers alike -- both now and in the future. That said, the changes made in this area may have an impact on applications. While most applications will not require any work to run in MicroStation V8 XM Edition, some applications may require rework to take advantage of the new subsystem. The display-related items fall into one of three categories:

    The use of mdlElement_display and mdlElmdscr_display

    • Traditionally, applications create graphic elements in memory, explicitly display them to the screen by calling mdlElement_display and mdlElmdscr_display, and then add them to the file. In MicroStation V8 XM Edition, the display system exclusively handles the display of graphic elements. This means that applications no longer need to explicitly call the display functions.

    The displaying of "temporary" graphics

    • There are two categories of temporary graphics -- one being dynamics. Most applications use simple dynamics and require no modifications to existing code. If your application uses complex dynamics, though, there is some impact to the code. Most importantly, if the dynamics requires creating geometry and displaying it based on the drawmode parameter, you no longer need to create the geometry to erase it during the temporary erase draw time.

      The other type of temporary graphics are those that require drawing to the screen but not changing the design file, which should not be confused with dynamics in the application. This can be as simple as highlighting an element In MicroStation V8 XM Edition, applications can use the mdlLocate_hiliteElement function to highlight an element. This simulates selecting the element and displaying it in the current highlight color. If the application needs to create graphics that are not going to be written to the design file (i.e. to show to the user but not make them persistent), the traditional way was to create the elements and then use the display functions. This will not work in MicroStation V8 XM Edition, since the display works in a "continual-update" mode. Instead, the geometry only needs to be put into a transient element descriptor, which needs to be managed by the application. If the geometry needs to change during creation, the mdlInput_simulateCursorMotion function will allow the display system to update the display. The prototype for that function is:

      Public void mdlInput_simulateCursorMotion (void);
    • Hooking the view update for elements

      The last category of display-related changes is the use of mdlView_setFunction to catch the UPDATE_EACH_ELEMENT event. For various reasons, that is no longer supported in MicroStation V8 XM Edition. If you need to react to that event (or something similar), you need to use mdlView_setSubstituteElemFunc instead, which takes as its argument a function of type ViewFunc_SubstituteElem.

       

    /*----------------------------------------------------------------------+
    | |
    +----------------------------------------------------------------------*/
    Private void sample_reload
    (
    int argc,
    char *argv[]
    )
    {
    //The following is the old method
    //mdlView_setFunction (UPDATE_EACH_ELEMENT, sample_updateElementHook);
    //The following is the new method
    mdlView_setSubstituteElemFunc ((ViewFunc_SubstituteElem)sample_updateElementHook);
    mdlView_setFunction (PLOTUPDATE_FINISHED, sample_postProcess);
    }


    /*----------------------------------------------------------------------+
    | |
    +----------------------------------------------------------------------*/
    Private SubstituteElemStatus sample_updateElementHook
    (
    MSElementDescrH newEdPP, // <= output if element being replaced
    int* priorityP, // <= priority if element being defered
    IMSViewportP viewPortP,
    DrawPurpose drawPurpose,
    IViewContextP context, // => view context
    bool allowDefer, // => whether element can be defered
    ElemHandleCP elemIterP // => elem-iter for current element if descriptor is needed
    )
    {
    SubstituteElemStatus retVal = SUBSTELEM_STATUS_Normal;
    .
    .
    .

     

     

    An important thing to note regarding the use of mdlView_setSubstituteElemFunc is that this function is only available to a native code application compiled with the C++ compiler (information on moving MDL applications to native code has been covered in previous BDNzine articles). The ViewFunc_SubstituteElem function has some new parameter types, IMSViewportP and IViewContextP interfaces, and the ElemHandleCP element handle pointer. IMSViewport can call the GetViewNumber method to return the view number. ElemHandleCP is a constant pointer to the element handle for the element being processed. The end result of calling this function can be to do nothing, block, or defer the display of the element. Additionally, the function can return an element to substitute for the original. In the callback function passed to mdlView_setSubstituteElemFunc, there is a DrawPurpose parameter, which identifies the reason why the callback is being invoked. For a complete list of the draw purposes, look at the DrawPurpose enumeration in mstypes.h. The most draw purposes are Update, Hilight, or Dynamics. However, you should review the entire list to determine which may be most applicable to your application development. In MicroStation V8 XM Edition, there are a number of new times that the update call is made, so this function should be used judiciously as it is called quite often.

    These categories should be reviewed as you look to having your applications run on MicroStation V8 XM Edition. Whether you are using MDL or VBA, you may have to deal with the changes in some form.

     

     

    • BDNzine
    • Share
    • History
    • More
    • Cancel
    • Dan Koval Created by Bentley Colleague Dan Koval
    • When: Thu, Sep 5 2013 3:49 PM
    • Revisions: 1
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2021 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies