02-27-2018 07:28 AM
Hey,
is it possible to create a cadfile server programmatically in C#. I had searched the web, the forum and the dokumentation, but i found nothing about that. It would be nice if I could get an codesnippet as an example.
Sincerely yours
Solved! Go to Solution.
03-01-2018 05:56 AM
Theoretically yes. The csd file is nothing but renamed Access database file (mdb - the Office 97 or 2003 version, not the new mdbx format). So if you have the proper driver (MS JET) available in your programming language, you can create it from your app. However, the database structure is private and undocumented, so a bit of reverse engineering should be applied. I have no code snippet for this.
Pavel
04-04-2018 05:10 AM
OK,
i had created a cadfile server. However it wont work to add this csd to GeoMedia. I used this code to import this csd into GeoMedia.
tFileInfo = @"C:\Warehouses\CSD188.csd";
gm = (Intergraph.GeoMedia.GeoMedia.Application)Marshal.GetActiveObject("GeoMedia.Application");
mw = (Intergraph.GeoMedia.GeoMedia.MapWindow)gm.ActiveWindow;
Intergraph.GeoMedia.MapviewLib.GMMapView view = (Intergraph.GeoMedia.MapviewLib.GMMapView)mw.MapView;
doc = (Intergraph.GeoMedia.GeoMedia.Document)gm.Document;
conns = (Intergraph.GeoMedia.PClient.Connections)doc.Connections;
Connection pConn = new Connection
{
Application = gm,
CoordSystemsMgr = view.CoordSystemsMgr,
ConnectionName = "Test",
Description = "Test",
Location = tFileInfo,
Mode = 0,
Name = "Test",
Type = "GCAD.GDatabase",
};
pConn.Connect(); // I already could connect to the connection.
Intergraph.GeoMedia.PClient.GDatabase objDatabase = null;
objDatabase = (Intergraph.GeoMedia.PClient.GDatabase)pConn.Database;
conns.Append(pConn); // If I understood this right that will add the before definde connection to the warehouse connections. But every time I'll add this to my GeoMedia I got this Exeception : "No such interface supported". That connection is also displayed unter the other connctions...
I guess I missed something but I dont got this.
Regards