Using code from http://www.la-solutions.co.uk/content/CONNECT/mvba/MVBA-ElementsIdentical.htm trying to implement duplicate element removal utility in VBA.
It seems to work for identical elements but there is inconsistent results when not using COMPAREOPT_IGNORE_LEVEL flag. It still deletes lines which are in different levels.
See attachment DGN and MVBA:
.Duplicates-levels.dgn
6521.deldup.mvba
Oto said:Using code from http://www.la-solutions.co.uk/content/CONNECT/mvba/MVBA-ElementsIdentical.htm
I've revised the function declaration on that page. I doubt that's the source of your problem, but it helps if I publish correct information!
Regards, Jon Summers LA Solutions
How sure you are about the flag constants? For me it seems removing COMPAREOPT_IGNORE_LEVEL doesn't work it still ignores level.
Barry Lothian said: that confirms my initial method of manually comparing the .X|.Y|.Z components of each StartPoint and EndPoint
Use the API!
Point3dEqualTolerance: Test if the x, y, and z components of two points or vectors are equal within tolerance. Tests are done independently using the absolute value of each component differences .
Point3dEqualTolerance
Hmm, it seems I missed that function in the help, thanks for pointing it out!
Hi Oto,
I have tested the code example from Jon and I could not detect any issue with ignoring levels
I have started with a minimized test case and the test included the following steps:
It is now important to keep in mind, that there are 3 different properties between these 2 lines:
different ID´sdifferent "Modified" propertydifferent level
Using now Jon´s code example to compare elements I get different results if I use these different flags:
Result that 2 elements are not identical with:Const COMPAREOPT_STANDARD_IGNORES = COMPAREOPT_IGNORE_IDS _Or COMPAREOPT_IGNORE_MODIFIED
and result that the 2 elements identical with:Const COMPAREOPT_STANDARD_IGNORES = COMPAREOPT_IGNORE_IDS _ Or COMPAREOPT_IGNORE_MODIFIED _ Or COMPAREOPT_IGNORE_LEVEL
Best regards,Artur
Could you test on my example DGN?
Can you provide a DGN file with Models for: GoodResults and BadResults; for anyone trying to help be 100% certain of the still unknown results you are experiencing? Unless we know what a Good patient and Bad patient (for you) looks like this is likely going to take longer than necessary towards helping to resolve your issue (or a bug).
Thank you,Bob
Should work equal to v8i Data cleanup. When ignore levels is off (Levels checkbox is on in Cleanup.ma), none of lines should be deleted in Duplicates-levels.dgn
Oto,
This was quite the undertaking, but in my test file (also attached) it works using the criteria I deem acceptable to consider identical.
It does not use the MDL code from Jon's article, it uses simple principles of sequentially checking element attributes and eventually comparing vertices.
It is designed to work ONLY with line elements, other element types would require a lot more coding which I don't have time for.PoorMansDeldup.mvbaDuplicates.dgn
I have tested with your example and from the test results it looks like the model ignore flag:COMPAREOPT_IGNORE_MODEL_DIFFSlet the elements be identical although they are not. If I removed this flag from COMPAREOPT_STANDARD_IGNORES the results were like expected, also the level ignore flag is working correct - like the results i received with my previous test.
This needs to be investigated in detail from our side, in the meantime I would like to ask you to test the same if you can confirm this behavior.
Best regards,
Artur
Artur Goldsweer said:it looks like the model ignore flag:COMPAREOPT_IGNORE_MODEL_DIFFSlet the elements be identical although they are not
Good work, Mr Holmes!
I have tested in C++ API with same results and filed Bug # 864071 to address this issue.Best regards,