Jump to content

# Copy multiple text contents to nearest text (multiples)

## Recommended Posts

@ronjonp correct me if am wrong.

Build a selection set

set a mini distance for t

depending on layer separate the selection set into 2 lists

one with the point and text

other with the point and entity

Sort each list by first elements x cord smallest to largest.

while their is a elements in list a

compare the first element to each element in list b stop if distance is less then 1.5 & change the text and remove it from list b.

(works left to right in drawing because of sort)

(usually only have to compare 1-5 items before meeting distance statement instead of checking whole list)

if nothing is withing 1.5 distance make a circle around text point on nomatch layer.

• Replies 24
• Created
• Last Reply

• 3

• 4

• 5

• 9

#### Posted Images

2 hours ago, mhupp said:

@ronjonp correct me if am wrong.

Build a selection set

set a mini distance for t

depending on layer separate the selection set into 2 lists

one with the point and text

other with the point and entity

Sort each list by first elements x cord smallest to largest.

while their is a elements in list a

compare the first element to each element in list b stop if distance is less then 1.5 & change the text and remove it from list b.

(works left to right in drawing because of sort)

(usually only have to compare 1-5 items before meeting distance statement instead of checking whole list)

if nothing is withing 1.5 distance make a circle around text point on nomatch layer.

Spot on  ... the speed boost comes from the pre-sorted x values and vl-some stepping out when it finds a match (which should be closer to the front of the list).

Edited by ronjonp
##### Share on other sites

Wouldn't it be possible to get the wrong text?  like it would pick up cat before dog because its to the left but still within the acceptable distance? Just trying to fig it out the pros and cons. like not to make the check distance too big or you might get errors.

##### Share on other sites

10 minutes ago, mhupp said:

Wouldn't it be possible to get the wrong text? ....

Yes. vl-sort to the closest distance is probably the most reliable.

That code was tailored to the sample drawing.

Edited by ronjonp
##### Share on other sites

Like the ronjonp answer it will depend on tolerance so maybe use the text ht * fuzz factor for the tolerance, I will do the search by polygon method interested as to how fast compared to the distance method. Have to go out now later today hopefully.

## 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.

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...