1. ## Transform Coordinates

Registered forum members do not see this ad.

Good day.

I need to transform a group of polygons in a local projection to a transverse mercator projection.

I can do the transformation in excel and planning to do it using Lisp.

Unfortunately, I have no idea on how to manipulate the coordinates of the polygons.

I need help.

I'm a newbie in Lisp and Autocad.

Thanks.

Nestor

2. What do you mean by "polygons"? Lightweightpolylines?

3. yes. Lightweightpolylines.

4. look at align command, you will need 2 source points in local projection and 2 destination points in transverse mercator projection.

5. i think the align command won't work. the accuracy requirement is very high.

all vertex must be converted/transformed to the transverse mercator using a specified algorithm.

i have the algorithm. i just dont have any idea on how to manipulate the polylines.

6. If the polylines only consist of straight linear segments only so you can transform each of the verticees and then redraw the polyline using the transformed verticees.
(If there are circular arcs, so transforme some points of the circumference and redraw ellipctical or circular arcs from the transformed points).
Regards and good luck
Jochen

7. Code:
```(defun c:poly()
(setq ps (entsel "Pick a polyline"))     ;Get a selection
(setq pl (car ps))                           ;find the polyline
(setq pll (entget pl))                       ;get it's entity list
(setq new nil)                                ;create a new list
(repeat (setq i (length pll))            ;Walk thru the list
(if (= 10 (car (nth (setq i (1- i)) pll)))    ;If found a node...
(progn
(setq x (cadr (nth i pll))                  ;extract the coords
)
(setq x (+ x 10))                          ;do anything with
(setq y (* 1.5 y))                         ;X and Y
(setq new (cons (list 10 x y) new)) ;and add them to the new
)
(setq new (cons (nth i pll) new))    ;If not a node, just add it
)
)
(entdel pl)                                         ;delete the polyline
(entmake new)                                  ;create a new one
)```

8. yes scj. the polylines are composed of straight linear segments only.

i want to make a lisp doing the following:

-- select the polylines
-- extract the coordinates of the vertices of the polyline
-- transform the coordinates into a transverse mercator projection
-- redraw the polyline using the transformed coordinates

unfortunately, i have no idea on how to do it.

nestor

9. big thanks fuccaro!

i will work on that.

thank you.

nestor

10. Registered forum members do not see this ad.

Nestor