Remove duplicate lines issue

 - I'm exporting some GIS data out of my GIS and into an .AI export. It contains a roads data layer. When I do this the road centerlines as well as sides get exported and they are for the most part on top of each other. I need to be able to reduce the huge file size by eliminating the duplicates. In my lasing software there is a tool to remove overlapping lines and an offset that I can say within .1mm or whatever. Very useful. If I can do this in CorelDraw 2020 it would be much better as the file size will decrease dramatically. These are lines, not shapes. Illustrator does not do this and no plugins exist to remove them as far as I've found. Any ideas? Thanks in advance

Dean Forss

GIS Scientist - Cartographer

Parents
No Data
Reply
  • Hello Dear

    I have created code that can remove duplicates with same position, and same size.

    Please note, if there is any circle and a rectangle, with same size, and position, it will remove one of them.

    you may give it a try:

    Sub removeduplicate()

    ActiveDocument.ClearSelection

    Dim sn As Integer
    sn = ActiveLayer.Shapes.Count
    Dim x1#, x2#, y1#, y2#, w1#, w2#, h1#, h2#
    Dim sr As ShapeRange
    Set sr = ActiveDocument.CreateShapeRangeFromArray()

    For i = 1 To sn
    ActiveLayer.Shapes(i).GetPosition x1, y1
    ActiveLayer.Shapes(i).GetSize w1, h1
    For j = i + 1 To sn
    ActiveLayer.Shapes(j).GetPosition x2, y2
    ActiveLayer.Shapes(j).GetSize w2, h2
    If x1 = x2 And y1 = y2 And w1 = w2 And h1 = h2 Then
    ActiveLayer.Shapes(j).AddToSelection
    End If
    x2 = 0
    y2 = 0
    w2 = 0
    h2 = 0
    Next j
    x1 = 0
    y1 = 0
    w1 = 0
    h1 = 0
    Next i
    ActiveSelectionRange.Delete
    End Sub

Children