[V8i SS3 VBA] Unable to Record 'Save As' with Fence Filter

Manually Save As with Fence Filter works as expected

If I Save As manually, and invoke the Options to set a fence filter, things progress as expected.  I end up with a new DGN file whose default model contains elements copied from the contents of the fence in the original file.

Recorded VBA Macro fails to record all settings to Save As with Fence Filter

When I record that same process using the VBA macro recorder, then replay the recording, the fence is not processed.  The playback creates a new file of the correct name but its contents are the entire contents of the original.  In other words, it ignores (or rather, fails to record) the fence filter setting.

Has anyone experienced this problem?  Has anyone solved this problem?

I've noticed one error in the recording.  The recording creates a procedure (Macro1 or similar) and declares variable lngTemp As Long in that procedure.  But lngTemp is not used there.  The recording creates a class that Implements IModalDialogEvents.  The _OnDialogOpened event of that class uses, but fails to declare, variable lngTemp.  What else may have been missed?

Here's the code from the class that deals with the filter settings.  I don't see where it records that I want a fence filter...

    If DialogBoxName = "Save As V8 Options" Then

    '   Set a variable associated with a dialog box
        SetCExpressionValue "gFilterGlobals.subset", 1, "SAVEASFILTER"

    '   This only modifies a few bits of the variable it changes. It first
    '   creates a mask for clearing the bits it will change. Then it gets
    '   the variable and uses the mask to clear those bits. Finally
    '   it sets the desired bits in the value and saves the updated value.
        Dim lngTemp As Long ' Declaration inserted manually
        lngTemp = Not 1
        lngTemp = GetCExpressionValue("gFilterOptions->flags.filterACS", "SAVEASFILTER") And lngTemp
        SetCExpressionValue "gFilterOptions->flags.filterACS", lngTemp Or 1, "SAVEASFILTER"

        lngTemp = Not 1
        lngTemp = GetCExpressionValue("gFilterOptions->flags.filterNamedViews", "SAVEASFILTER") And lngTemp
        SetCExpressionValue "gFilterOptions->flags.filterNamedViews", lngTemp Or 1, "SAVEASFILTER"

        lngTemp = Not 1
        lngTemp = GetCExpressionValue("gFilterOptions->flags.filterSharedCellInstances", "SAVEASFILTER") And lngTemp
        SetCExpressionValue "gFilterOptions->flags.filterSharedCellInstances", lngTemp Or 1, "SAVEASFILTER"

        lngTemp = Not 1
        lngTemp = GetCExpressionValue("gFilterOptions->flags.filterUnusedSharedCellDefs", "SAVEASFILTER") And lngTemp
        SetCExpressionValue "gFilterOptions->flags.filterUnusedSharedCellDefs", lngTemp Or 1, "SAVEASFILTER"

        lngTemp = Not 1
        lngTemp = GetCExpressionValue("gFilterOptions->flags.filterTags", "SAVEASFILTER") And lngTemp
        SetCExpressionValue "gFilterOptions->flags.filterTags", lngTemp Or 1, "SAVEASFILTER"

        lngTemp = Not 1
        lngTemp = GetCExpressionValue("gFilterOptions->flags.filterFrozenLevels", "SAVEASFILTER") And lngTemp
        SetCExpressionValue "gFilterOptions->flags.filterFrozenLevels", lngTemp Or 1, "SAVEASFILTER"

        lngTemp = Not 1
        lngTemp = GetCExpressionValue("gFilterOptions->flags.filterNamedGroups", "SAVEASFILTER") And lngTemp
        SetCExpressionValue "gFilterOptions->flags.filterNamedGroups", lngTemp Or 1, "SAVEASFILTER"

        CadInputQueue.SendCommand "LOCK FENCE INSIDE"

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

    End If  ' Save As V8 Options
Parents Reply Children
  • Unknown said:
    I am glad that you found a MDL solution

    Thanks for your kind support.  However, the solution wasn't just lying around, waiting to be discovered, so I didn't just "find" it.
    I had to specify, write, build and debug the MDL code.  The specification includes the requirement to be usable from a VBA application.

    An MDL app. can provide a command table, unavailable in VBA (a .NET AddIn can also provide a command table).  That makes the MDL app. easy to use from VBA because you can simply use CadInputQueue.SendKeyin "MY APP COMMAND" as if it were a built-in MicroStation command.

    Bio

    You might like to add to your Communities personal biography and tell us a little more about yourself and how you use VBA.

     
    Regards, Jon Summers
    LA Solutions