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

0 Members and 1 Guest are viewing this topic.

Shay Gaghe

  • Newt
  • Posts: 89
Analysis - Align Text by Lee Mac
« on: August 01, 2014, 05:37:10 PM »
Hi

im analyzing the code of Lee Mac http://lee-mac.com/aligntext.html,


 
Program start by calling to (ssget "_:L" '((0 . "TEXT"))) ,

by default  (ssget) select entities of all visible layers, also entities laying on locked layers. the prefix  “ _:L” is used in order to prevent it, otherwise the final result will be incorrect since entities on locked layers cant transform.

Inc gets the number of entities in the selection set

Enx gets the definition list of the last entity in the selection set

Spf gets a new point that is perpendicular to the angle of the text (dxf 50), its length is text height (dxf 40) multiplies  the factor.

now, im kind of stuck, spf is a new point which represents the "leading" of the text, what exactly happening here?

Quote
(setq inc (sslength sel)
                  enx (entget (ssname sel (1- inc)))
                  spf (polar '(0.0 0.0) (+ (cdr (assoc 50 enx)) (/ pi 2.0)) (* (cdr (assoc 40 enx)) spf))
                  vec (trans spf (trans '(0.0 0.0 1.0) 1 0 t) 0)
            )



Quote
;;--------------------=={ Align Text }==----------------------;;
;;                                                            ;;
;;  This program enables the user to reposition a selection   ;;
;;  of text objects equispaced by a factor of the text height ;;
;;  and aligned in a direction perpendicular to the rotation  ;;
;;  angle of the text.                                        ;;
;;                                                            ;;
;;  The program assumes all text objects in the selection     ;;
;;  have the same rotation and will align each text object    ;;
;;  using its Text Alignment Point.                           ;;
;;                                                            ;;
;;  The program will perform successfully with text           ;;
;;  constructed in any UCS plane.                             ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2013 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Version 1.3    -    23-04-2013                            ;;
;;------------------------------------------------------------;;

(defun c:at ( / *error* bpt enx inc ins lst sel spf vec )

    (setq spf 1.5) ;; Line Spacing Factor

    (defun *error* ( msg )
        (LM:endundo (LM:acdoc))
        (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
            (princ (strcat "\nError: " msg))
        )
        (princ)
    )

    (if (setq sel (ssget "_:L" '((0 . "TEXT"))))
        (progn
            (setq inc (sslength sel)
                  enx (entget (ssname sel (1- inc)))
                  spf (polar '(0.0 0.0) (+ (cdr (assoc 50 enx)) (/ pi 2.0)) (* (cdr (assoc 40 enx)) spf))
                  vec (trans spf (trans '(0.0 0.0 1.0) 1 0 t) 0)
            )
            (repeat inc
                (setq lst (cons (entget (ssname sel (setq inc (1- inc)))) lst)
                      ins (cons (caddr (trans (aligntext:gettextinsertion (car lst)) (cdr (assoc -1 (car lst))) vec)) ins)
                )
            )
            (setq lst (mapcar '(lambda ( n ) (nth n lst)) (vl-sort-i ins '>))
                  bpt (aligntext:gettextinsertion (car lst))
            )
            (LM:startundo (LM:acdoc))
            (foreach itm (cdr lst)
                (aligntext:puttextinsertion (setq bpt (mapcar '- bpt spf)) itm)
            )
            (LM:endundo (LM:acdoc))
        )
    )
    (princ)
)

(defun aligntext:getdxfkey ( enx )
    (if
        (and
            (zerop (cdr (assoc 72 enx)))
            (zerop (cdr (assoc 73 enx)))
        )
        10 11
    )
)

(defun aligntext:gettextinsertion ( enx )
    (cdr (assoc (aligntext:getdxfkey enx) enx))
)

(defun aligntext:puttextinsertion ( ins enx )
    (   (lambda ( key )
            (if (entmod (subst (cons key ins) (assoc key enx) enx))
                (entupd (cdr (assoc -1 enx)))
            )
        )
        (aligntext:getdxfkey enx)
    )
)

;; Start Undo  -  Lee Mac
;; Opens an Undo Group.

(defun LM:startundo ( doc )
    (LM:endundo doc)
    (vla-startundomark doc)
)

;; End Undo  -  Lee Mac
;; Closes an Undo Group.

(defun LM:endundo ( doc )
    (while (= 8 (logand 8 (getvar 'undoctl)))
        (vla-endundomark doc)
    )
)

;; Active Document  -  Lee Mac
;; Returns the VLA Active Document Object

(defun LM:acdoc nil
    (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
    (LM:acdoc)
)

(vl-load-com) (princ)

;;------------------------------------------------------------;;
;;                         End of File                        ;;
;;------------------------------------------------------------;;
« Last Edit: August 02, 2014, 10:57:46 AM by CAB »

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Analysis - Align Text by Lee Mac
« Reply #1 on: August 02, 2014, 10:43:11 AM »
At the top of the code, the variable spf is initially defined as the line spacing factor - a numerical value to be multiplied by the text height to give the distance between each successive aligned text objects.

The program first prompts the user for a selection of text objects to align (assigned to the variable sel), and then retrieves the DXF data (enx) for the last entity in this selection (the use of the last text entity is arbitrary).

The variable spf is then redefined as a vector with direction perpendicular to the angle of the last text entity in the selection, and magnitude equal to the line spacing factor multiplied by the text height of the last text entity. Note that this vector is defined in the active UCS plane.

The variable vec is then the WCS representation of the newly defined line spacing vector (spf); this is obtained by transforming the spf vector from the coordinate system defined by the normal vector to the UCS plane [this normal vector is obtained using the expression: (trans '(0.0 0.0 1.0) 1 0 t)] to WCS (trans argument 0).

The variable vec will be used to defined a coordinate system wherein the normal vector is perpendicular to the angle of the text (i.e. the WCS representation of the spf vector).

The program then iterates over the main selection (variable sel), and constructs two lists: a list of the DXF data for all text entities in the selection (variable lst), and a list of the z-coordinate values of the text insertion points after translation to the coordinate system defined by the vector vec - this will be used as a sorting index (variable ins).

The list of text entity DXF data (lst) is then sorted based on the sort order of the ins list which has been sorted by decreasing z-value. The program then obtains the OCS coordinates of the first text entity in this sorted list to be used as the base point for the alignment.

Finally, the program iterates over the remaining items in the sorted list of DXF data, modifying the text insertion point of each text object to a point given by the previous text insertion point spaced by the spf vector - note that this assumes that the active UCS plane is parallel to the OCS plane of the selected text.

Shay Gaghe

  • Newt
  • Posts: 89
Re: Analysis - Align Text by Lee Mac
« Reply #2 on: August 05, 2014, 12:15:38 PM »
At the top of the code, the variable spf is initially defined as the line spacing factor - a numerical value to be multiplied by the text height to give the distance between each successive aligned text objects.

The program first prompts the user for a selection of text objects to align (assigned to the variable sel), and then retrieves the DXF data (enx) for the last entity in this selection (the use of the last text entity is arbitrary).

The variable spf is then redefined as a vector with direction perpendicular to the angle of the last text entity in the selection, and magnitude equal to the line spacing factor multiplied by the text height of the last text entity. Note that this vector is defined in the active UCS plane.

The variable vec is then the WCS representation of the newly defined line spacing vector (spf); this is obtained by transforming the spf vector from the coordinate system defined by the normal vector to the UCS plane [this normal vector is obtained using the expression: (trans '(0.0 0.0 1.0) 1 0 t)] to WCS (trans argument 0).

The variable vec will be used to defined a coordinate system wherein the normal vector is perpendicular to the angle of the text (i.e. the WCS representation of the spf vector).

The program then iterates over the main selection (variable sel), and constructs two lists: a list of the DXF data for all text entities in the selection (variable lst), and a list of the z-coordinate values of the text insertion points after translation to the coordinate system defined by the vector vec - this will be used as a sorting index (variable ins).

The list of text entity DXF data (lst) is then sorted based on the sort order of the ins list which has been sorted by decreasing z-value. The program then obtains the OCS coordinates of the first text entity in this sorted list to be used as the base point for the alignment.

Finally, the program iterates over the remaining items in the sorted list of DXF data, modifying the text insertion point of each text object to a point given by the previous text insertion point spaced by the spf vector - note that this assumes that the active UCS plane is parallel to the OCS plane of the selected text.

Hi Lee

as i understand, (trans) is tracking the vector generated between the Wcs and Ucs, and then offsetting the resulting point respectively. in this way the point is always located at the same place. correct?


about the nested trans,

Code: [Select]
(trans spf (trans '(0.0 0.0 1.0) 1 0 t) 0)

(trans vector '(0.0 0.0 1.0) from UCS to WCS return 0.0 0.0 -1.0, transforming spf from 0.0 0.0 -1.0 to WCS gives the WCS representation of  spf, great, but why? what is the logic behind?

Thanks
Shay

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Analysis - Align Text by Lee Mac
« Reply #3 on: August 05, 2014, 03:03:20 PM »
as i understand, (trans) is tracking the vector generated between the Wcs and Ucs, and then offsetting the resulting point respectively. in this way the point is always located at the same place. correct?

I'm not entirely sure what you mean by 'tracking' & 'offsetting', but the trans function is transforming the supplied point / vector from one coordinate system to another. This is equivalent to applying a matrix composed of the orthogonal unit vectors defining the coordinate system to the point / vector, and then translating the point by the displacement of the origin between the two coordinate systems.

Here is an example with code to demonstrate these operations:

Let's say a UCS is defined with the following axis vectors (I have retained the origin of 0,0,0 for convenience):
Code - Auto/Visual Lisp: [Select]
  1. _$ (setq xv (getvar 'ucsxdir))
  2. (0.810921 0.405103 -0.422254)
  3. _$ (setq zv (trans '(0.0 0.0 1.0) 1 0 t))
  4. (0.559193 -0.323931 0.763133)
  5. _$ (setq yv (v^v zv xv))
  6. (-0.172367 0.854962 0.489213)
  7. _$ (trans '(0.0 0.0 0.0) 1 0)
  8. (0.0 0.0 0.0)
(v^v is the vector cross product)

Now, to transform the point '(1.2 5.3 4.7) from WCS to this UCS, we could use trans with 0 & 1 arguments respectively:
Code - Auto/Visual Lisp: [Select]
  1. _$ (trans '(1.2 5.3 4.7) 0 1)
  2. (1.13556 6.62376 2.54092)

But, we could also perform this transformation 'manually' by applying the appropriate matrix:
Code - Auto/Visual Lisp: [Select]
  1. _$ (mxv (list xv yv zv) '(1.2 5.3 4.7))
  2. (1.13556 6.62376 2.54092)
(mxv is a function to apply a matrix to a vector)

The above is performing the following matrix operation:
Code: [Select]
( 0.810921  0.405103 -0.422254 )   ( 1.2 )   ( 0.810921  0.405103 -0.422254 )·( 1.2 5.3 4.7 )   (( 0.810921 x 1.2) + ( 0.405103 x 5.3) + (-0.422254 x 4.7))
(-0.172367  0.854962  0.489213 ) x ( 5.3 ) = (-0.172367  0.854962  0.489213 )·( 1.2 5.3 4.7 ) = ((-0.172367 x 1.2) + ( 0.854962 x 5.3) + ( 0.489213 x 4.7))
( 0.559193 -0.323931  0.763133 )   ( 4.7 )   ( 0.559193 -0.323931  0.763133 )·( 1.2 5.3 4.7 )   (( 0.559193 x 1.2) + (-0.323931 x 5.3) + ( 0.763133 x 4.7))
(Where · represents the vector dot product)

about the nested trans,
Code: [Select]
(trans spf (trans '(0.0 0.0 1.0) 1 0 t) 0)
(trans vector '(0.0 0.0 1.0) from UCS to WCS return 0.0 0.0 -1.0

Not necessarily...
The expression (trans '(0.0 0.0 1.0) 1 0 t) could return any 3D unit vector (take the above example for instance) - this vector is the normal vector to the UCS plane.
« Last Edit: August 09, 2014, 10:22:11 AM by Lee Mac »

Shay Gaghe

  • Newt
  • Posts: 89
Re: Analysis - Align Text by Lee Mac
« Reply #4 on: August 06, 2014, 02:43:58 PM »

The variable spf is then redefined as a vector with direction perpendicular to the angle of the last text entity in the selection, and magnitude equal to the line spacing factor multiplied by the text height of the last text entity. Note that this vector is defined in the active UCS plane.

The variable vec is then the WCS representation of the newly defined line spacing vector (spf); this is obtained by transforming the spf vector from the coordinate system defined by the normal vector to the UCS plane [this normal vector is obtained using the expression: (trans '(0.0 0.0 1.0) 1 0 t)] to WCS (trans argument 0).

The variable vec will be used to defined a coordinate system wherein the normal vector is perpendicular to the angle of the text (i.e. the WCS representation of the spf vector).

The program then iterates over the main selection (variable sel), and constructs two lists: a list of the DXF data for all text entities in the selection (variable lst), and a list of the z-coordinate values of the text insertion points after translation to the coordinate system defined by the vector vec - this will be used as a sorting index (variable ins).


After getting the user input and constructing a selection set, the program defines a vector called spf , origin from UCS 0,0,0 and has its direction perpendicular to the text angle. 
The length is the same as the text high +predefined spacing factor.

Variable vec, is the anchor of spf in the WCS, it has the same location and the same angle.

Than the z axis of the entity insertion point is translated from OCS   to the coordinate system defined by vec , that’s because  z axis is ruling x and y properties?

as I understand the OCS of the entity is totally orthographic, by translating the OCS to vec, we are actually  defining the former WCS 0,0,0 to the location of the insertion point, and the orthographic angle to this defined by vec

am I right so far or am i talking no sense?

Shay Gaghe

  • Newt
  • Posts: 89
Re: Analysis - Align Text by Lee Mac
« Reply #5 on: August 08, 2014, 01:19:39 AM »
OK...i take my unattractive attachment as a brain displacment  :police: , sorry for that :lmao:

please let me  ask specific questions,

Code: [Select]
(trans spf (trans '(0.0 0.0 1.0) 1 0 t) 0)
as LEE explain, this code translating UCS to its cooriponding WCS,
spf is the vector, it being translated from translating from   ______ vector to WCS
1._______ is something that i cant figure out, please help!
2.why the program needs WCS equivlent?


The list of text entity DXF data (lst) is then sorted based on the sort order of the ins list which has been sorted by decreasing z-value. The program then obtains the OCS coordinates of the first text entity in this sorted list to be used as the base point for the alignment.


1. why the program gets only the Z coordinates rather the whole OCS?
2.why Z is being sorted?

Thanks a lot to the repliers
Shay

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Analysis - Align Text by Lee Mac
« Reply #6 on: August 08, 2014, 04:13:18 AM »
Read about the 'Arbitrary Axis Algorithm' in the DXF documentation first. I think that will answer a lot of your questions.

Shay Gaghe

  • Newt
  • Posts: 89
Re: Analysis - Align Text by Lee Mac
« Reply #7 on: August 09, 2014, 08:34:35 AM »
Read about the 'Arbitrary Axis Algorithm' in the DXF documentation first. I think that will answer a lot of your questions.

ok.. the document say like this :

Quote
The arbitrary axis algorithm is used by AutoCAD internally to implement the arbitrary but consistent generation of object coordinate systems for all entities that use object coordinates.

what they mean arbitery? randomly? and it can be connsistent?

Quote
Given a unit-length vector to be used as the Z axis of a coordinate system, the arbitrary axis algorithm generates a corresponding X axis for the coordinate system. The Y axis follows by application of the right-hand rule.

as i understand, the algorithem get as an input the Z axie, and generate corrispond xand y , is that right?

Quote
The method is to examine the given Z axis (also called the normal vector). If it is close to the positive or negative world Z axis, cross the world Y axis with the given Z axis to arrive at the arbitrary X axis. If it is not close, cross the world Z axis with the given Z axis to arrive at the arbitrary X axis. The boundary at which the decision is made was chosen to be both inexpensive to calculate and completely portable across machines. This is achieved by having a sort of “square” polar cap, the bounds of which are 1/64, which is precisely specifiable in six decimal-fraction digits and in six binary-fraction bits.


this is too far...what is 64/1?

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Analysis - Align Text by Lee Mac
« Reply #8 on: August 09, 2014, 09:16:22 AM »
The variable vec will be used to defined a coordinate system wherein the normal vector is perpendicular to the angle of the text (i.e. the WCS representation of the spf vector).

Variable vec, is the anchor of spf in the WCS, it has the same location and the same angle.

Than the z axis of the entity insertion point is translated from OCS to the coordinate system defined by vec, that’s because z axis is ruling x and y properties?

Below is a more accurate diagram to visualise the coordinate system constructed for sorting the selected text objects:



As for your other questions:

this code translating UCS to its cooriponding WCS,
spf is the vector, it being translated from translating from   ______ vector to WCS
1._______ is something that i cant figure out, please help!

The expression: (trans '(0.0 0.0 1.0) 1 0 t) constitutes the 'from' argument for the trans function. This expression returns the normal vector of the UCS plane - the trans function will then use the Arbitrary Axis Algorithm to construct a coordinate system from this normal vector to use for the transformation.

2.why the program needs WCS equivlent?

Because the trans function expects an extrusion vector argument to be expressed relative to WCS.

1. why the program gets only the Z coordinates rather the whole OCS?

Note that the program is not retrieving the Z-coordinate of the insertion point expressed in the OCS of the text object, but rather the program uses the Z-coordinate of the insertion point expressed relative to the coordinate system defined by the normal vector 'vec' as shown in my diagram above.

2.why Z is being sorted?

Because in the coordinate system defined by the normal vector 'vec', each line of text resides at a different elevation.

Quote
The arbitrary axis algorithm is used by AutoCAD internally to implement the arbitrary but consistent generation of object coordinate systems for all entities that use object coordinates.

what they mean arbitery? randomly? and it can be connsistent?

Arbitrary does not imply random - the only requirement is that the same values are used for every calculation of the coordinate system such that the result is always consistent. However, there is nothing 'special' about these values, therefore, they are arbitrary values.

The parameters used within the Arbitrary Axis Algorithm could be any values, providing the values are used consistently such that the same results are always obtained for a given input.

Quote
Given a unit-length vector to be used as the Z axis of a coordinate system, the arbitrary axis algorithm generates a corresponding X axis for the coordinate system. The Y axis follows by application of the right-hand rule.

as i understand, the algorithem get as an input the Z axie, and generate corresponding x and y, is that right?

Correct - three points (or two vectors) are strictly required to define a coordinate system, with the third axis calculated using the vector cross product such that it is perpendicular to the other two.

The Arbitrary Axis Algorithm provides a means to construct a coordinate system from only one extrusion/normal vector (halving the data storage requirements); this coordinate system is not strictly defined by the supplied extrusion vector (in this sense it is arbitrary), however, given the same extrusion vector, the Arbitrary Axis Algorithm will construct the same coordinate system, which is all that matters as far as restoring the original data.

Quote
The method is to examine the given Z axis (also called the normal vector). If it is close to the positive or negative world Z axis, cross the world Y axis with the given Z axis to arrive at the arbitrary X axis. If it is not close, cross the world Z axis with the given Z axis to arrive at the arbitrary X axis. The boundary at which the decision is made was chosen to be both inexpensive to calculate and completely portable across machines. This is achieved by having a sort of “square” polar cap, the bounds of which are 1/64, which is precisely specifiable in six decimal-fraction digits and in six binary-fraction bits.


this is too far...what is 64/1?

1/64 is the arbitrary element of the Arbitrary Axis Algorithm - this could be any value, providing the same value is always used.

reltro

  • Guest
Re: Analysis - Align Text by Lee Mac
« Reply #9 on: August 10, 2014, 12:37:10 PM »
Hey...
This may help...

This is the 'Arbitrary Axis Algorithm' in use to place a BlockReference aligned on three Points in 3D-Space...
http://www.theswamp.org/index.php?topic=37429.msg522021#msg522021

greets Reltro

Shay Gaghe

  • Newt
  • Posts: 89
Re: Analysis - Align Text by Lee Mac
« Reply #10 on: August 11, 2014, 11:10:23 PM »
Hi Lee

Thanks you for your outstanding desire to help others and taking the time to explain, appriciate that.

Quote

The expression: (trans '(0.0 0.0 1.0) 1 0 t) constitutes the 'from' argument for the trans function. This expression returns the normal vector of the UCS plane - the trans function will then use the Arbitrary Axis Algorithm to construct a coordinate system from this normal vector to use for the transformation.


why not just (trans spf 1 0) aka translate spf from ucs to Wcs?

Hey...
This may help...

This is the 'Arbitrary Axis Algorithm' in use to place a BlockReference aligned on three Points in 3D-Space...
http://www.theswamp.org/index.php?topic=37429.msg522021#msg522021

greets Reltro

thanks Relto, ill get into this

Thanks
Shay
« Last Edit: August 11, 2014, 11:22:29 PM by Shay Gaghe »

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Analysis - Align Text by Lee Mac
« Reply #11 on: August 12, 2014, 02:43:45 PM »
Thanks you for your outstanding desire to help others and taking the time to explain, appriciate that.

You're welcome Shay - I hope my explanation was clear.

Quote
The expression: (trans '(0.0 0.0 1.0) 1 0 t) constitutes the 'from' argument for the trans function. This expression returns the normal vector of the UCS plane - the trans function will then use the Arbitrary Axis Algorithm to construct a coordinate system from this normal vector to use for the transformation.

why not just (trans spf 1 0) aka translate spf from ucs to Wcs?

Because the vector spf is expressed relative to the OCS & rotation of the text object, and hence I don't want the transformation to account for the UCS origin & rotation.

AFWJLK2

  • Guest
Re: Analysis - Align Text by Lee Mac
« Reply #12 on: September 12, 2014, 02:49:34 PM »
Hello Lee,

I cannot get this lsp to work at all.
It will not select anything.

Select objects: 0 found
Select objects: Specify opposite corner: 0 found, 0 total
Select objects: Specify opposite corner: 0 found, 0 total

Little help please?

Thank you
« Last Edit: September 12, 2014, 02:53:59 PM by AFWJLK2 »

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Analysis - Align Text by Lee Mac
« Reply #13 on: September 13, 2014, 09:18:26 AM »
As noted in the program description, the program will permit the user to select & align single-line text (i.e. DTEXT).

What objects are you attempting to select?

Lee

Shay Gaghe

  • Newt
  • Posts: 89
Re: Analysis - Align Text by Lee Mac
« Reply #14 on: September 13, 2014, 10:33:36 PM »
At the top of the code, the variable spf is initially defined as the line spacing factor - a numerical value to be multiplied by the text height to give the distance between each successive aligned text objects.

The program first prompts the user for a selection of text objects to align (assigned to the variable sel), and then retrieves the DXF data (enx) for the last entity in this selection (the use of the last text entity is arbitrary).

The variable spf is then redefined as a vector with direction perpendicular to the angle of the last text entity in the selection, and magnitude equal to the line spacing factor multiplied by the text height of the last text entity. Note that this vector is defined in the active UCS plane.

The variable vec is then the WCS representation of the newly defined line spacing vector (spf); this is obtained by transforming the spf vector from the coordinate system defined by the normal vector to the UCS plane [this normal vector is obtained using the expression: (trans '(0.0 0.0 1.0) 1 0 t)] to WCS (trans argument 0).

The variable vec will be used to defined a coordinate system wherein the normal vector is perpendicular to the angle of the text (i.e. the WCS representation of the spf vector).

The program then iterates over the main selection (variable sel), and constructs two lists: a list of the DXF data for all text entities in the selection (variable lst), and a list of the z-coordinate values of the text insertion points after translation to the coordinate system defined by the vector vec - this will be used as a sorting index (variable ins).

The list of text entity DXF data (lst) is then sorted based on the sort order of the ins list which has been sorted by decreasing z-value. The program then obtains the OCS coordinates of the first text entity in this sorted list to be used as the base point for the alignment.


Finally, the program iterates over the remaining items in the sorted list of DXF data, modifying the text insertion point of each text object to a point given by the previous text insertion point spaced by the spf vector - note that this assumes that the active UCS plane is parallel to the OCS plane of the selected text.



Hi Lee

did you sort it because the selection order? if so, how did you get the idea that Z is to be sorted?

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 '>))
or am i missing something?

Shay
« Last Edit: September 13, 2014, 10:36:49 PM by Shay Gaghe »