Message 1 of 8

Not applicable
08-04-2015
02:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm looking for some help editing a lisp previously posted here; http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-can-i-change-the-justification-of...
Currently this LISP works perfectly except the chainage values are returned as meters. Ideally i'd like to change the code to display kilometers so 4100 becomes 4.100.
I have absolutely zero experience editing LISPs and would really appreciate any assistance to achieve this.
(defun c:CH1 (/) (vl-load-com) (defun _Line (p b o) (entmake (append '((0 . "line") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "C-CTRL_TICK") (100 . "AcDbLine") ) (list (cons 10 (polar p b o))) (list (cons 11 (polar p (+ b PI) o))) '((210 0.0 0.0 1.0)) ) ) ) (defun _text (p b o h c) ;;; pBe -<-- dont forget to mention the original author dude (entmake (append '((0 . "MTEXT") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (7 . "Standard Arial") (8 . "C-CTRL_TXT") (100 . "AcDbMText") ) (list (cons 10 (polar p (+ b PI) o)) ) (list (cons 40 h)) (list (cons 1 (strcat "KP " (if (setq ld (nth (strlen (rtos c 2 0)) '(x ""))) ld "") (rtos c 2 2)))) (list (cons 50 (+ b PI))) '((41 . 1.0) (71 . 4) (72 . 5) (210 0.0 0.0 1.0) (73 . 1) ) ) ) ) (defun _ang (p1 p2)(+ (angle p1 p2) (/ PI 2.0))) (setq dist (getdist "increment: ")) (setq offset (getdist "tick size: ")) (setq height (getdist "text height: ")) (setq to (getdist "text offset: ")) (setq ss (ssget) count 0 dist dist offset offset height height ) (repeat (sslength ss) (setq ent (ssname ss count) obj (vlax-ename->vla-object ent) chainage dist ) (_line (setq p (vlax-curve-getstartpoint obj)) (setq bearing (_ang p (vlax-curve-getPointAtDist obj (+ chainage 0.001)))) offset) (_text p bearing to height 0.0) (while (and (setq point1 (vlax-curve-getPointAtDist obj chainage)) (setq point2 (vlax-curve-getPointAtDist obj (+ chainage 0.001))) ) (setq bearing (+ (angle point1 point2) (/ PI 2.0))) (_line point1 bearing offset) (_text point1 bearing to height chainage) (setq chainage (+ chainage dist)) ) (setq count (1+ count)) ) )
Thanks
Solved! Go to Solution.