I am trying make a WMS server where I want to render a CAD drawing as a layer.
I have the following code
protected override MapConfiguration GetMapConfigurationCore(string style, string crs)
{
string cadFilePath = Path.Combine(Directory.GetParent(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).FullName).FullName, "SampleData", "test.dwg");
CadFeatureLayer cadLayer = new CadFeatureLayer(cadFilePath);
mapConfiguration.Layers.Add("CAD", cadLayer);
return mapConfiguration;
}
And
protected override Bitmap GetMapCore(GetMapRequest getMapRequest, MapConfiguration mapConfiguration, HttpContext context)
{
try
{
Bitmap mapImage = base.GetMapCore(getMapRequest, mapConfiguration, context);
return mapImage;
}
catch (Exception)
{
}
return null;
}
Everytime the server execute the base.GetMapCore(); function the server throws an exception with the following StackTrace.
at Teigha.TD.TD_DbPINVOKE.odInitialize(HandleRef jarg1)
at Teigha.TD.TD_Db.odInitialize(OdRxSystemServices pSystemServices)
at CadDumper.DwgDxfCadDumper.Dump()
at CadDumper.DwgDxfCadDumper.GetFeatureStyles()
at CadDumper.CadDumper.GetCadFeatures()
I have tried with several cad files and verified that the path is correct.
I have attached a screen shot of the exception.
All the CAD files I have tried all works if load them in a CadFeatureLayer in Map Suite WPF Desktop Edition