cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

can any macro could be developed for selecting duplicated objects

Vaduga1
1-Visitor

can any macro could be developed for selecting duplicated objects

Hi Im a Qa person for illustrations in our concern.

Using duplicate command is useful and easier while working.

In some cases the illustrators duplicate the hole illustration.

Selecting one one object and deleting is difficult.

Can any macro could be developed for selecting duplicated objects alone.

It would be really helpfull..................

7 REPLIES 7
TimSharp
12-Amethyst
(To:Vaduga1)

Can you post up an example of a drawing with the duplicated items?

I am sorry brousing is restricted in my office, So I am unable to send an exaple.

I can explain u...

Draw a few seperate lines and ellipse.

select all

Press (Ctrl+D) Duplicate for three to four times.

thats it.

now the lines and ellipses are one above the other.

In a complicated illustration it is difficult find the duplicated elements and delete.

Due to this problem the file size increases. Thats y

Thanks & Regards

Vaduga

TimSharp
12-Amethyst
(To:Vaduga1)

I've thought about this one myself, but can't see how it would work. Trevor Hendricks once gave me the method for checking the extents of a drawing by querying every element and this is great, though on a big drawing it is very slow.

For what you need though, it would have to store the attributes of elements somewhere so it could check each new one against those stored to determine whether an item was duplicated. I've found that there isn't any kind of array or table function in the Isodraw Macro Language yet so I can't see how this could be done in a practical way.

I do some relatively simple comparisons by writing values to a text file and then querying it each time I'm looking for something, but it takes several seconds to run on a file with only a few hundred lines, so a big drawing might take minutes or longer to run through using this method.

This is a tricky one. We do some conversion to Flash based on our files and, for that reason, size really matters. Unfortunately, I haven't figured out a clean good solution.

Here is one rather messy possibility. It should work, but as Tim pointed out, it would take a while to run.

Here's the idea:

1) Loop through each element on the page.

2) As each element is passed you'd need to read in attributes.

For example, check if it is a line, elipse, circle,...

Say it is a line. Get the start point and the end point and perhaps line type.

3) Once you have these lines, cut the element out.

4) Select at one of the points.

5) If something is at the point, check if it matches the same attributes you saved.

6) If so, dump what you cut or delete what you have selected and paste back what you have on the clipboard.

7) Repeat a lot.

Obviously, there are flaws. First of all, it's a long macro. Second, not sure how well IsoDraw will do looping through elements with the high likelyhood that you delete some along the way. Third, that a long loop. Might take a while if you get a very complex page. On the otherhand, it should work.

I wondered about doing this myself but thought it might have problems in practice.

For example you could select a bezier curve by one of it's ends, but it might just as easily pick up the element adjoining it rather than a duplicate bezier. If it doesn't find a match then, you've lost the opportunity to find a duplicate as it will then move away. Also can you do a second select while it's still doing the main one?

The only other way I can think of is to store every required element and attribute as you go along and check each newly selected element against all those already processed. If it finds a match, then it can be deleted, and it wouldn't matter then in what order the elements had been drawn. But it would be sloooooow!

I think both approaches are valid, just depends on your need.

Your approach would be slower, but much more efficient. As you stated, you could actually get all duplicates.

My approach would be faster comparitively, but might not catch everything.

It's one of those situations where you'd have to pick the lesser evil for your purposes.

Vaduga1
1-Visitor
(To:Vaduga1)

Thanks Tim & Trevor,

I would try both of yours suggestions,

Some thing is better than nothing, I've got some idea after listening to you both.

Its really helpfull.

Announcements

Top Tags