It's possible to create my own VBA project and use CustemHooks

Hello,

I have two questions:

1. I try to create new VBA Project in BUD which use  XfmStdUtilCustomization.ICustemHook just like x.p. XfmStdElecLib


When edit Configuration file and change "CustomPlacementLib" property on one feature to notify my project when proess this feature.


Unfortunately when I Place or edit this feature nothing is happened.

Any ideas why didn't worked?

2.  It is possible to implement  XfmStdUtilCustomization.ICustemHook in .Net AddIn?

Thanks.

 

I try to create new VBA Project in BUD which use  XfmStdUtilCustomization.ICustemHook just like x.p. XfmStdElecLib


When edit Configuration file and change "CustomPlacementLib" property on one feature to notify my project when proess this feature.


Unfortunately when I Place or edit this feature nothing is happened.

Any ideas why didn't worked?

  • Hi Nikolay,
    I'm not sure why only a single method would be called. GetFeaturePropertyHook is called whenever we access the configuration information, so it tends to be the first method called. Perhaps it is just erroring on this method before you get to the other calls?
    Thanks,
    Mike


    This is a test

  • Hi Mike,

    I played some days with that how to add my custemhook instance in Singleton in .NET and I have success.

    In the beginning I tried to add my object in Singleton after the BUISMdlWrapper initialized. when I put my keyin command (CadInputQueue.SendKeyin "mdl load addintestapp" ) in Sub InitializeCustomPlacement()  in any of exiting VBA Projects everything  is work fine.

    The reason maybe is that Microstation try to execute  (vba run TestCustomPlacementCmds.InitializeCustomPlacement) but my instance is in .NET Addin.


    This is my output before I add  keyin command (CadInputQueue.SendKeyin "mdl load addintestapp" ) in Sub InitializeCustomPlacement() 

    *************Added BEConn to Wrapper

    *************Added XFMAssociations to Wrapper

    vba run ElectricCustomPlacementCmds.InitializeCustomPlacement

    vba run GasCustomPlacementCmds.InitializeCustomPlacement

    vba run WaterCustomPlacementCmds.InitializeCustomPlacement

    vba run WasteWaterCustomPlacementCmds.InitializeCustomPlacement

    vba run CommonCustomPlacementCmds.InitializeCustomPlacement

    vba run TestCustomPlacementCmds.InitializeCustomPlacement

    Failed to initialize the Customization Dictionary, Name = TestCustomPlacementCmds. No Custom behavior will be available during this session. The VBA projects and references may be invalid, or the CustomPlacementLibs setting in BentleyUtilityConfiguration.xml may be incorrect.

    InitializeBUISMdlWrapper


    And after:

    The string 3 is 3 as double.

    *************Added BEConn to Wrapper

    *************Added XFMAssociations to Wrapper

    vba run ElectricCustomPlacementCmds.InitializeCustomPlacement

    vba run GasCustomPlacementCmds.InitializeCustomPlacement

    vba run WaterCustomPlacementCmds.InitializeCustomPlacement

    vba run WasteWaterCustomPlacementCmds.InitializeCustomPlacement

    vba run CommonCustomPlacementCmds.InitializeCustomPlacement

    'UtilitiesDesigner.exe' (CLR v2.0.50727: DefaultDomain): Loaded 'C:\Program Files (x86)\Bentley\UtilitiesDesigner V8i\UtilitiesDesigner\mdlapps\addintestapp.dll'. Symbols loaded.

    vba run TestCustomPlacementCmds.InitializeCustomPlacement

    InitializeBUISMdlWrapper


    Thanks.