Offset Dimension (VBA)

I'm looking for a way to offset dimensions quick and easy.

How would I accomplish this task?

Have VBA read active scale 

Multiply active scale by .375 (set distance)

Pick point

Select Dimension

Move selected dimension (set distance) from picked point

Activate command again

Any help would be greatly appreciated.



Parents Reply Children
  • Hi Jonathan,

    Jonathan N said:
    I'm new to VBA too, so that doesn't help.

    I recommend to read Learning MicroStation VBA book, sold both by Bentley and Amazon. Regardless it's quite old, it's still valid and one from benefits is that it contains both VBA basic and learning of MicroStation VBA API ... which is a mistake done often by beginners to start  work with MicroStation VBA API without knowledge of VBA language itself.

    Jonathan N said:
    I cant get the DimensionElement.DimHeight to work at all. It errors out everytime.

    What does it mean? What is reported error.

    Looking at your code, I don't see any oDim assignment to existing instance, so the code cannot work for sure.

    Jonathan N said:
    Set oDim = ActiveModelReference.GetSelectedElements

    It cannot work or it's better to say it can in some cases, but it's not correct. Selection set can contain any set of graphical elements (different element types), but oDim variable can point to one instance of Dimension Element only.

    Jonathan N said:
    Im also having a hard time figuring out how to select the dimension after the macro is activated.

    I wrote it already: You have to implement ILocateCommandEvents object. It ensures VBA code behaves similarly to standard MicroStation location tools including correct support of data and reset mouse buttons. There are examples in MicroStation VBA help how to implement this class. Did you read them?

    With regards,