Thank you for the sample.
I tested it with your dwg it seems working fine for me. Here is what I did:
1. turn off all layers except LINE-LAYER, select an edge of the squre, I can see the selection contains 2 lines, so it contains duplicated lines.
2. Did the same thing with layer AAA, the lines on layer AAA is not duplicated, so I go ahead to copy it at the same position to make the lines are duplicated in layer AAA as well
3. run your sample with TopologyClean.Init with following object collection, it is supposed to only clean the layer LINE-LAYER:
ObjectIdCollection retVal = null;
var editor = Application.DocumentManager.MdiActiveDocument.Editor;
// TypedValue array to define the filter criteria.
var values = new TypedValue[2];
var objectValue = new TypedValue((int)DxfCode.Start, "LINE");
var layerValue = new TypedValue(
(int)DxfCode.LayerName,
"LINE-LAYER");
values.SetValue(objectValue, 0);
values.SetValue(layerValue, 1);
// Assign the filter criteria to a SelectionFilter object
var filter = new SelectionFilter(values);
4. After cleaning, I check the layer LINE-LAYER, it does be cleaned, no duplicated lines at same postion.
Check layer AAA, it is not affected, the duplicated lines are still there. That is an expected behavior for me.
Am I missing anythig to reproduce your problem?
Daniel Du
Developer Technical Services
Autodesk Developer Network