Converting UCM Macros to Basic

For Microstation V8i, I have been given the assignment of converting several UCMs to Basic or Visual Basic. Since there is a manual for converting UCM to Basic, I decided that I would convert them to Basic. Then new macros could be created in VBA. I am just learning Microstation and of course, my management wants this assignment completed quickly.

I would like to know if it is possible to call a Basic Macro from another Basic Macro with parameters of any built-in or Macrostation type, such as an MbePoint.  If not, is there an alternative? These small UCM Macros that are called frequently by many Macros, but I don't think there are include files in Basic.

For now, I'm using Basic Subroutines, which isn't ideal.

I would like to convert the UCMs to VBA, but I think that would take much longer, unfortunately.

Parents
  • Recommendations …

    1. Prefer VBA
      • Don't convert anything to BASIC

     
    Regards, Jon Summers
    LA Solutions

  • I highly recommend that you convert things to VBA over Basic.  I have never tried this so I do not know how successful it will be, start the VBA recorder and then run the UCM it should record the playback of the UCM depending on how complex, it may help you get what you need.

  • Elaine, the process you are describing is what I consider to be a typical "Migration Project".  There are several options and considerations in the process that should be evaluated before being able to project how long your migration project will take.

    Here are some considerations:

    How has the Product changed?  In your case MicroStation SE (5.7) to MicroStation V8i 8.11 has change drastically in capabiities and workflows.  These points are fundamental in your approach.

    MicroStation V7 had 63 levels and the V7 design file format.  MicroStation V8 has a new format, capabilities, workflows, and nearly limitless levels, models, styles (line, text, dimension), etc.  For one, your UCM unless the most simple will not work in MicroStation V8.  MicroStation BASIC being older also has the similar limitations and both would require several and/or extreme hacks to accomplish something that a more modern MicroStation VBA could handle with ease.  MicroStation VBA has its (smaller) set of limitations, but can be augmented with MicroStation MDL (C/C++ programming language APIs) to enhance VBA, or offer functionality in a stand-alone manner.

    The first part of such a daunting task is to ask some of these questions from the CAD admin/operators:

    1. How many programs are there?

    2. What do they do?

    3. Does the Product NOW offer this functionality?

    4. Have the workflows in the product changed making the older way ineffecient or obsolete?

    5. How many programs do we need to migrate?

    6. Do we only need to migrate some or all the code/featurs of the customization forward?

    7. What programming language(s) are required?

    8. Do I have the experience necessary to perform some or all the work defined as being required?

    9. Can I meet the projected deadlines?

    10. Will I have adequate time to test each app, feature, and (new) workflow and validate everthing is working?

    There are more considerations along the way, but these steps above are generic and apply to any software product that provides customization/programming options.

    I would recommend to evaluate the existing functionality and find it, or find out how to accomplish it in the new product.  Use MicroStation VBA since it is relatively easy to learn and prototype functionality quickly.  TIP: Plenty of sample code in the VBA Help document - Alt F11, F2 (object browser), Search for something - e.g. Cell, then hilite an item displayed in the results and Press F1 - noting "Example" hyperlinks for sample code.  Lastly, if the deadline(s) are imperative I would recomend that you consider contacting our Bentley Profession Services group since they are already fully equipped to handle and meet your customization needs.  Here is some contact information for convenience.

    Bentley Professional Services (BPS) - For Bentley product customization services

    Web:  www.bentley.com/.../Bentley+Professional+Services

    E-mail:  bentley.consulting@bentley.com

    Wish you the best in your efforts and please make sure to use the Be Communities to help you find your way and help with any specific programming questions you may have.

    HTH,

    Bob



  • Thanks, Jon. Then if Microstation BASIC does not support all the features of Microstation (of any version?), does that mean that UCMs can't be completely converted to Microstation BASIC?

  • Unknown said:
    That mean that UCMs can't be completely converted to Microstation BASIC?

    Keep in mind that UCMs support even fewer features of MicroStation V8.  BASIC provides more than UCMs, and VBA provides more still and is not obsolescent.

    For example, consider levels.  In V8, levels are named (in MicroStation SE they are numbered).  There is no restriction on the number of levels (in SE, there are 63).  VBA can handle an arbitrary number of named levels; BASIC can't, UCMs can't.

    But that introduces another question: What will your organisation do with an unlimited number of named levels?  Will they change their way of working (everyone who moved to V8 successfully embraced that change)?  If levels influences their way of working, should the UCM functionality also accommodate those changes?

     
    Regards, Jon Summers
    LA Solutions

  • no one here can help you if you don't supply the UCM's to examine......period.

  • I was unable to find ucm2basic.ma. I looked in the directory where the ma files are for the older version of Microstation. Awhile ago I had read online that there was a bat file called ucm2basic that Bentley could provide and I called them. But they told me that this was no longer available.

  • I recently found my copy of the MicroStation Productivity book. It lists many of the register and/or tcb variables that UCM's used. If you need any explanation of some of these to determine what the code was doing, I can help.


    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
  • Thank you, caddcop. I've been using "Microstation-UCM-REF15.pdf" and "UCM-to-Basic.pdf" to understand the UCM code, but I don't have the "MicroStation Productivity book." What I'm not clear about is CVT:

    CVT A0 = '.25'

    CVT A1 = '.625'

    CVT A2 = '.5'

    CVT A3 = '.125'

    When I used the counterpart of this using Basic, the graphic didn't work correctly. But when I ignored it, it did. I converted the UCM code to VBA ignoring CVT and it also works.

    Is there something different about the MIcrostation 8vi version compared to the older version the illustrators are using, Microstation SE O5.07.01.22, so that I don't need to translate CVT to the VBA counterpart?

  • Unknown said:
    CVT A0 = '.25'

    Is there something different about the MIcroStation V8i version compared to the older version so that I don't need to translate CVT to the VBA counterpart?

    There's a lot different.  CVT is a conversion instruction: the quoted string is converted to a decimal and stored in register A0.

    VBA has more explicit assignments:

    Dim decimalNumber As Double
    decimalNumber = 1.234

    The TCB registers Ax are globally-available storage slots.  Those UCM slots don't know or care what's stored in them: an integer number, floating point number, or a 3D point.  A VBA variable is local to your macro, and is usally declared to store a certain type of data. That makes VBA much safer to use.

     
    Regards, Jon Summers
    LA Solutions

  • In "UCM-to-Basic.pdf" it says that CVT converts between working units and UORs and stores the result in var1. If var1 is a character string, the conversion is from UORs (Units of Resolution) to working units and then I would need to find the equivalent in VBA.

    However, in VBA I did do something similar to what you showed in your reply, except made them const. So I don't need to be concerned about working units and UORs in converting CVT?

  • Unknown said:
    I highly recommend that you convert things to VBA over Basic.  I have never tried this so I do not know how successful it will be, start the VBA recorder and then run the UCM it should record the playback of the UCM depending on how complex, it may help you get what you need.

    I just want to mention again that I highly recommend that any new end user customization be done in VBA.  I would hate to see you have to do the work twice if you choose to convert things to Basic.

Reply
  • Unknown said:
    I highly recommend that you convert things to VBA over Basic.  I have never tried this so I do not know how successful it will be, start the VBA recorder and then run the UCM it should record the playback of the UCM depending on how complex, it may help you get what you need.

    I just want to mention again that I highly recommend that any new end user customization be done in VBA.  I would hate to see you have to do the work twice if you choose to convert things to Basic.

Children
No Data