ThinkGeo.com    |     Documentation    |     Premium Support

Where has CadFeatureLayer gone in Version 10?

I was having some problems opening serialized versions of CadFeatureLayer using version 9, so I thought I would see if the same problem existed in version 10.

To my surprise, the CadFeatureLayer doesn’t appear to be included in the NuGet package. Where has it gone and how do I include it in my project?

As for the version 9 issue, when you serialize a CadFeatureLayer, it appears to try and write all the features out literally, cadFeaturesDumped = true, rather than simply store a file path variable like ShapeFileFeatureLayer does. This serialization appears to cause problems. When you try and open the deserialized layer, we get “an item with the same key has been added” error. Here’s a bit from the stack trace.

at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value)
at ThinkGeo.MapSuite.Core.CadFeatureLayer.iis=(Dictionary`2 cadFeatureStyles)
at ThinkGeo.MapSuite.Core.CadFeatureLayer.OpenCore()
at ThinkGeo.MapSuite.Core.Layer.Open()

Hi Damian,

For V10 the CAD layer is here: https://www.nuget.org/packages/ThinkGeo.MapSuite.Layers.Cad/11.0.0-beta007

Install it in your project by NuGet, then you can use it by add the “using ThinkGeo.MapSuite.Layers;” in source code.

You can do the search like “MapSuite CAD” in NuGet to find it, use the same format you can also find the other packages for V10.

And from your stack trace information, it looks that’s related with the style you choose, could you please show us the simple test code contains the style setting so we can look into it?

Regards,

Don

Hi Don,

For the style setting, I am using CadStylingType.EmbeddedStyling option. I will try a plain zoomlevel set and see if it is the same result.

Seems there is a problem on NuGet just now, I went to download MapSuite CAD and it isn’t in search results. In fact, at current, there is no MapSuite at all. Probably just a glitch. I will try again tomorrow.

Regards,
Damian

Hi Don,

I kept having problems with this method, so I decided to port the CAD feature source into in memory layers for each of the well known object types. This works fine for most cases.

I did run into 1 file that returns a exception has been thrown by the target of an invocation error.

A couple suggestions on the implementation:

  1. Use file path like shape file so serialization is not big
  2. A lot of newer CAD files have the proj information stored in them. Try and read this so we don’t have to set it.

Hi Damian,

If the NuGet still have problem please let us know, you can also download them from website and place the package in local machine to install if you keep cannot get from NuGet.

Thanks for your suggestion, I will let our developer know it and see whether have a plan to enhancement CAD layer.

Regards,

Don

Hi Don,

I got the version 10 libraries installed and working, but not tested the serialization issue.

One thing that I mentioned before about the target of an invocation error remains. To my surprise, the files that fail with this error in version 9 do not fail with the version 10 libraries.

Can you check your audit trail for CadFeatureLayer and tell me if a version of the 9 libraries was updated since version 9.0.632.0? If so, I would like to get that update.

Thanks,
Damian

Hi Damian,

The latest change in V9 for CadFeatureLayer and CadFeatureSource is before the version 9.0.632.0.

If upgrdae to the V10 can solved your issue, we suggest you upgrade that, because if you found issue in V10, that can be solved easier.

Regards,

Don

Hi Don,

Thanks for checking.

I agree I want to change to 10. Hope to be in a good position to do that soon.

Regards,
Damian

Hi Damian,

If you met any question when upgrade v10 please let us know.

You can find the guide for upgrade in our wiki page.

Regards,

Don