+ Reply to Thread
Results 1 to 4 of 4

Thread: Select Dupliactes (sorted)

  1. #1

    Select Dupliactes (sorted)

    Hi guys,

    Everyone knows the command "SelDup". It selects all dupliate geometry at once.

    In Python Script I would like to compare a (few thousand) polylines for duplicates and would like to know how many duplicates there are of each type.

    I would like to know if there is one duplicate curve at a position, or if it exists more than once at the exact same position.

    I think I would need the not yet implemented "Compare Geometry" function to do that, but maybe someone has another solution.

    Thanks
    - Martin

  2. #2
    I did something like that by using a tuple (startpoint, endpoint) as items in a set.
    http://docs.python.org/library/stdtypes.html#set

    then it is easy to check the set if a given tuple already exists.

    you can improve this by :
    • use a dictionary instead of a set to remember the id of your polyline. Key = tuple , value=guid
    • rounding the floats( X,Y,Z) to your desired tolerance. Or converting the floats to integers (however if one position is 0.499999 and the other 0. 500000001 they will round to different values and not be considered by your tolerance)
    • create a tuple from all points of your polyline.( not just start and end)
    • use the sorted function on the tuples of points first to ignore the orientation of your lines

    does this help you?
    Last edited by Goswin; 09-03-2012 at 02:16 PM.

  3. #3
    Hi Goswin,

    That should work. It will probably take some time to calcualte - but then again not long enough to worry about it.

    Thanks-
    Martin

  4. #4
    try: objectdup = rs.command('_seldup')
    i guess this will be a little quicker. lol
    slightly i come, slightly i gone.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts