Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Topology clean .net

8 REPLIES 8
Reply
Message 1 of 9
zrobert
772 Views, 8 Replies

Topology clean .net

Hello. I have problem with TopologyClean.Init(action, IdCollection). If I use ObjectIdCollection, or if I use null, I have same result. "All" object are cleaning, not only this in my ObjectIdCollection (I can't anchor objects). What I doing wrong? Thanks.

Tags (3)
8 REPLIES 8
Message 2 of 9
Daniel.Du
in reply to: zrobert

Do you have a buildable sample project and necessory dataset to help us to reproduce your problem?



Daniel Du
Developer Technical Services
Autodesk Developer Network

Message 3 of 9
zrobert
in reply to: Daniel.Du

First of all thank you for your response.



Here is sample project with simple drawing for testing.

I want to clean for duplicate all line objects in layer "LINE-LAYER", but

all other lines in drawing must stay intact (anchored).



I have ObjectIdCollection of lines from "LINE-LAYER", Topology.Variable and
then go to cleaning.



using (var tc = new TopologyClean())

{

tc.Init(variable, ids);

tc.Start();

tc.GroupNext();



while (!tc.Completed)

{

tc.GroupFix();

tc.GroupNext();

}



tc.End();

}

Result is that all line object in my test drawing was cleaned, not only
those in "ids".



Test drawing contain 16 lines, 8 of them are in "LINE-LAYER" which i want to
clean for duplicate.

I got valid SelectionSet and ObjectIsCollection of them and pass them to
"tc.Init(variable, ids)" .

But, all of duplicate lines, in all drawing layers are cleaned.



Thanks in front!



Best regards;

Robert Zrnc
Message 4 of 9
zrobert
in reply to: zrobert

Here is sample project and drawing.

Message 5 of 9
Daniel.Du
in reply to: zrobert

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

Message 6 of 9
zrobert
in reply to: Daniel.Du

Hi;



Thanks for answer!



Yes, this approach work the same through my testing.

But, I don't want to turn off layers in drawing manually.

What is the purpose of ObjectIdCollection ids passed to tc.Init(variable,
ids) if the program behaves just the same with only null value passed.

I thought that TopologyClean will be limited only to objects within ids. I
would like to clean only duplicate lines within the ids, and the other
duplicate lines stay untouched (without turning off layers).

Or the only way is programmatically turning off layers and after cleaning
turn them back on.
Message 7 of 9
Daniel.Du
in reply to: zrobert

No, I did not turn of layers then cleaning, I just turn off layers to verify the results.

 

Sorry for the misunderstanding. 



Daniel Du
Developer Technical Services
Autodesk Developer Network

Message 8 of 9
zrobert
in reply to: Daniel.Du

Thanks for the effort Mr Daniel.



When I run ma test program, result is that I have square with for lines in
different layers without any duplicates.

This means that they are cleaned "randomly". This was happen to me in Civil
2013, and Civil 2014.

Probably the problem is something else.area of twilight zone. 🙂

Now at least I know that my code is ok.



Again, thank you and best regards;



Robert
Message 9 of 9
Daniel.Du
in reply to: zrobert

You are welcome Robert, please let us know if there is anything we can help.



Daniel Du
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report