Converting Metric working units - to Inches and Custom setting in the Settings Design File

I am having to change the settings > Design File>Working Units. I have tried the VBA record over and over  It seems to record some of it 

in a Macro9ModalHandler, I actually have a 6, 7, 8, and the 9

but when you run the macro, does not seem to make the changes

the Key-In "set units inches inches" works fine but I need Inches Custom

  This is the starting format

 This is what I am trying to achieve , how ever possible KeyIn or VBA, Next is the Custom Window and the settings needed

 This is Custom Settings

Now I will put up the 1 of many test Macros trying to achieve this

Sub Macro12()
    'Dim startPoint As Point3d
    'Dim point As Point3d, point2 As Point3d
    Dim lngTemp As Long

'   Send a keyin that can be a command string
    CadInputQueue.SendKeyin "set units inches inches"
    CadInputQueue.SendKeyin "Set"

    Dim modalHandler As New Macro12ModalHandler
    AddModalDialogEventsHandler modalHandler

'   The following statement opens modal dialog "Design File Settings"

'   Start a command
    CadInputQueue.SendCommand "MDL SILENTLOAD DGNSET"

    CadInputQueue.SendCommand "MDL SILENTUNLOAD DGNSET"

    RemoveModalDialogEventsHandler modalHandler
    CommandState.StartDefaultCommand
End Sub

This is the 12th attempt with VBA record, finally  the Macro12ModalHandler

Option Explicit

Implements IModalDialogEvents
Private Sub IModalDialogEvents_OnDialogClosed(ByVal DialogBoxName As String, ByVal DialogResult As MsdDialogBoxResult)

End Sub

Private Sub IModalDialogEvents_OnDialogOpened(ByVal DialogBoxName As String, DialogResult As MsdDialogBoxResult)

    If DialogBoxName = "Design File Settings" Then

    '   The following statement opens modal dialog "Define Custom Units"
    
    '   Set a variable associated with a dialog box
        SetCExpressionValue "dgnSet.cust_customSU", 1, "DGNSET"

        SetCExpressionValue "dgnSet.cust_subNumerator", 10, "DGNSET"
        SetCExpressionValue "dgnSet.subUnitInfo.label", "TH", "DGNSET"

    '   Remove the following line to let the user close the dialog box.
        DialogResult = msdDialogBoxResultOK

    End If  ' Design File Settings

    If DialogBoxName = "Define Custom Units" Then

    '   Set a variable associated with a dialog box
        SetCExpressionValue "dgnSet.cust_customSU", 1, "DGNSET"

        SetCExpressionValue "dgnSet.cust_subNumerator", 10, "DGNSET"
        SetCExpressionValue "dgnSet.subUnitInfo.label", "TH", "DGNSET"

    '   Remove the following line to let the user close the dialog box.
        DialogResult = msdDialogBoxResultOK

    End If  ' Define Custom Units

End Sub

Not sure what else to put, I have looked in help, VBA help and Online, Jan hope this is correct ?

Parents Reply
  • Thank you but , it can be done. I was give a link to a Chinese Sub and it seems to work, but it is for Metric (((c; I am trying to go the other way.

    Sub SetUnits()
        Dim myUnit As MeasurementUnit
        myUnit.System = msdMeasurementSystemMetric
        myUnit.Base = msdMeasurementBaseMeter
        myUnit.Label = "mm"
        myUnit.UnitsPerBaseDenominator = 1
        myUnit.UnitsPerBaseNumerator = 1000
        ActiveModelReference.MasterUnit = myUnit
        SaveSettings
    End Sub
      Really slick, I did get another lead, and was told it was easy but needed to be done in the correct order. They were tied up with frozen pipe issues so they are going to respond later. So appreciate the information. I do have the seedfile

    a friend helped me make 1. Thanks again.

    Version: MicroStation V8i SS 10

    RJB Phillips III (Richard) Praise the Lord for His Mercy and grace in Christ Jesus

Children
No Data