Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
OpenCities Map
  • Product Communities
  • Geospatial
  • OpenCities Map
  • Cancel
OpenCities Map
OpenCities Map Wiki - Convert text to XFM and propagate text string to shapes using VBA
    • Sign In
    • -OpenCities Map Wiki
      • -OpenCities Map
        • - End of Support for Bentley Map V8i (SELECTseries) products
        • +Release Information
        • +Installation Information
        • +Getting Started
        • +Administration
        • +General Topics
        • +Geospatial Administrator
        • +Feature Definitions and Inference Rules
        • +Interoperability
        • +Spatial Databases
        • +Spatial Analysis
        • +3D Geospatial
        • +Geographic Coordinate Systems
        • +Troubleshooting
        • -Freeware - Utilities - Applications - Programs
          • - Auto update Editing initial values (Sync1 MDL)
          • - Centroid text to shape (VBA)
          • - Change feature elevation (VBA)
          • - Convert text to XFM and propagate text string to shapes using VBA
          • - Create schema from Shapefiles (Schema Register EXE)
          • - Export text string and Element ID (TextNodeToTextFile VBA)
          • - Extended Properties (xProps MDL)
          • - Label latitude and longitudes (VBA)
          • - Learning Resources
          • - Load properties from text strings (text2xfm VBA)
          • - Planarize 3D Polygon (MDL)
          • - Show XFM Properties on tool tips (MDL)
          • - Symbology Integrator (EXE)
          • - Utilities from Elivagner Barros
          • - XFM attribute query (Feature Query VBA)
          • Setting Level for reference attachment (VBA)
        • +Advanced Map Finishing
      • OpenCities Map Ultimate for Finland CONNECT Edition x64 (SES)
      • OpenCities Map Ultimate for Finland CONNECT Edition - Suomi
      • Bentley Descartes
      • +Other Geospatial Products

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

    - Convert text to XFM and propagate text string to shapes using VBA

    This tutorial discusses converting plain MicroStation text to usable XFM features and propagate the text string value to polygons.  This is accomplished by using two lightweight macros that are available for your use    

    text2xfm

    centroids_text_to_shape

    --------------

    First of all, a Bentley Map project schema is created that includes two features:  MapTile as a polygon and MapTileText as a point-text feature.  Each has a text string property named Label  which will be the placeholder for the text string.

    The design file is a grid of map tiles that are labelled accordingly.   The map tiles and labels are on separate levels named:  MapTiles and MapTileText. 

    When the design file is opened with the Map project as the active workspace, the MicroStation elements are identified as inferred features.

    Load the  VBA named text2xfm and run the macro ModMain.run.  The Input Feature/Level will be the existing text in the design file, and the Load Property will be a text property of the feature definition.  In order for this macro to work as intended, ensure that the level of the text matches the level of the text feature in the project schema.  When processed, the text will change to green and be recognized as XFM native features. 

    As well, when Analyze Feature or Edit Feature is used, the dialogs show that the original text string is now a business property of the text feature.

    The next step in this workflow is to propagate the label from the newly created text features to the existing map tile shapes.  To do that, the map tiles must first be promoted to XFM features using the Bentley Map Promote tool that's part of the map schema.  When promoted, the shapes will change colour to red.  Note that the Label property is left blank at this time.

    Load the second macro named centroids_text_to_shape.mvba  (it will load as centroid3 in the VBA Project Manager).    This macro requires that the text features are centroids in closed shapes.  This means that they need to be completely within the boundaries of the shapes in order for the macro to be successful.  The dialog of the macro enables you to select the polygon and centroid (text) features as well as the property to copy.  Clicking Copy Business Properties will execute the macro and in this example 15 centroids are processed.

    Reviewing a map tile shows that the Label property is now populated with the text value of the centroid and is ready to export to SHP or be used in a mapping project.

    The attached zip file contains the geospatial project, the design file, both macros and a PDF of this article. 

    MapTile.zip

    Disclaimer:  These applications are supplied as-is and do not come with support. Bentley Systems Inc., and the author of these programs assume no liability for damages direct, indirect, or consequential, which may result from the use of these programs. Use these application at your own risk.

    Related Links:  https://communities.bentley.com/products/geospatial/desktop/f/bentley-map-forum/127584/promote-a-text-to-a-feature-point-text/388622#388622

    • Freeware
    • Share
    • History
    • More
    • Cancel
    • Inga Morozoff Created by Bentley Colleague Inga Morozoff
    • When: Tue, May 1 2018 2:27 PM
    • Inga Morozoff Last revision by Bentley Colleague Inga Morozoff
    • When: Thu, Nov 22 2018 4:27 PM
    • Revisions: 8
    • 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

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