anchor.diff: -(defun c:1() (DT:ExtarctManholeChainages))
  +(defun c:1() (DT:ExtractManholeChainages))
   (defun c:2 ( / old_error old_sysvars ent_name startPoint datum verticalExageration)
     ; SAVE SETTINGS
     (save_environment (list "osmode" "attdia" "attreq"))
  
positive.code:       (atof (nth 3 manholeData))
        (atof (nth 4 manholeData))
        (atof (nth 5 manholeData))
      )
    );END if
  )
  (defun DT:DrawManhole ( manholeData startPoint datum verticalExageration layFoul layStorm / pBase lay )
    (princ "\nmanholeData = ")(princ manholeData)
    (if (and manholeData datum startPoint)
      (if (= 'list (type manholeData))
        (if (= 8 (length manholeData))
          (if (or (= (substr (nth 1 manholeData) 1 1) "S") (= (substr (nth 1 manholeData) 1 1) "F") )
            (progn
              ; Find manhole position (chainage wise)
              (setq pBase (polar startPoint 0 (nth 0 manholeData)) )
  
              ; Select layer
              (cond
                ((= (substr (nth 1 manholeData) 1 1) "S") (setq lay layStorm) )
                ((= (substr (nth 1 manholeData) 1 1) "F") (setq lay layFoul) )
              );END cond
  
              (if lay
                (progn
                  ; Draw invert level box line and ILs
                  (cond
                    ((= (substr (nth 1 manholeData) 1 1) "S")
                      (DT:DrawStormInvertLevelBoxLine pBase lay)
                      (DT:WriteInvertLevels (polar pBase (* 1.5 pi) 45) lay (nth 2 manholeData) (nth 3 manholeData) (nth 4 manholeData) (nth 5 manholeData))
                      (DT:DrawVerticalAxis pBase (polar pBase (* 0.5 pi) 110) lay)
                      (DT:WriteVerticalAxisLabel (polar pBase (* 0.5 pi) 110.5) lay (nth 1 manholeData))
                      (DT:MarkInvertLevel pBase (DT:GetILFromManholeData manholeData) datum verticalExageration)
                    );END subcond
                    ((= (substr (nth 1 manholeData) 1 1) "F")
                      (DT:DrawFoulInvertLevelBoxLine pBase lay)
                      (DT:WriteInvertLevels (polar pBase (* 1.5 pi) 51) lay (nth 2 manholeData) (nth 3 manholeData) (nth 4 manholeData) (nth 5 manholeData))
                      (DT:DrawVerticalAxis pBase (polar pBase (* 0.5 pi) 110) lay)
                      (DT:WriteVerticalAxisLabel (polar pBase (* 0.5 pi) 110.5) lay (nth 1 manholeData))
                      (DT:MarkInvertLevel pBase (DT:GetILFromManholeData manholeData) datum verticalExageration)
                    );END subcond
                  );END cond
                );END progn
                (progn (princ "\nERROR @ DT:DrawManhole > impossible to choose layer")(princ))
              );END if
            );END progn
            (progn (princ "\nERROR @ DT:DrawManhole > manhole name doesn't start with \"S\" or \"F\"")(princ))
          );END if
          (progn (princ "\nERROR @ DT:DrawManhole > provided manholeData list has wrong number of items")(princ))
        );END if
        (progn (princ "\nERROR @ DT:DrawManhole > provided manholeData has wrong data type")(princ))
      );END if
      (progn (princ "\nERROR @ DT:DrawManhole > manholeData/datum/startPoint = nil")(princ))
    );END if
  )
  
negative.code: 
    (princ)
  
    ; v0.1 - 2017.01.25 - Function full restructuration
    ; v0.0 - 2016.08.08 - First issue
    ; Author: David Torralba
    ; Last revision: 2016.08.08
  )
  (defun DT:PK( VL_ent_name pt )
    (vlax-curve-getDistAtPoint VL_ent_name (vlax-curve-getClosestPointTo VL_ent_name pt))
  )
  (defun DT:GetManholeDatabaseForLongSection ( centrelineEnt_name
                                          /
                                          ss
                                          manholeDatabase manholeData manholeChainage manholeChainageList
                                          manholeDatabaseSorted manholeChainageListSorted
                                        )
    ; Returns a sorted list (by chainage) with the selected manhole data
    ;
    ; INPUT - Ask user to select manholes
    (setq
      ss (ssget '((0 . "INSERT")))
      manholeDatabase nil
    )
    (foreach a (ssnamex ss)
      (if (= 'ename (type (cadr a)))
        (progn
          (if (setq manholeData (DT:GetManholeDataForLongSection (cadr a)) )
            (progn
              (setq
                manholeDatabase (append manholeDatabase (list manholeData))
                manholeChainage (LM:rtos (car manholeData) 2 5)
              )
              ; OPERATION - Add zeros till have minimum 5 digits before dot "." to be able to sort them as strings later
              (cond
                ((= 1 (vl-string-search "." manholeChainage)) (setq manholeChainage (strcat "0000" manholeChainage)) )
                ((= 2 (vl-string-search "." manholeChainage)) (setq manholeChainage (strcat "000"  manholeChainage)) )
                ((= 3 (vl-string-search "." manholeChainage)) (setq manholeChainage (strcat "00"   manholeChainage)) )
                ((= 4 (vl-string-search "." manholeChainage)) (setq manholeChainage (strcat "0"    manholeChainage)) )
              );END cond
  
              ; OPERATION - Create list of chainages as strings
              (setq manholeChainageList (append manholeChainageList (list manholeChainage )) )
            );END progn
          );END if
        );END progn
  