[gdal-dev] Ogr and Dwg via Teigha (in C#)

Noon Silk noonslists+gdal at gmail.com
Sun Nov 4 15:04:09 PST 2012


Hi Tamas,

 So it turns out that these libraries aren't really required; and the
build error I saw was because of a slight bug in the makefile for DWG.

 The "DXF_OBJ" variable needs to be: "DXF_OBJ = ..\dxf\intronurbs.obj
..\dxf\ogrdxf_polyline_smooth.obj ..\dxf\ogr_autocad_services.obj",
i.e. it needs to also include the "ogr_autocad_services.obj" file,
which defines "ACTextUnescape", and afew others, that both libraries
use.

 At least I now get a working ogr_DWG.dll, and it seems to read the
files! So thanks for pointing me to the plugin approach, that appears
to be the main thing I was missing.

--
Noon

On Sun, Nov 4, 2012 at 3:51 PM, Noon Silk <noonslists+gdal at gmail.com> wrote:
> Hi Tamas,
>
>  Thanks; I think you're right. So I started to follow the advice on
> building the plugins here:
> <http://trac.osgeo.org/gdal/wiki/BuildingOnWindows> only to find that
> the build appears to be referencing some libs that don't come with the
> particular Teigha download that I have.
>
>  It's referencing "TD_FT.lib", "Jpeg.lib", and probably less
> importantly, "OdBagFiler.lib" (the last one seemingly being related to
> one of the Teigha example projects).
>
>  I'm a bit out of luck, here, because when I just comment these lines
> including these libs out (in the hope that they aren't included
> because they aren't needed) it doesn't compile (possibly related to
> the Jpeg stuff).
>
>
> On Sun, Nov 4, 2012 at 8:31 AM, Tamas Szekeres <szekerest at gmail.com> wrote:
>> Noon,
>>
>> As far as I see the DWG driver is compiled as a plugin so you should either
>> place it into a /gdalplugins subdirectory from where your application is
>> running, or set the location of this dll in the GDAL_DRIVER_PATH environment
>> variable.
>> Also make sure the location of the dll-s from the dependent libs are also
>> added in PATH.
>>
>> Best regards,
>>
>> Tamas
>>
>>
>>
>>
>> 2012/11/3 Noon Silk <noonslists+gdal at gmail.com>
>>>
>>> Hi,
>>>
>>>  So, further to this, I've not had much luck with my previous
>>> approach. I'm going to now try this method; but I kind of want to
>>> understand why what I tried didn't work.
>>>
>>>  What I mean by "Didn't work" is that my requests to open DWG files,
>>> or just grab an instance of the DWG driver, didn't work.
>>>
>>>  I ask for an instance like so (in C#):
>>>
>>>  Ogr.RegisterAll();
>>>  Driver d = Ogr.GetDriverByName("DWG");
>>>
>>>  "d" comes back as null. So, I expected it to return something given
>>> that I thought I was correctly "enablding" the DWG library. But, I
>>> also checked to see if the number of available drivers changed, after
>>> me doing what I would've expected to result in the enablding. Sadly,
>>> it didn't. So I can only assume that I didn't enanble it correctly.
>>>
>>>  So, my process for enabling the DWG driver was basically to allow it
>>> to be compiled as part of the "gdal\ogr\ogrsf_frmts\makefile.vc" (by
>>> adding in the directory and the obj files). I also set up the required
>>> Teigha libraries by uncommenting and correctly setting the particular
>>> bits of nmake.opt.
>>>
>>>  Then the only other change I made was to generate the SWIG bindings.
>>>
>>>  Is this the correct way to enable the dwg bindings? Is there
>>> something obvious I've missed? Would linking this other -dev build
>>> script with the particular source work better?
>>>
>>> Thanks,
>>> --
>>> Noon
>>>
>>>
>>>
>>>
>>> On Fri, Nov 2, 2012 at 9:30 AM, Noon Silk <noonslists+gdal at gmail.com>
>>> wrote:
>>> > On Mon, Oct 29, 2012 at 11:34 PM, Tamas Szekeres <szekerest at gmail.com>
>>> > wrote:
>>> >> You might also take a look at the -dev packages at
>>> >> http://www.gisinternals.com/sdk/
>>> >> The compilation is controlled by a single makefile, so you can use:
>>> >>
>>> >> nmake gdal
>>> >> nmake gdal-csharp
>>> >
>>> > Thanks; I happened to grab the "MSVC2005 (Win64) -development", which
>>> > doesn't have that ..., I'll give this a go.
>>> >
>>> >
>>> >> to achieve the desired result.
>>> >>
>>> >> Best regards,
>>> >>
>>> >> Tamas
>>> >
>>> > --
>>> > Noon
>>
>>


More information about the gdal-dev mailing list