Units

In this example we have so far avoided the mention of which units we are using to construct the frame.  This has been deliberate as the units used when scripting the VBA can be any unit supported within Multiframe.  In fact, when working with the automation interface, all values are specified using the current units set that is been used within the application.  The units may be interrogated or manipulated using the Preferences object.  The Units property of the Preferences object specifies the current unit set. This may be set to one of predefined sets of units (Australian, Japanese, American, etc.) by setting it to an enumerated value of type mfUnitSets.  For example, the Japanese unit set may be specified by setting

mfApp.Preferences.UnitSet = mfUnitsetJapanese

The specific units used with a unit set can be manipulated via the SetUnit method of the Preferences object.  This method takes two parameters; the first is an enumerated value identifying the type of units (length, force, angle, etc) to be set. The second parameter is a string that specifies the name of the units to be used. For example, to change the units for length to feet would require the code

mfApp.Preferences.SetUnits(mfUnitLength,”ft”)

Allowable values of the unit names are those listed in Multiframe’s Units dialog for each of the units types.

 

For the portal frame script, metric units have been adopted.  This is done by inserting the following piece of code at the start of the script following the declaration of variables.

  'Set units
  With mfApp.Preferences
    .UnitSet = mfUnitsetAustralian
    Call .SetUnit(mfUnitLength, "m")
    Call .SetUnit(mfUnitForce, "kN")
  End With

This short piece of code specifies to use the Australian unit set and then ensures that the length and force units are set to metres and kilonewtons respectively.