Author Topic: Station and offset lisp (HELP)  (Read 8023 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Station and offset lisp (HELP)
« Reply #15 on: March 15, 2014, 10:39:37 AM »
It's past my bedtime so I'll post this assuming my previous post assumptions are correct

I have noted the 2 lines of code revised.
Code - Auto/Visual Lisp: [Select]
  1. (defun AT:ToStation (val / foo)
  2.   ;; Convert number, number string, station string to valid station string
  3.   ;; val - value to convert
  4.   ;; Alan J. Thompson, 11.01.10
  5.   (defun foo (s)
  6.     (cond
  7.       ((not (vl-remove-if '(lambda (x) (vl-position x '(43 46)))
  8.                           (vl-string->list s)
  9.             )
  10.        )
  11.        nil
  12.       )
  13.       ((wcmatch s "#+*,+*") (foo (strcat "0" s)))
  14.       ((wcmatch s "*+,*+0") (foo (strcat s "0")))
  15.       ((not (vl-string-search "." s)) (foo (strcat s ".00")))
  16.       ((< (vl-string-search "." s) 2) (foo (strcat "0" s)))
  17.       ((< (- (strlen s) (vl-string-search "." s)) 3) (foo (strcat s "0")))
  18.       ((not (vl-string-search "+" s))
  19.        (foo
  20.          ((lambda (i l)
  21.             (vl-list->string
  22.               (apply
  23.                 (function append)
  24.                 (mapcar
  25.                   (function (lambda (x)
  26.                               ;; rev kdub: (if (eq 2 (- (vl-position 46 l) (setq i (1+ i))))
  27.                               ;; rev kdub: to display "01+000.00"
  28.                               (if (eq 3 (- (vl-position 46 l) (setq i (1+ i))))
  29.                                 (list 43 x)
  30.                                 (list x)
  31.                               )
  32.                             )
  33.                   )
  34.                   l
  35.                 )
  36.               )
  37.             )
  38.           )
  39.            -1
  40.            (vl-string->list s)
  41.          )
  42.        )
  43.       )
  44.       ;; rev kdub: ((vl-some '(lambda (c) (wcmatch s c)) '("~*##+##`.##*" "*+*+*" "*`.*`.*")) nil)
  45.       ;; rev kdub: to display "01+000.00"
  46.       ((vl-some '(lambda (c) (wcmatch s c))
  47.                 '("~*##+###`.##*" "*+*+*" "*`.*`.*")
  48.        )
  49.        nil
  50.       )
  51.       (s)
  52.     )
  53.   )
  54.   (foo (vl-princ-to-string val))
  55. )
  56.  
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

pedroantonio

  • Guest
Re: Station and offset lisp (HELP)
« Reply #16 on: March 15, 2014, 11:51:15 AM »
Thank you Karry . If  you can i need three more things

- Make  3 layers ,SF_text, SF_line,SF_points
- TEXT is the midle of the offset length
- give Text size one time when lisp start
- Add two red points to th offset line

Look the new attach file


Thanks

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Station and offset lisp (HELP)
« Reply #17 on: March 15, 2014, 12:22:43 PM »
pedro,

Although you claim ignorance when it comes to knowing LISP, what you are looking to add are fairly simple tasks.  You NEED to attempt these modifications on your own, once you have some code written by you completed, you can always post any questions you may have. 

Also spoon feeding update request is at least for me getting very old.

pedroantonio

  • Guest
Re: Station and offset lisp (HELP)
« Reply #18 on: March 15, 2014, 02:27:45 PM »
I add the two layers.I don't know other commands

