Jump to content
Developer Wiki and Function Reference Links ×

deleting duplicate objects


J. Miller

Recommended Posts

Hello,

I have a rather large dwg imported file that has multiple duplicates. Lines, arcs, polygons drawn over each other up to 6 times in some cases. Is there a way to dig through the file and delete the duplicates until only one object exists?

I have tried a few ways but seem to delete more than I really want to.

Thanks in Advance.

Jeff miller

Link to comment

My guess is that you will spend far more of your time writing and testing it than you would ever save in not buying it.

Here is the outline of what you would need to do:

Get a handle to the first object in the file and get it's type and location and "size". Get a handle to the second object. Get it's type and location and "size". Compare the two. If they are identical then delete the second object. If they don't match, then try the third, fourth, fifth, etc. until you reach the end of the objects list.

Then go back and start at the second object in the list and do it again. Repeat until you have tested every object in the file.

The "Size" of each object may include its class, layer, dimensions, angle, number of vertices, etc. depending on how closely you want them to match.

My guess is the code will run 200 to 400 lines. I write and debug about 20 lines an hour. So this should only take you 10 to 20 hours (if you already know how to code) to get something working.

Good Luck,

Pat

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...