Collapse Segment or points

Hi all,

i'm importing autocad DWG Files, and try to clean up splines. It's very hard to get clean spline because, those lazzy Autocad drawers, are leaving twin splines with collapsed segment and points. As you can imagine you can't extrude this kind of stuff and you have to clean up point by point...

After looking for an existing script or similar fonction (im running max9), which i didnt find, i was wondering if the best way will be to script a fonction like :
"if you have two segment with exactely same coordonates, delete all except one of them."

I don't know anything about scripting, so im looking for some help to do it.

If some one can help me it will be fantastic.

My english is not very good, so i hope you'll understand it.