ThinkGeo.com    |     Documentation    |     Premium Support

How to exclude Cad Inner layers in CadFeatureLayer

All, The sample showcases displaying CAD files, how do I filter some CAD layers? doco link: https://wiki.thinkgeo.com/wiki/api/thinkgeo.mapsuite.layers.cadfeaturelayer?s[]=cadfeaturelayer

  • we can read them through CadFeatureLayer - GetInnerLayerNames()
  • have tried FeatureIdsToExclude to ask for some of them to not be drawn…

In case it is not clear, we are using v10 version of the samples and library packages…
Can you explain how do we exclude some of the inner layers from drawing to the canvas?

Hi Shailesh,

If you’d like to hide some CAD layers, you could set its IsVisible property to false.

cadFeatureLayer.IsVisible = false;

Thanks,
Leo

Hi Leo,
Thanks for the response…

But, that is different, since that would hide the entire CAD layer. A CAD file contains its own ‘Inner Layers’, that can be read through ‘GetInnerLayerNames’ function. I want to hide one of those internal to CAD…

thanks, Shailesh

Hi Shailesh,

There’s something wrong with FeatureIdsToExclude when when CadStylingType is EmbeddedStyling, I’ve fixed this issue in source code.

Could you upgrade ThinkGeo.MapSuite.Layers.Cad to 11.0.0-beta021 or above and give it a try? The new build will be available in one or two days.

Thanks,
Leo

Hi Liu, thanks for that… I cannot get it to work with your update as well… can you provide a working example?

  • what do you expect to be passed in to FeatureIdsToExclude ? is the same as names returned from ‘GetInnerLayerNames’ or something else?

Hi Shailesh,

Here’s a sample which can hide cad inner layer, you could try it by check ‘hide layer “WALLS”’.

DisplayCadFile.zip (317.2 KB)

hideFeaturesBelongToLayerName is the method you need.

Note: If you run into ‘The type initializer for ‘ThinkGeo.MapSuite.Layers.CadFeatureSource’ threw an exception.’, try to clean and rebuild this project several times, it would take several minutes to download the cad dependencies. Make sure the following folders are in your bin/debug folder before you run it.

image

Thanks,
Leo