Author Topic: LayerGroup  (Read 3321 times)

0 Members and 1 Guest are viewing this topic.

Glenn R

  • Guest
LayerGroup
« on: March 22, 2006, 06:37:27 PM »
G'day everyone,

I've been beating my head on this for a day or so now with no joy.

I am scanning the drawing and looking for new layers. The 'newness' of these layers depends on if my program has 'tagged' them before or not (ie if not then they are new).
As I go, I collect the layer objectids and all is good with the world.

I then display a notification icon in the drawing statusbar, informing whoever is driving, that they have new layers and would they like to review them.
So they hit the hyperlink in the bubble and up pops the layer manager.

Now, what I would like to do is create a LayerGroup and make it current so when the layer manager fires, all the user will see is the new layers.
Here is the function that creates the new group:

Code: [Select]
private bool CreateXrefLayerGroupFilter() {
if (_newXrefLayerGroup == null)
_newXrefLayerGroup = new LayerGroup();
else
         _newXrefLayerGroup.LayerIds.Clear();

          _newXrefLayerGroup.Name = "New Xref Layers since " + DateTime.Now.ToString();
foreach(ObjectId ltrId in _newXrefLayers)
_newXrefLayerGroup.LayerIds.Add(ltrId);

return true;

}

I believe this is correct. What I can NOT figure out how to do though, is add this LayerGroup into the drawing and make it current for when the layer manager fires.
This process is one suggested to me by Albert from Adesk in a newsgroup post from a while ago.

Any suggestions anyone?

Cheers,
Glenn.

Glenn R

  • Guest
Re: LayerGroup
« Reply #1 on: March 22, 2006, 06:58:45 PM »
I part solved (I think)...here's how to add the LayerGroup into the tree:

Code: [Select]
LayerFilterTree lft = _doc.Database.LayerFilters;
lft.Root.NestedFilters.Add(_newXrefLayerGroup);
using (DocumentLock docLocker = _doc.LockDocument())
_doc.Database.LayerFilters = lft;

Now to try and make it current.....................................