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
Answer Verified By: Nikolay Tsonev
Thanks Mike
I didn't saw CustomPlacementLibs Property because I searched in Model Administrator MA_ConfigurationSetting sheet, but they are in Base fail.
So now its work!!!
I have one more question can I do the same thing, but with .NET AddIn?
Hi Mike,
I try with XfmStdUtilCustomization._CustemHook interface *** is already exposed and I instantiate my class and added to Singleton
class XfmStdCustemHook : _CustomHook
{
public int CanDeleteHook(string Context, feature oFeature, ref bool Validation, ref string Message)
throw new NotImplementedException();
}
public int ExtendedTraceFunctionality(string TraceType, string NetworkName, ref feature oStartFeature, ref NetworkResult NetResult, ref network Network)
public int ExtendedTraceFunctionalityEnabled(string TraceType, string NetworkName, ref feature oStartFeature, ref NetworkResult NetResult, ref bool bEnabled)
public string GetFeaturePropertyHook(feature oFeature, string propertyname, string PropertyValue)
public int GraphicItemCloseHook(string Context, ref string Message)
public int GraphicItemElementMovedHook(string Context, string model, int elmID, double x, double y, double z, ref string Message)
public int GraphicItemLeftClickHook(string Context, ref string uuid, string model, int lowElmID, int highElmID, double mouseX, double mouseY, double modelX, double modelY, double modelZ, ref string Message)
public int GraphicItemLeftDblClickHook(string Context, ref string uuid, string model, int lowElmID, int highElmID, double mouseX, double mouseY, double modelX, double modelY, double modelZ, ref string Message)
public int GraphicItemOpenHook(string Context, feature Feature, ref string Message)
public int GraphicItemRightClickHook(string Context, ref string uuid, string model, int lowElmID, int highElmID, double mouseX, double mouseY, double modelX, double modelY, double modelZ, ref string Message)
public int GraphicItemRightDblClickHook(string Context, ref string uuid, string model, int lowElmID, int highElmID, double mouseX, double mouseY, double modelX, double modelY, double modelZ, ref string Message)
public int GraphicItemSetVariableHook(string Context, string Name, string Value, ref string Message)
public int GraphicItemUpdateHook(string Context, feature Feature, ref string Message)
public int NumberOfChildrenHook(string Context, feature oParentFeature, ref object[] ChildFeatures, ref bool Validation, ref string Message)
public int PostConnectHook(string Context, string NetworkName, ref feature oSourceFeature, ref feature oTargetFeature, ref string Message)
public int PostCreateParentAssociationHook(string Context, feature oChildFeature, feature oParentFeature, short AssociationType, ref string Message)
public int PostCreatePeerAssociationHook(string Context, feature oFeature1, feature oFeature2, short AssociationType, ref string Message)
public int PostDeleteHook(string Context, ref feature oFeature, ref string Message)
public int PostDeleteParentAssociationHook(string Context, feature oChildFeature, feature oParentFeature, short AssociationType, ref string Message)
public int PostDeletePeerAssociationHook(string Context, feature oFeature1, feature oFeature2, short AssociationType, ref string Message)
public int PostDisconnectHook(string Context, string NetworkName, ref feature oTargetFeature, ref string Message)
public int PostInsertHook(string Context, ref feature oFeature, ref string Message)
public int PostJoinHook(string Context, double SplitCoordX, double SplitCoordY, double SplitCoordZ, ref feature oUpstreamFeature, ref feature oDownstreamFeature, ref string Message)
public int PostMoveGeometryHook(string Context, ref feature oFeature, Element oPreviousGeometry, ref string Message)
public int PostSplitHook(string Context, double SplitCoordX, double SplitCoordY, double SplitCoordZ, ref feature oUpstreamFeature, ref feature oDownstreamFeature, ref string Message)
public int PostTraceHook(string TraceType, string NetworkName, ref feature oStartFeature, ref NetworkResult NetResult)
public int PostUpdateHook(string Context, ref feature oFeature, PropertyEnumerator oPreviousProp, Element oPreviousGeometry, ref string Message)
public int PreConnectHook(string Context, string NetworkName, ref feature oSourceFeature, ref feature oTargetFeature, ref bool Validation, ref string Message)
public int PreCreateParentAssociationHook(string Context, feature oChildFeature, feature oParentFeature, short AssociationType, ref bool Validation, ref string Message)
public int PreCreatePeerAssociationHook(string Context, feature oFeature1, feature oFeature2, short AssociationType, ref bool Validation, ref string Message)
public int PreDeleteHook(string Context, ref feature oFeature, ref bool bCancel, ref string Message)
public int PreDeleteParentAssociationHook(string Context, feature oChildFeature, feature oParentFeature, short AssociationType, ref bool Validation, ref string Message)
public int PreDeletePeerAssociationHook(string Context, feature oFeature1, feature oFeature2, short AssociationType, ref bool Validation, ref string Message)
public int PreDisconnectHook(string Context, string NetworkName, ref feature oTargetFeature, ref bool Validation, ref string Message)
public int PreInsertHook(string Context, ref feature oFeature, ref PropertyEnumerator oProposedProp, ref bool Validation, ref string Message)
public int PreJoinHook(string Context, ref double SplitCoordX, ref double SplitCoordY, ref double SplitCoordZ, ref feature oUpstreamFeature, ref feature oDownstreamFeature, ref bool Validation, ref string Message)
public int PreMoveGeometryHook(string Context, ref feature oFeature, ref Element oProposedGeometry, ref bool Validation, ref string Message)
public int PreSplitHook(string Context, ref feature oFeature, ref double SplitCoordX, ref double SplitCoordY, ref double SplitCoordZ, ref bool Validation, ref string Message)
public int PreTraceHook(string TraceType, string NetworkName, ref feature oStartFeature, ref XPathQueryDef oXPathQuery)
public int PreUpdateHook(string Context, ref feature oFeature, ref object oProposedProp, ref bool bCancel, ref string Message)
public int TreeSelChangedHook(string Context, ref int elmId, ref feature oParentFeature, ref feature oChildFeature, ref string Message)
And this is my Run method
IXfmStdUtilSingletonMap ASingleton = new XfmStdUtilSingletonMap();
object m_CustomizationClass = new XfmStdCustemHook();
ASingleton.Set_SingletonObject("TestCustomPlacementCmds", ref m_CustomizationClass);
When I test only GetFeaturePropertyHook method s called.
Thanks
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.
'UtilitiesDesigner.exe' (CLR v2.0.50727: DefaultDomain): Loaded 'C:\Program Files (x86)\Bentley\UtilitiesDesigner V8i\UtilitiesDesigner\mdlapps\addintestapp.dll'. Symbols loaded.