Code - Auto/Visual Lisp: [Select]
  1. (defun c:SF (/ AT:GetSel AT:MText AT:ToStation AT:Sta2Num AT:AngleAtPoint _getstring e s p o)
  2.   ;; Find and label station along alignment (with option to perform offset)
  3.   ;; Alan J. Thompson, 11.04.10
  4.  
  5.  
  6.   (defun AT:GetSel (meth msg fnc / ent)
  7.     ;; meth - selection method (entsel, nentsel, nentselp)
  8.     ;; msg - message to display (nil for default)
  9.     ;; fnc - optional function to apply to selected object
  10.     ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC")))
  11.     ;; Alan J. Thompson, 05.25.10
  12.     (setvar 'ERRNO 0)
  13.     (while
  14.       (progn (setq ent (meth (cond (msg)
  15.                                    ("\nSelect object: ")
  16.                              )
  17.                        )
  18.              )
  19.              (cond ((eq (getvar 'ERRNO) 7) (princ "\nMissed, try again."))
  20.                    ((eq (type (car ent)) 'ENAME)
  21.                     (if (and fnc (not (fnc ent)))
  22.                       (princ "\nInvalid object!")
  23.                     )
  24.                    )
  25.              )
  26.       )
  27.     )
  28.     ent
  29.   )
  30.  
  31.   (defun AT:MText (Pt Str Wd Lay Jus / Wd s o)
  32.     ;; Add MText to drawing
  33.     ;; Pt - MText insertion point
  34.     ;; Str - String to place in created MText object
  35.     ;; Wd - Width of MText object (if nil, will be 0 width)
  36.     ;; Lay - Layer to place Mtext object on (nil for current)
  37.     ;; Jus - Justification # for Mtext object
  38.     ;;       1 or nil= TopLeft
  39.     ;;       2= TopCenter
  40.     ;;       3= TopRight
  41.     ;;       4= MiddleLeft
  42.     ;;       5= MiddleCenter
  43.     ;;       6= MiddleRight
  44.     ;;       7= BottomLeft
  45.     ;;       8= BottomCenter
  46.     ;;       9= BottomRight
  47.     ;; Alan J. Thompson, 05.23.09 / 04.09.10
  48.     (or Wd (setq Wd 0.))
  49. (command "_layer" "m" "SF_Text" "c" "2" "" "")
  50.     (setq s  (if (or (eq acmodelspace
  51.                          (vla-get-activespace
  52.                            (cond (*AcadDoc*)
  53.                                  ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
  54.                            )
  55.                          )
  56.                      )
  57.                      (eq :vlax-true (vla-get-mspace *AcadDoc*))
  58.                  )
  59.                (vla-get-modelspace *AcadDoc*)
  60.                (vla-get-paperspace *AcadDoc*)
  61.              )
  62.           Pt (cond ((vl-consp Pt) (vlax-3d-point Pt))
  63.                    ((eq (type Pt) 'variant) Pt)
  64.              )
  65.     )
  66.     (vla-put-lock (vlax-ename->vla-object (tblobjname "layer" (getvar 'clayer))) :vlax-false)
  67.     (setq o (vla-addMText s Pt Wd (vl-princ-to-string Str)))
  68.     (and Lay (tblsearch "layer" Lay) (vla-put-layer o Lay))
  69.     (cond ((vl-position Jus '(1 2 3 4 5 6 7 8 9))
  70.            (vla-put-AttachmentPoint o Jus)
  71.            (vla-put-InsertionPoint o Pt)
  72.           )
  73.     )
  74.     o
  75.   )
  76.  
  77.   (defun AT:Sta2Num (s)
  78.     (if (eq (type s) 'STR)
  79.       (distof (vl-list->string (vl-remove 43 (vl-string->list s))))
  80.     )
  81.   )
  82.  
  83.   (defun AT:AngleAtPoint (e p)
  84.     ;; Return angle along curve, at specified point (on curve)
  85.     ;; e - valid curve (ENAME or VLA-OBJECT)
  86.     ;; p - point on curve
  87.     ;; Alan J. Thompson, 11.04.10
  88.   )
  89.  
  90.  
  91.  
  92. ;;;  (defun _getstring (m / s)
  93. ;;;    (cond ((not (setq s (vl-string->list (getstring m)))) nil)
  94. ;;;          ((if (and (vl-remove 43 s) (vl-position 43 s))
  95. ;;;             (AT:ToStation (vl-list->string s))
  96. ;;;             (progn (princ "\nInvalid station!") (_getstring m))
  97. ;;;           )
  98. ;;;          )
  99. ;;;    )
  100. ;;;  )
  101.  
  102.   (defun _getstring (m)
  103.     ((lambda (s)
  104.        (cond ((eq "" s) nil)
  105.              ((AT:ToStation s))
  106.              ((princ "\nInvalid station!") (_getstring m))
  107.        )
  108.      )
  109.       (getstring m)
  110.     )
  111.   )
  112.  
  113.  
  114. (defun AT:ToStation (val / foo)
  115.   ;; Convert number, number string, station string to valid station string
  116.   ;; val - value to convert
  117.   ;; Alan J. Thompson, 11.01.10
  118.  
  119.   (command "_layer" "m" "SF_line" "c" "155" "" "")
  120.   (defun foo (s)
  121.     (cond
  122.       ((not (vl-remove-if '(lambda (x) (vl-position x '(43 46)))
  123.                           (vl-string->list s)
  124.             )
  125.        )
  126.        nil
  127.       )
  128.       ((wcmatch s "#+*,+*") (foo (strcat "0" s)))
  129.       ((wcmatch s "*+,*+0") (foo (strcat s "0")))
  130.       ((not (vl-string-search "." s)) (foo (strcat s ".00")))
  131.       ((< (vl-string-search "." s) 2) (foo (strcat "0" s)))
  132.       ((< (- (strlen s) (vl-string-search "." s)) 3) (foo (strcat s "0")))
  133.       ((not (vl-string-search "+" s))
  134.        (foo
  135.          ((lambda (i l)
  136.             (vl-list->string
  137.               (apply
  138.                 (function append)
  139.                 (mapcar
  140.                   (function (lambda (x)
  141.                               ;; rev kdub: (if (eq 2 (- (vl-position 46 l) (setq i (1+ i))))
  142.                               ;; rev kdub: to display "01+000.00"
  143.                               (if (eq 3 (- (vl-position 46 l) (setq i (1+ i))))
  144.                                 (list 43 x)
  145.                                 (list x)
  146.                               )
  147.                             )
  148.                   )
  149.                   l
  150.                 )
  151.               )
  152.             )
  153.           )
  154.            -1
  155.            (vl-string->list s)
  156.          )
  157.        )
  158.       )
  159.       ;; rev kdub: ((vl-some '(lambda (c) (wcmatch s c)) '("~*##+##`.##*" "*+*+*" "*`.*`.*")) nil)
  160.       ;; rev kdub: to display "01+000.00"
  161.       ((vl-some '(lambda (c) (wcmatch s c))
  162.                 '("~*##+###`.##*" "*+*+*" "*`.*`.*")
  163.        )
  164.        nil
  165.       )
  166.       (s)
  167.     )
  168.   )
  169.   (foo (vl-princ-to-string val))
  170. )
  171.  
  172.  
  173.  
  174.   (if
  175.     (and (setq e (car (AT:GetSel entsel
  176.                                  "\nSelect alignment: "
  177.                                  (lambda (x)
  178.                                    (not (vl-catch-all-error-p
  179.                                           (vl-catch-all-apply
  180.                                             (function vlax-curve-getEndParam)
  181.                                             (list (car x))
  182.                                           )
  183.                                         )
  184.                                    )
  185.                                  )
  186.                       )
  187.                  )
  188.          )
  189.          (setq *SF:Sta*
  190.                 (cond
  191.                   ((eq "AECC_ALIGNMENT" (cdr (assoc 0 (entget e))))
  192.                    (AT:ToStation (vlax-get-property (vlax-ename->vla-object e) 'StartingStation))
  193.                   )
  194.                   ((_getstring
  195.                      (strcat "\nSpecify starting station <"
  196.                              (cond (*SF:Sta*)
  197.                                    ((setq *SF:Sta* (AT:ToStation 1000.)))
  198.                              )
  199.                              ">: "
  200.                      )
  201.                    )
  202.                   )
  203.                   (*SF:Sta*)
  204.                 )
  205.          )
  206.     )
  207.      (while
  208.        (setq s (_getstring
  209.                  (strcat "\nStarting station: "
  210.                          *SF:Sta*
  211.                          " ~ Ending Station: "
  212.                          (At:ToStation
  213.                            (+ (AT:Sta2Num *SF:Sta*)
  214.                               (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e))
  215.                            )
  216.                          )
  217.                          "\nSpecify station to find: "
  218.                  )
  219.                )
  220.        )
  221.         (if (setq p (vlax-curve-getPointAtDist e (- (AT:Sta2Num s) (AT:Sta2Num *SF:Sta*))))
  222.           (if (setq o (cond ((getdist (trans p 0 1)
  223.                                       (strcat "\nSpecify offset for station \""
  224.                                               s
  225.                                               "\" (+ = Right, - = Left) <0.00>: "
  226.                                       )
  227.                              )
  228.                             )
  229.                             (0.)
  230.                       )
  231.               )
  232.             ((lambda (ang)
  233.                (or (zerop o)
  234.                    (entmake (list '(0 . "LINE") (cons 10 p) (cons 11 (setq p (polar p ang o)))))
  235.                )
  236. ;;;               (entmake (list '(0 . "CIRCLE")
  237. ;;;                              (cons 10 p)
  238. ;;;                              (cons 40
  239. ;;;                                    (cond ((zerop o) (fix (* 0.1 (getvar 'viewsize))))
  240. ;;;                                          ((* 0.1 o))
  241. ;;;                                    )
  242. ;;;                              )
  243. ;;;                        )
  244. ;;;               )
  245.                (vla-put-rotation
  246.                  (cond ((zerop o) (AT:MText p (strcat "STATION: " s) 0. nil 4))
  247.                        ((AT:MText p
  248.                                   (strcat "STATION: " s "\\POFFSET: " (vl-princ-to-string o))
  249.                                   0.
  250.                                   nil
  251.                                   (cond ((minusp o) 6)
  252.                                         (4)
  253.                                   )
  254.                         )
  255.                        )
  256.                  )
  257.                  ang
  258.                )
  259.              )
  260.               (if (minusp o)
  261.                 (- (AT:AngleAtPoint e p) (/ pi 2.))
  262.                 (+ (AT:AngleAtPoint e p) (* pi 1.5))
  263.               )
  264.             )
  265.           )
  266.           (alert (strcat "Station \"" s "\" outside of alignment limits!"))
  267.         )
  268.      )
  269.   )
  270.   (princ)
  271. )

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Station and offset lisp (HELP)
« Reply #19 on: March 15, 2014, 10:35:55 PM »
Play with this.



Pay it forward.

Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun c:SF (/            AT:GetSel
  3.              AT:MText     AT:ToStation
  4.              AT:Sta2Num   AT:AngleAtPoint
  5.              _getstring   _Setup
  6.              e            s
  7.              p            o
  8.             )
  9.   ;; Find and label station along alignment (with option to perform offset)
  10.   ;; Alan J. Thompson, 11.04.10
  11.   ;; rev kdub:  _Setup added kdub@theSwamp
  12.   ;; rev kdub:  Add Points, TextSize TextColor and modify station Text. 2014.03.16
  13.   (defun _setup (/ returnvalue)
  14.     (or (tblsearch "layer" "SF_Point")
  15.         (vl-cmdf "_layer" "m" "SF_Point" "c" "1" "" "")
  16.     )
  17.     (or (tblsearch "layer" "SF_Line")
  18.         (vl-cmdf "_layer" "m" "SF_Line" "c" "155" "" "")
  19.     )
  20.     (or (tblsearch "layer" "SF_Text")
  21.         (vl-cmdf "_layer" "m" "SF_Text" "c" "2" "" "")
  22.     )
  23.     ;; textsize
  24.     (or *SF:Textsize*
  25.         (setq *SF:Textsize* (* (getvar "TEXTSIZE") (getvar "DIMSCALE")))
  26.     )
  27.     (if (vl-catch-all-error-p (setq returnvalue
  28.                                      (vl-catch-all-apply 'getreal
  29.                                                          (list (strcat "\nSpecify TextSize  << "
  30.                                                                        (rtos *SF:Textsize* 2)
  31.                                                                        " >>"
  32.                                                                )
  33.                                                          )
  34.                                      )
  35.                               )
  36.         )
  37.       ;; ESC was pressed.
  38.       (setq returnvalue nil)
  39.     )
  40.     (if returnvalue
  41.       (setq *SF:Textsize* returnvalue)
  42.     )
  43.     (vl-cmdf "PDMODE" 32)
  44.     (vl-cmdf "PDSIZE" 0.5)
  45.     (prompt "\nUse 'DDPMODE' command to set POINT mode and size")
  46.   )
  47.   ;; --------------
  48.   (defun AT:GetSel (meth msg fnc / ent)
  49.     ;; meth - selection method (entsel, nentsel, nentselp)
  50.     ;; msg - message to display (nil for default)
  51.     ;; fnc - optional function to apply to selected object
  52.     ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC")))
  53.     ;; Alan J. Thompson, 05.25.10
  54.     (setvar 'ERRNO 0)
  55.     (while (progn (setq ent (meth (cond (msg)
  56.                                         ("\nSelect object: ")
  57.                                   )
  58.                             )
  59.                   )
  60.                   (cond ((eq (getvar 'ERRNO) 7) (princ "\nMissed, try again."))
  61.                         ((eq (type (car ent)) 'ENAME)
  62.                          (if (and fnc (not (fnc ent)))
  63.                            (princ "\nInvalid object!")
  64.                          )
  65.                         )
  66.                   )
  67.            )
  68.     )
  69.     ent
  70.   )
  71.   ;; --------------
  72.   (defun AT:MText (Pt Str Wd Lay Jus / Wd s o)
  73.     ;; Add MText to drawing
  74.     ;; Pt - MText insertion point
  75.     ;; Str - String to place in created MText object
  76.     ;; Wd - Width of MText object (if nil, will be 0 width)
  77.     ;; Lay - Layer to place Mtext object on (nil for current)
  78.     ;; Jus - Justification # for Mtext object
  79.     ;;       1 or nil= TopLeft
  80.     ;;       2= TopCenter
  81.     ;;       3= TopRight
  82.     ;;       4= MiddleLeft
  83.     ;;       5= MiddleCenter
  84.     ;;       6= MiddleRight
  85.     ;;       7= BottomLeft
  86.     ;;       8= BottomCenter
  87.     ;;       9= BottomRight
  88.     ;; Alan J. Thompson, 05.23.09 / 04.09.10
  89.     (or Wd (setq Wd 0.))
  90.     (setq s  (if
  91.                (or
  92.                  (eq acmodelspace
  93.                      (vla-get-activespace
  94.                        (cond (*AcadDoc*)
  95.                              ((setq
  96.                                 *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))
  97.                               )
  98.                              )
  99.                        )
  100.                      )
  101.                  )
  102.                  (eq :vlax-true (vla-get-mspace *AcadDoc*))
  103.                )
  104.                 (vla-get-modelspace *AcadDoc*)
  105.                 (vla-get-paperspace *AcadDoc*)
  106.              )
  107.           Pt (cond ((vl-consp Pt) (vlax-3d-point Pt))
  108.                    ((eq (type Pt) 'variant) Pt)
  109.              )
  110.     )
  111.     (vla-put-lock (vlax-ename->vla-object (tblobjname "layer" (getvar 'clayer)))
  112.                   :vlax-false
  113.     )
  114.     (setq o (vla-addMText s Pt Wd (vl-princ-to-string Str)))
  115.     (and Lay (tblsearch "layer" Lay) (vla-put-layer o Lay))
  116.     (cond ((vl-position Jus '(1 2 3 4 5 6 7 8 9))
  117.            (vla-put-AttachmentPoint o Jus)
  118.            (vla-put-InsertionPoint o Pt)
  119.           )
  120.     )
  121.     o
  122.   )
  123.   ;; --------------
  124.   (defun AT:Sta2Num (s)
  125.     (if (eq (type s) 'STR)
  126.       (distof (vl-list->string (vl-remove 43 (vl-string->list s))))
  127.     )
  128.   )
  129.   ;; --------------
  130.   (defun AT:AngleAtPoint (e p)
  131.     ;; Return angle along curve, at specified point (on curve)
  132.     ;; e - valid curve (ENAME or VLA-OBJECT)
  133.     ;; p - point on curve
  134.     ;; Alan J. Thompson, 11.04.10
  135.     (angle '(0. 0. 0.)
  136.     )
  137.   )
  138. ;;;  (defun _getstring (m / s)
  139. ;;;    (cond ((not (setq s (vl-string->list (getstring m)))) nil)
  140. ;;;          ((if (and (vl-remove 43 s) (vl-position 43 s))
  141. ;;;             (AT:ToStation (vl-list->string s))
  142. ;;;             (progn (princ "\nInvalid station!") (_getstring m))
  143. ;;;           )
  144. ;;;          )
  145. ;;;    )
  146. ;;;  )
  147.   ;; --------------
  148.   (defun _getstring (m)
  149.     ((lambda (s)
  150.        (cond ((eq "" s) nil)
  151.              ((AT:ToStation s))
  152.              ((princ "\nInvalid station!") (_getstring m))
  153.        )
  154.      )
  155.       (getstring m)
  156.     )
  157.   )
  158.   ;; --------------
  159.   (defun AT:ToStation (val / foo)
  160.     ;; Convert number, number string, station string to valid station string
  161.     ;; val - value to convert
  162.     ;; Alan J. Thompson, 11.01.10
  163.     (defun foo (s)
  164.       (cond
  165.         ((not (vl-remove-if '(lambda (x) (vl-position x '(43 46)))
  166.                             (vl-string->list s)
  167.               )
  168.          )
  169.          nil
  170.         )
  171.         ((wcmatch s "#+*,+*") (foo (strcat "0" s)))
  172.         ((wcmatch s "*+,*+0") (foo (strcat s "0")))
  173.         ((not (vl-string-search "." s)) (foo (strcat s ".00")))
  174.         ((< (vl-string-search "." s) 2) (foo (strcat "0" s)))
  175.         ((< (- (strlen s) (vl-string-search "." s)) 3) (foo (strcat s "0")))
  176.         ((not (vl-string-search "+" s))
  177.          (foo
  178.            ((lambda (i l)
  179.               (vl-list->string
  180.                 (apply
  181.                   (function append)
  182.                   (mapcar (function
  183.                             (lambda (x)
  184.                               ;; rev kdub: (if (eq 2 (- (vl-position 46 l) (setq i (1+ i))))
  185.                               ;; rev kdub: to display "01+000.00"
  186.                               (if (eq 3 (- (vl-position 46 l) (setq i (1+ i))))
  187.                                 (list 43 x)
  188.                                 (list x)
  189.                               )
  190.                             )
  191.                           )
  192.                           l
  193.                   )
  194.                 )
  195.               )
  196.             )
  197.              -1
  198.              (vl-string->list s)
  199.            )
  200.          )
  201.         )
  202.         ;; rev kdub: ((vl-some '(lambda (c) (wcmatch s c)) '("~*##+##`.##*" "*+*+*" "*`.*`.*")) nil)
  203.         ;; rev kdub: to display "01+000.00"
  204.         ((vl-some '(lambda (c) (wcmatch s c))
  205.                   '("~*##+###`.##*" "*+*+*" "*`.*`.*")
  206.          )
  207.          nil
  208.         )
  209.         (s)
  210.       )
  211.     )
  212.     (foo (vl-princ-to-string val))
  213.   )
  214.   ;; --------------
  215.   ;; -- MAIN ------
  216.   ;; rev kdub: _Setup added kdub@theSwamp
  217.   (_setup)
  218.   (if (and (setq e
  219.                   (car (AT:GetSel
  220.                          entsel
  221.                          "\nSelect alignment: "
  222.                          (lambda (x)
  223.                            (not (vl-catch-all-error-p
  224.                                   (vl-catch-all-apply (function vlax-curve-getEndParam)
  225.                                                       (list (car x))
  226.                                   )
  227.                                 )
  228.                            )
  229.                          )
  230.                        )
  231.                   )
  232.            )
  233.            (setq *SF:Sta*
  234.                   (cond
  235.                     ((eq "AECC_ALIGNMENT" (cdr (assoc 0 (entget e))))
  236.                      (AT:ToStation (vlax-get-property (vlax-ename->vla-object e)
  237.                                                       'StartingStation
  238.                                    )
  239.                      )
  240.                     )
  241.                     ((_getstring
  242.                        (strcat "\nSpecify starting station <"
  243.                                (cond (*SF:Sta*)
  244.                                      ((setq *SF:Sta* (AT:ToStation 1000.)))
  245.                                )
  246.                                ">: "
  247.                        )
  248.                      )
  249.                     )
  250.                     (*SF:Sta*)
  251.                   )
  252.            )
  253.       )
  254.     (while (setq s
  255.                   (_getstring
  256.                     (strcat "\nStarting station: "
  257.                             *SF:Sta*
  258.                             " ~ Ending Station: "
  259.                             (At:ToStation
  260.                               (+ (AT:Sta2Num *SF:Sta*)
  261.                                  (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e))
  262.                               )
  263.                             )
  264.                             "\nSpecify station to find: "
  265.                     )
  266.                   )
  267.            )
  268.       (if (setq p
  269.                  (vlax-curve-getPointAtDist e
  270.                                             (- (AT:Sta2Num s) (AT:Sta2Num *SF:Sta*))
  271.                  )
  272.           )
  273.         (if (setq o (cond ((getdist (trans p 0 1)
  274.                                     (strcat "\nSpecify offset for station \""
  275.                                             s
  276.                                             "\" (+ = Right, - = Left) <0.00>: "
  277.                                     )
  278.                            )
  279.                           )
  280.                           (0.)
  281.                     )
  282.             )
  283.           ((lambda (ang)
  284.              (or (zerop o)
  285.                  (entmake (list '(0 . "LINE")
  286.                                 (cons 10 p)
  287.                                 (cons 11 (polar p ang o))
  288.                                 ;; rev kdub:
  289.                                 (cons 8 "SF_Line")
  290.                           )
  291.                  )
  292.              )
  293. ;;;               (entmake (list '(0 . "CIRCLE")
  294. ;;;                              (cons 10 p)
  295. ;;;                              (cons 40
  296. ;;;                                    (cond ((zerop o) (fix (* 0.1 (getvar 'viewsize))))
  297. ;;;                                          ((* 0.1 o))
  298. ;;;                                    )
  299. ;;;                              )
  300. ;;;                        )
  301. ;;;               )
  302.              ;; rev kdub:
  303.              (entmake (list '(0 . "POINT") (cons 10 p) (cons 8 "SF_Point")))
  304.              (or (zerop o)
  305.                  (entmake (list '(0 . "POINT")
  306.                                 (cons 10 (polar p ang o))
  307.                                 (cons 8 "SF_Point")
  308.                           )
  309.                  )
  310.              )
  311.              (vla-put-rotation
  312.                (cond
  313.                  ((zerop o)
  314.                   (AT:MText p (strcat "STATION: " s) 0. "SF_Text" 4)
  315.                  )
  316.                  ((AT:MText
  317.                     (polar p ang (* o 0.5))
  318.                     (strcat "STATION: " s "\\POFFSET: " (vl-princ-to-string o))
  319.                     0.
  320.                     "SF_Text"
  321.                     5                        ; middle-center
  322.                   )
  323.                  )
  324.                )
  325.                ang
  326.              )
  327.              (vla-put-height (vlax-ename->vla-object (entlast)) *SF:Textsize*)
  328.              ;; ^^ ;; rev kdub: ---
  329.            )(if (minusp o)
  330.               (- (AT:AngleAtPoint e p) (/ pi 2.))
  331.               (+ (AT:AngleAtPoint e p) (* pi 1.5))
  332.             )
  333.           )
  334.         )
  335.         (alert (strcat "Station \"" s "\" outside of alignment limits!"))
  336.       )
  337.     )
  338.   )
  339.   (princ)
  340. )
  341.  
  342.  

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

pedroantonio

  • Guest
Re: Station and offset lisp (HELP)
« Reply #20 on: March 16, 2014, 04:10:17 AM »
Thank you Kerry.Nice job

Thanks

adalea03

  • Guest
Re: Station and offset lisp (HELP)
« Reply #21 on: March 16, 2014, 09:30:27 AM »
Kerry,
The encouragement and patience that you provided should be commended;
a wonderful example.
On behalf of the lesser skilled, (primarily me) thank you.
Tony

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Station and offset lisp (HELP)
« Reply #22 on: March 16, 2014, 09:56:17 AM »
Thank you Kerry.Nice job

Thanks

You're welcome Topographer.

< .. >
On behalf of the lesser skilled, (primarily me) thank you.
Tony
Thanks for the comment Tony, much appreciated.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.