Jump to content

Copy multiple text contents to nearest text (multiples)


Recommended Posts

mhupp

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

Link to post
Share on other sites
  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • Isaac26a

    9

  • mhupp

    5

  • ronjonp

    4

  • BIGAL

    3

Top Posters In This Topic

Popular Posts

You have many overlapping texts in many places so its better to overkill the duplicates. (defun c:Test ( / int sel ent get ins txt src tar srt) ;; Tharwat - 21.Nov.2021 ;; (and (setq int -1 se

Here is another way .. checks that there is something within a distance of 1.5 ( based on the sample drawing ). Should be fairly fast 🍻 (defun c:foo (/ a b c d el r s) ;; RJP » 2021-11-22 (con

Thanks Steven, finally finished my lisp and it's working, now does anyone have a better idea to improve it? ;;; By Isaac A. ;;; Select multiples texts and copy their content to nearest texts ;;; h

Posted Images

ronjonp
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
Link to post
Share on other sites
mhupp

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.

 

image.png.5ade21c1eb0ffb4fc1d7b93510920d74.png

Link to post
Share on other sites
ronjonp
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
  • Like 1
Link to post
Share on other sites
BIGAL

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.

Link to post
Share on other sites

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