Author Topic: Analysis - Align Text by Lee Mac  (Read 9476 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Analysis - Align Text by Lee Mac
« Reply #15 on: September 14, 2014, 07:10:58 AM »
did you sort it because the selection order? if so, how did you get the idea that Z is to be sorted?

Please see this post.

as i understand you sort lst list, couldn't you just redefine lst with the new sorted list?
Code: [Select]
(setq lst (mapcar '(lambda ( n ) (nth n lst)) (vl-sort-i ins '>))
couldn't you just
Code: [Select]
(setq lst (vl-sort-i ins '>))

No, I am using the list of z-values (ins variable) as a sorting index by which to sort the list of DXF data for each text entity (lst variable). Note that the vl-sort-i function does not return the supplied list of items sorted by the given sorting function, but rather a list of indexes giving the new positions of the items in the orginal list. This list of indexes is then used by the program to sort the items in the main list (lst).

This method is far more efficient, since the value by which the list of items is sorted (i.e. the z-value under our new coordinate system) does not need to be retrieved & calculated for each comparison within the sorting function.

AFWJLK2

  • Guest
Re: Analysis - Align Text by Lee Mac
« Reply #16 on: September 15, 2014, 08:20:20 AM »
Thank you,

Sorry I had a "DUH" moment there.
I appreciate the guidance.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Analysis - Align Text by Lee Mac
« Reply #17 on: September 15, 2014, 12:23:51 PM »
No worries!  :-)

Shay Gaghe

  • Newt
  • Posts: 89
Re: Analysis - Align Text by Lee Mac
« Reply #18 on: December 19, 2014, 08:27:37 PM »
HI LEE,

i cant see where in the program the text object actually get the coordinate system denied by "vec".

Code: [Select]
(foreach itm (cdr lst)
                (aligntext:puttextinsertion (setq bpt (mapcar '- bpt spf)) itm)

what bpt stand for? what mapcar has to do with spf?

Thanx
Shay