+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Forum Newbie
    Using
    AutoCAD 2006
    Join Date
    Jun 2008
    Posts
    9

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

    A sample lisp routine manipulating a polygon using a function will be a very very big help. Please please please help.

    I'm a newbie in Lisp and Autocad.

    Thanks.

    Nestor
    Last edited by Nestor; 24th Jun 2008 at 04:26 am.

  2. #2
    Senior Member kpblc's Avatar
    Using
    AutoCAD 2005
    Join Date
    May 2006
    Location
    Russia, St-Petersburg
    Posts
    357

    Default

    What do you mean by "polygons"? Lightweightpolylines?
    All I say is only my opinion.

  3. #3
    Forum Newbie
    Using
    AutoCAD 2006
    Join Date
    Jun 2008
    Posts
    9

    Default

    yes. Lightweightpolylines.

  4. #4
    Senior Member
    Using
    not applicable
    Join Date
    May 2007
    Posts
    126

    Default

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

  5. #5
    Forum Newbie
    Using
    AutoCAD 2006
    Join Date
    Jun 2008
    Posts
    9

    Default

    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. #6
    Senior Member
    Using
    AutoCAD 2008
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    281

    Default

    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. #7
    Super Moderator fuccaro's Avatar
    Discipline
    Mechanical
    fuccaro's Discipline Details
    Occupation
    Mechanical eng.
    Discipline
    Mechanical
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,577

    Default

    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
              y (caddr (nth i pll))
              )
            (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
      )
    It's nice to be nice, but sometimes is nicer to be evil!
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  8. #8
    Forum Newbie
    Using
    AutoCAD 2006
    Join Date
    Jun 2008
    Posts
    9

    Default

    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.

    help please.

    thanks in advance

    nestor

  9. #9
    Forum Newbie
    Using
    AutoCAD 2006
    Join Date
    Jun 2008
    Posts
    9

    Default

    big thanks fuccaro!

    i will work on that.

    thank you.

    nestor

  10. #10
    Super Moderator fuccaro's Avatar
    Discipline
    Mechanical
    fuccaro's Discipline Details
    Occupation
    Mechanical eng.
    Discipline
    Mechanical
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,577

    Default

    Registered forum members do not see this ad.

    Nestor
    Se? I can read your mind: I posted the answer 5 minutes before you asked
    Also you may wish to read this: http://www.cadtutor.net/forum/showthread.php?t=1390
    Welcome in the lisper's world!
    It's nice to be nice, but sometimes is nicer to be evil!
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

Similar Threads

  1. Transform?
    By cadfly in forum AutoCAD General
    Replies: 4
    Last Post: 24th Apr 2008, 07:26 pm
  2. Coordinates
    By Stil in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 6th Apr 2007, 09:47 am
  3. transform a Spline in a polyline.....
    By mfalcaof in forum AutoCAD General
    Replies: 3
    Last Post: 12th Jul 2006, 12:38 am
  4. coordinates
    By ADN78 in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 4th Oct 2005, 10:41 pm
  5. X,Y, and Z coordinates
    By Scot C. Perry in forum AutoCAD Beginners' Area
    Replies: 1
    Last Post: 14th Jul 2005, 03:51 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts