gdi explorer and vba

Hi ,

 

i want to programmatically open and query a oracle spatial graphical source.

Is there any sample code available ?

Thanks, Stefan.

 

Parents
  • Stefan,

    The Interoperability functionality of Bentley Map is not currently available in VBA directly. However the Interoperability application (e.g. gdi) provides keyins which could be used in VBA to perform basic queries of feature instances from Oracle Spatial layers. Please see the "Interoperability Key-ins" section of the Bentley Map help file for additional information.

    If additional customization is required, then the GeoDataInterchange managed .NET assemblies could be used. In Bentley Map V8i (SELECTseries 2) the ...\Bentley\Documentation\GeoDataInterchangeAPI.chm compressed help file is delivered which documents the .NET related classes.

    As you may know, one approach to exposing those .NET capabilities to VBA could be done by crafting a COM server which encapsulates the desired functionality. An example of doing just that is available in "xfmOracleExtensions" of the "Bentley Map - Development and Product Customization Guide" which allows a VBA application...

    ...to perform custom Interoperability functionalities with an Oracle Spatial graphical source.

    If you are currently a BDN (Bentley Development Network) partner or current SELECT subscriber you can request and obtain access to additional information available in the online "Bentley Map - Development and Product Customization Guide". If interested, please use the Geospatial Desktop Platform Account Request Form listing myself (Jeff Bielefeld) as the Bentley contact.

    Once approved, you will be granted access to the Geospatial Desktop Platform extranet site which hosts the new "Bentley Map - Development and Product Customization Guide" a frequently updated online resource for anyone interested in learning more about customizing or developing applications for the Bentley Map product line, including the new Bentley Map V8i (SELECTseries 2) releases.

    Regards,

    Jeff Bielefeld [Bentley]



  • Hi Jeff,

    I am currently forced to work with Map SS1, which still lacks the "gdi connect ..." Keyins.

    I also could not find the GeoDataInterchangeAPI.chm help file for the ss1 release.

    I just applied to the Geospatial Desktop Platform.

    Thanks, Stefan.

Reply Children
  • Stefan,

    As mentioned, the Bentley Map V8i (SELECTseries 2) 08.11.07 release provides the new Interoperability API services, documented in the ...\Bentley \Documentation\GeoDataInterchangeAPI.chm help file. The "gdi connect" keyin is also new to this most recent Bentley Map release. For Bentley Map V8i (SELECTseries 1) you should be able to use/adapt code from the referenced "xfmOracleExtensions" example to establish an Oracle Spatial graphical source connection from a VBA application.

    Regards,

    Jeff Bielefeld [Bentley]



  • Hi Jeff,

    thanks for your help.

    I got it running.

    I found the example you mentioned in one of your former posts...

    I applied for the Geospatial Desktop Platform but no approval yet...

  • Jeff,

    as described in your example, I was able to adapt your example.

    As a .net - newbie I don't know, how to put the generated code on another maschine.

    When running the line on a second maschine:

    Set oOracleInstance = New OracleSpatialExtensions

    the debugger tells me: ActiveX control cannot create object

    Any suggestions?

    Thanks, Stefan.

  • Stefan,

    You will most likely have to use regasm.exe to manually register the generated type library, something that is done automatically when Visual Studio compiles the assembly if the projects "Build > Output > Register for COM interop" option is enabled. I believe the regasm.exe tool is normally installed as part of the .NET Framework such as C:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm.exe which you could check for with a...

    dir %SystemRoot%\Microsoft.NET\Framework\regasm.exe /s

    ...command. You would then need to add the appropriate PATH to a command shell such as done be the Visual Studio delivered vsvars32.bat batch file. After doing so you should be able to use regasm.exe to perform the registration of the type library using a command as...

    regasm Bentley.Geospatial.Extensions.Oracle.dll /tlb:Bentley.Geospatial.Extensions.Oracle.tlb

    ...which should produce output similar to the following:

    Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.5420
    Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

    Types registered successfully
    Assembly exported to 'I:\source\xfmOracleExtensions\bin\Debug\Bentley.Geospatial.Extensions.Oracle.tlb', and the type library was registered successfully

    I'm sure a search on the web for COM interop assembly registration and regasm will reveal more.

    Regards,

    Jeff Bielefeld [Bentley]



  • Jeff,

    got it running. Had to use the /codebase switch in regasm.

    Thanks a lot.