Author Topic: line length Anywhere along the line  (Read 9495 times)

0 Members and 1 Guest are viewing this topic.

todor

  • Mosquito
  • Posts: 19
line length Anywhere along the line
« on: September 01, 2014, 06:05:01 AM »
Regards to all.
My name is Dragan and I'm new to this forum.
I need a little help, here's what it's about
in the drawing, there is one line long example. 40.
I need a lisp to show anywhere on the line and make a block with the value of the length of the line. For example, if you show the middle block will be set to 20, if you show the end of the block will have a value of 40, if you show 1/5 of the block will have value 8.
You initially need to define the beginning of the line, for example, if the line does not start from zero but still has some value eg 10-
Thank you.
« Last Edit: September 01, 2014, 06:10:30 AM by todor »

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: line length Anywhere along the line
« Reply #1 on: September 01, 2014, 06:50:00 AM »
I would suggest using the vlax-curve-getdistatpoint function - this will cater for all curve objects, not just lines.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: line length Anywhere along the line
« Reply #2 on: September 01, 2014, 06:52:05 AM »
Welcome to the swamp!

Anyhow, do you want to have this in Lisp? What about a dynamic block (see attached)?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

todor

  • Mosquito
  • Posts: 19
Re: line length Anywhere along the line
« Reply #3 on: September 01, 2014, 07:11:48 AM »
irneb
This is a dynamic block, but I need to show the line on osnap on nearest on and where we show that the apparent length (ie, if the line starts at 0 and I showed the half-lines in the block will write polovona lines).

Your dynamic block reads the entire length of the line, and I need only the length that show.
Lee Mac
You're right, it does not matter whether the polyline or line, and have the drawings to refer to the line that I think (if there are more)
Thank you.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: line length Anywhere along the line
« Reply #4 on: September 01, 2014, 07:16:59 AM »
Your dynamic block reads the entire length of the line, and I need only the length that show.
Nope, it reads the position along the line where the text is placed. Adjust that then do a regen so the field updates.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: line length Anywhere along the line
« Reply #5 on: September 01, 2014, 07:19:06 AM »
Perhaps I'm misunderstanding. Could you post a sample DWG of what you want to see as a result?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

todor

  • Mosquito
  • Posts: 19
Re: line length Anywhere along the line
« Reply #6 on: September 01, 2014, 07:21:44 AM »
Your dynamic block reads the entire length of the line, and I need only the length that show.
Nope, it reads the position along the line where the text is placed. Adjust that then do a regen so the field updates.

You're right, now I've seen, I'm sorry.
But if it is a polyline ..... or a longer line ....
So I need to show when the block insert point block that has an attribute in itself to read the length of the line, or where I showed.

todor

  • Mosquito
  • Posts: 19
Re: line length Anywhere along the line
« Reply #7 on: September 01, 2014, 07:28:16 AM »
Here's specifically why we should
I have a path that starts from 0+000.00 to 40 + 000.00 . Shaft times a polyline. I should interject signs next to the shaft (there are plenty, the signs are in the block) and when I put a sign that automatically reads chainage times to the point where I put a sign.
Excuse the language.

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: line length Anywhere along the line
« Reply #8 on: September 01, 2014, 07:44:49 AM »
Dragane, bolje koncipiraj pitanje... Kako blok o kome govoris treba da izgleda, da li treba da sadrzi atribute koji bi imali vrednost o kojima govoris : 40, 20, 8 ? Da li bi onda taj blok trebalo da bude rasporedjen duz te linije (krive) na tim intervalima? Prosto napisi sta bi bili inputi i sta bi trebalo da bude rezultat (kako bi zeleo da rutina funkcionise)?

Pozeljno je upload-ovati crtez pre rutine i crtez posle exzekucije komande...
 
Da li je potrebno uneti startnu vrednost krive, ili je to uvek 0.0?
Zgodno bi bilo ako bi upload-ovao blok sa kojim baratas, jednom recju *.DWG od pre i posle...



Dragan, please clarify your question better... How should block you are speaking about look like, should it have to have attributes that would have values you're speaking : 40, 20, 8 ? Should that block then be distributed along that line (curve) at those intervals? Simply write what would be inputs and what should be result (how would you like routine to function)?

It's preferable to upload before and after pictures or drawings when routine is executed...

Is it necessary to specify starting value of curve, or this is always 0.0?
It would be nice if you could upload block you are working with, in other words *.DWG of before and after...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

todor

  • Mosquito
  • Posts: 19
Re: line length Anywhere along the line
« Reply #9 on: September 01, 2014, 08:12:33 AM »
Хвала Марко.
Овде је цртеж са осовиним који је стациониран од 0+000.00 до 0+662.87.
Када убацим блок АТРИБУТ  било где показујући осовinu треба  да ми вредност атрибута СТАЦИОНАZА покаже na којој сам стачижи односно да се то аутоматски поље попуни.
Почетна вреднош не мора да буде 0+000.00 већ треба корисник да казe која је почетна вредност.



Thank you Marko.

Here is the drawing from the shaft, which was based from  0 + 000.00  to 0+ 662.87.
When you insert a block name ATRIBUT anywhere showing the shaft should we attribute value STACIONAZA show where or to automatically fill in the field.
Home values ​​together does not have to be 0 + 000.00 but users need to say that the initial value.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: line length Anywhere along the line
« Reply #10 on: September 01, 2014, 08:30:09 AM »
Here is the drawing from the shaft, which was based from  0 + 000.00  to 0+ 662.87.
When you insert a block name ATRIBUT anywhere showing the shaft should we attribute value STACIONAZA show where or to automatically fill in the field.
Home values ​​together does not have to be 0 + 000.00 but users need to say that the initial value.
OK, the move/copy idea means you'd need to incorporate a reactor to catch those actions.

The rest is reasonably simple as you'd use vlax-curve-getClosestPointTo to find the exact point on the polyline from the block's insertion point. Then you use the vlax-curve-getDistAtPoint function to obtain how far along the polyline that is. To add some starting length you'd probably need to save that after asking the user - you might need to save it as XData / LData / XDictionary of the polyline itself.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: line length Anywhere along the line
« Reply #11 on: September 03, 2014, 05:32:55 AM »
Dragan, try this code... I can't quite satisfy your needs ab "copy" "move" block with update, but try to take all you need from this snippet code :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:distoncurve ( / *error* c r ch f dc st txts otxts lp p att attd bl loop gr gp a d bll atl )
  2.  
  3.  
  4.   (defun *error* ( msg / bln )
  5.     (if attd (setvar 'attdia attd))
  6.     (if otxts (setvar 'textsize otxts))
  7.     (if (entget bl)
  8.       (progn
  9.         (setq bln (cdr (assoc 2 (entget bl))))
  10.         (entdel bl)
  11.         (command "_.-purge" "_b" bln "_n")
  12.         (while (> (getvar 'cmdactive) 0) (command ""))
  13.       )
  14.     )
  15.     (if msg (prompt msg))
  16.     (princ)
  17.   )
  18.  
  19.   (setq c (car (entsel "\nPick curve entity")))
  20.     (prompt "\nPicked entity doesn't belong to curve entities... Try again...")
  21.     (setq c (car (entsel "\nPick curve entity")))
  22.   )
  23.   (prompt "\nReal length of picked curve is : ")(princ (rtos (setq r (vlax-curve-getdistatparam c (vlax-curve-getendparam c))) 2 50))
  24.   (initget 1 "Yes No")
  25.   (setq ch (getkword "\nDo you want to operate on real length or corrected length [Yes/No] (Yes-real) (No-corrected) : "))
  26.   (if (eq ch "Yes")
  27.     (setq f 1.0)
  28.     (progn
  29.       (initget 7)
  30.       (setq dc (getdist "\nPick or specify corrected length of curve : "))
  31.       (setq f (/ dc r))
  32.     )
  33.   )
  34.   (setq st (getreal "\nSpecify starting distance of curve <0.0> : "))
  35.   (if (null st) (setq st 0.0))
  36.   (prompt "\nSpecify text size <") (princ (getvar 'textsize)) (prompt "> : ")
  37.   (initget 6)
  38.   (setq txts (getreal))
  39.   (if (null txts) (setq txts (getvar 'textsize)))
  40.   (setq otxts (getvar 'textsize))
  41.   (setvar 'textsize txts)
  42.   (setq lp t)
  43.   (while lp
  44.     (if (not (tblsearch "BLOCK" "Label"))
  45.       (progn
  46.         (setq p (entmakex (list '(0 . "LINE") (cons 10 (list 0.0 (- (getvar 'textsize)) 0.0)) (cons 11 (list 0.0 (getvar 'textsize) 0.0)))))
  47.         (setq att  (entmakex
  48.                      (list
  49.                        '(0 . "ATTDEF")
  50.                        '(100 . "AcDbEntity")
  51.                        '(100 . "AcDbText")
  52.                        (cons 40 (getvar 'textsize))
  53.                        '(1 . "DISTANCE")
  54.                        (cons 50 (* 3.0 (/ pi 2.0)))
  55.                        '(41 . 1.0)
  56.                        '(51 . 0.0)
  57.                        '(7 . "Standard")
  58.                        '(71 . 0)
  59.                        '(72 . 0)
  60.                        '(10 0.0 0.0 0.0)
  61.                        (cons 11
  62.                              (polar '(0.0 0.0 0.0)
  63.                                     (* pi -0.5)
  64.                                     (* 2.0 (getvar 'textsize))
  65.                              )
  66.                        )
  67.                        '(210 0.0 0.0 1.0)
  68.                        '(100 . "AcDbAttributeDefinition")
  69.                        '(280 . 0)
  70.                        '(3 . "DISTANCE-Prompt")
  71.                        '(2 . "DISTANCE")
  72.                        '(70 . 0)
  73.                        '(73 . 0)
  74.                        '(74 . 1)
  75.                        '(280 . 0)
  76.                      )
  77.                    )
  78.         )
  79.         (command "_.-block"
  80.                  "Label"
  81.                  '(0.0 0.0 0.0)
  82.                  (ssadd att (ssadd p))
  83.                  ""
  84.         )
  85.       )
  86.     )
  87.     (setq attd (getvar 'attdia))
  88.     (setvar 'attdia 0)
  89.     (command "_.-insert" "Label" '(0.0 0.0 0.0) "" "" "" "DISTANCE")
  90.     (command "_.-rename" "_b" "Label" (strcat "Label" (rtos (getvar 'cdate) 2 8)))
  91.     (setq bl (entlast))
  92.     (setq loop t)
  93.     (while loop
  94.       (setq gr (grread t 15 0))
  95.       (redraw)
  96.       (if (listp (cadr gr))
  97.         (progn
  98.           (setq gp (vlax-curve-getclosestpointto c (cadr gr)))
  99.           (setq a (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv c (vlax-curve-getparamatpoint c gp))))
  100.           (setq d (vlax-curve-getdistatpoint c gp))
  101.           (setq bll (entget bl))
  102.           (setq atl (entget (entnext bl)))
  103.           (setq bll (subst (cons 10 gp) (assoc 10 bll) bll))
  104.           (setq bll (subst (cons 50 a) (assoc 50 bll) bll))
  105.           (setq atl (subst (cons 11 (polar gp (- a (* pi 0.5)) (* 2.0 (getvar 'textsize)))) (assoc 11 atl) atl))
  106.           (setq atl (subst (cons 50 (+ a (* 3.0 (* pi 0.5)))) (assoc 50 atl) atl))
  107.           (setq atl (subst (cons 1 (rtos (+ st (* f d)))) (assoc 1 atl) atl))
  108.           (entupd (cdr (assoc -1 (entmod bll))))
  109.           (entupd (cdr (assoc -1 (entmod atl))))
  110.         )
  111.       )
  112.       (if (= (car gr) 3) (setq loop nil))
  113.       (if (or (= (car gr) 11) (= (car gr) 25))
  114.         (progn
  115.           (setq loop nil lp nil)
  116.           (*error* nil)
  117.         )
  118.       )
  119.     )
  120.   )
  121.   (setvar 'attdia attd)
  122.   (setvar 'textsize otxts)
  123.   (princ)
  124. )
  125.  

HTH, Marko R.
« Last Edit: October 15, 2014, 03:42:30 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

todor

  • Mosquito
  • Posts: 19
Re: line length Anywhere along the line
« Reply #12 on: September 03, 2014, 10:39:40 AM »
Dragan, try this code... I can't quite satisfy your needs ab "copy" "move" block with update, but try to take all you need from this snippet code :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:distoncurve ( / c st p att attd bl gr gp a d bll atl )
  2.  
  3.  
  4.   (setq c (car (entsel "\nPick curve entity")))
  5.     (prompt "\nPicked entity doesn't belong to curve entities... Try again...")
  6.     (setq c (car (entsel "\nPick curve entity")))
  7.   )
  8.   (initget 1)
  9.   (setq st (getreal "\nSpecify starting distance of curve : "))
  10.   (if (not (tblsearch "BLOCK" "Label"))
  11.     (progn
  12.       (setq p (entmakex (list '(0 . "POINT") '(10 0.0 0.0 0.0))))
  13.       (setq att  (entmakex
  14.                    (list
  15.                      '(0 . "ATTDEF")
  16.                      '(100 . "AcDbEntity")
  17.                      '(100 . "AcDbText")
  18.                      (cons 40 (getvar 'textsize))
  19.                      '(1 . "DISTANCE")
  20.                      (cons 50 (/ pi 2.0))
  21.                      '(41 . 1.0)
  22.                      '(51 . 0.0)
  23.                      '(7 . "Standard")
  24.                      '(71 . 0)
  25.                      '(72 . 2)
  26.                      '(10 0.0 0.0 0.0)
  27.                      (cons 11
  28.                            (polar '(0.0 0.0 0.0)
  29.                                   (* pi -0.5)
  30.                                   (getvar 'textsize)
  31.                            )
  32.                      )
  33.                      '(210 0.0 0.0 1.0)
  34.                      '(100 . "AcDbAttributeDefinition")
  35.                      '(280 . 0)
  36.                      '(3 . "DISTANCE-Prompt")
  37.                      '(2 . "DISTANCE")
  38.                      '(70 . 0)
  39.                      '(73 . 0)
  40.                      '(74 . 3)
  41.                      '(280 . 0)
  42.                    )
  43.                  )
  44.       )
  45.       (command "_.-block"
  46.                "Label"
  47.                '(0.0 0.0 0.0)
  48.                (ssadd att (ssadd p))
  49.                ""
  50.       )
  51.     )
  52.   )
  53.   (setq attd (getvar 'attdia))
  54.   (setvar 'attdia 0)
  55.   (command "_.-insert" "Label" '(0.0 0.0 0.0) "" "" "" "DISTANCE")
  56.   (setq bl (entlast))
  57.   (while (/= (car (setq gr (grread t 15 0))) 3)
  58.     (redraw)
  59.     (setq a (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv c (vlax-curve-getparamatpoint c gp))))
  60.     (setq bll (entget bl))
  61.     (setq atl (entget (entnext bl)))
  62.     (setq bll (subst (cons 10 gp) (assoc 10 bll) bll))
  63.     (setq bll (subst (cons 50 a) (assoc 50 bll) bll))
  64.     (setq atl (subst (cons 11 (polar gp (- a (* pi 0.5)) (getvar 'textsize))) (assoc 11 atl) atl))
  65.     (setq atl (subst (cons 50 (+ a (* pi 0.5))) (assoc 50 atl) atl))
  66.     (setq atl (subst (cons 1 (rtos (+ st d))) (assoc 1 atl) atl))
  67.     (entupd (cdr (assoc -1 (entmod bll))))
  68.     (entupd (cdr (assoc -1 (entmod atl))))
  69.   )
  70.   (setvar 'attdia attd)
  71.   (princ)
  72. )
  73.  

HTH, Marko R.


Marko, odlicno, puno hvala. Jos samo nesto da li moze da se promeni da trazi upis polilinije u formatu X+XXX.XX (tako da se unosi odnosno 0+000.00 ako je pocetna vrednost 0) i da odogovor bude u istom formatu .
Jos jednom hvala.


Mark, great, thanks a lot. One more thing that you can change to request enrollment polylines in the format X + XXX.XX (to be entered or 0 + 000.00 if the initial value of 0) and that the answer is in the same format.
Thank you again.

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: line length Anywhere along the line
« Reply #13 on: September 04, 2014, 02:28:47 AM »
Here try this, of course, all kudos to ymg with his beautiful subfunctions...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:distoncurve ( / *error* rtosta statof c r ch f dc st txts otxts lp p att attd bl loop gr gp a d bll atl )
  2.  
  3.  
  4.   (defun *error* ( msg / bln )
  5.     (if attd (setvar 'attdia attd))
  6.     (if otxts (setvar 'textsize otxts))
  7.     (if (entget bl)
  8.       (progn
  9.         (setq bln (cdr (assoc 2 (entget bl))))
  10.         (entdel bl)
  11.         (command "_.-purge" "_b" bln "_n")
  12.         (while (> (getvar 'cmdactive) 0) (command ""))
  13.       )
  14.     )
  15.     (if msg (prompt msg))
  16.     (princ)
  17.   )
  18.  
  19.   ;; rtosta                     by ymg  September 2013                          ;
  20.   ;;                                                                            ;
  21.   ;; Arguments:   sta Real number to format as a Station                        ;
  22.   ;;             unit 1 for Imperials,                                          ;
  23.   ;;                  2 for Metrics.                                            ;
  24.   ;;             prec Integer for number of decimals                            ;
  25.   ;;                                                                            ;
  26.   ;; Examples: (rtosta 0 1 0)  -> "0+00"   (rtosta 1328.325 1 2) -> "13+28.33"  ;
  27.   ;;           (rtosta 0 2 0)  -> "0+000"  (rtosta 1328.325 2 2) -> "1+328.33"  ;
  28.   ;;                                                                            ;
  29.   ;; If sta is negative, format is as follow:                                   ;
  30.   ;;                                       (rtosta -1328.325 1 2) -> "13-28.33" ;
  31.   ;;                                       (rtosta -1328.325 2 2) -> "1-328.33" ;
  32.   ;;                                                                            ;
  33.  
  34.   (defun rtosta ( sta unit prec / str a b dz )
  35.    
  36.      (setq dz (getvar 'dimzin))
  37.      (setvar 'dimzin 0)
  38.      (setq str (rtos (abs sta) 2 prec))
  39.      (setvar 'dimzin dz)
  40.      (while (< (strlen str) (if (= prec 0) (+ unit 2) (+ prec (+ unit 3))))
  41.          (setq str (strcat "0" str))
  42.      )
  43.      (setq a (if (= prec 0) (- (strlen str) unit) (- (strlen str) prec (+ unit 1)))
  44.            b (substr str 1 (- a 1))
  45.            a (substr str a)
  46.      )
  47.      (strcat b (if (minusp sta) "-" "+") a)
  48.   )
  49.  
  50.   ;; statof                     by ymg  September 2013                          ;
  51.   ;;                                                                            ;
  52.   ;; Argument: String in format of a Station.                                   ;
  53.   ;;                                                                            ;
  54.   ;; Examples: (statof "0+00") -> 0.0      (statof "13+28.33") -> 1328.33       ;
  55.   ;;                                       (statof "1+328.33") -> 1328.33       ;
  56.   ;;                                                                            ;
  57.   ;; If sta is negative, format is as follow:                                   ;
  58.   ;;                                       (statof "13-28.33") -> -1328.33      ;
  59.   ;;                                       (statof "1-328.33") -> -1328.33      ;
  60.   ;;                                                                            ;
  61.  
  62.   (defun statof ( sta / p )
  63.     (cond
  64.        ((setq p (vl-string-position (ascii "+") sta))(atof (strcat (substr sta 1 p) (substr sta (+ p 2)))))  
  65.        ((setq p (vl-string-position (ascii "-") sta))(* (atof (strcat (substr sta 1 p) (substr sta (+ p 2)))) -1))
  66.     )  
  67.   )
  68.  
  69.   (setq c (car (entsel "\nPick curve entity")))
  70.     (prompt "\nPicked entity doesn't belong to curve entities... Try again...")
  71.     (setq c (car (entsel "\nPick curve entity")))
  72.   )
  73.   (prompt "\nReal length of picked curve is : ")(princ (rtos (setq r (vlax-curve-getdistatparam c (vlax-curve-getendparam c))) 2 50))
  74.   (initget 1 "Yes No")
  75.   (setq ch (getkword "\nDo you want to operate on real length or corrected length [Yes/No] (Yes-real) (No-corrected) : "))
  76.   (if (eq ch "Yes")
  77.     (setq f 1.0)
  78.     (progn
  79.       (initget 7)
  80.       (setq dc (getdist "\nPick or specify corrected length of curve : "))
  81.       (setq f (/ dc r))
  82.     )
  83.   )
  84.   (setq st (getstring "\nSpecify starting distance of curve in format <0+000.00> : "))
  85.   (if (eq st "") (setq st "0+000.00"))
  86.   (setq st (statof st))
  87.   (prompt "\nSpecify text size <") (princ (getvar 'textsize)) (prompt "> : ")
  88.   (initget 6)
  89.   (setq txts (getreal))
  90.   (if (null txts) (setq txts (getvar 'textsize)))
  91.   (setq otxts (getvar 'textsize))
  92.   (setvar 'textsize txts)
  93.   (setq lp t)
  94.   (while lp
  95.     (if (not (tblsearch "BLOCK" "Label"))
  96.       (progn
  97.         (setq p (entmakex (list '(0 . "LINE") (cons 10 (list 0.0 (- (getvar 'textsize)) 0.0)) (cons 11 (list 0.0 (getvar 'textsize) 0.0)))))
  98.         (setq att  (entmakex
  99.                      (list
  100.                        '(0 . "ATTDEF")
  101.                        '(100 . "AcDbEntity")
  102.                        '(100 . "AcDbText")
  103.                        (cons 40 (getvar 'textsize))
  104.                        '(1 . "DISTANCE")
  105.                        (cons 50 (* 3.0 (/ pi 2.0)))
  106.                        '(41 . 1.0)
  107.                        '(51 . 0.0)
  108.                        '(7 . "Standard")
  109.                        '(71 . 0)
  110.                        '(72 . 0)
  111.                        '(10 0.0 0.0 0.0)
  112.                        (cons 11
  113.                              (polar '(0.0 0.0 0.0)
  114.                                     (* pi -0.5)
  115.                                     (* 2.0 (getvar 'textsize))
  116.                              )
  117.                        )
  118.                        '(210 0.0 0.0 1.0)
  119.                        '(100 . "AcDbAttributeDefinition")
  120.                        '(280 . 0)
  121.                        '(3 . "DISTANCE-Prompt")
  122.                        '(2 . "DISTANCE")
  123.                        '(70 . 0)
  124.                        '(73 . 0)
  125.                        '(74 . 1)
  126.                        '(280 . 0)
  127.                      )
  128.                    )
  129.         )
  130.         (command "_.-block"
  131.                  "Label"
  132.                  '(0.0 0.0 0.0)
  133.                  (ssadd att (ssadd p))
  134.                  ""
  135.         )
  136.       )
  137.     )
  138.     (setq attd (getvar 'attdia))
  139.     (setvar 'attdia 0)
  140.     (command "_.-insert" "Label" '(0.0 0.0 0.0) "" "" "" "DISTANCE")
  141.     (command "_.-rename" "_b" "Label" (strcat "Label" (rtos (getvar 'cdate) 2 8)))
  142.     (setq bl (entlast))
  143.     (setq loop t)
  144.     (while loop
  145.       (setq gr (grread t 15 0))
  146.       (redraw)
  147.       (if (listp (cadr gr))
  148.         (progn
  149.           (setq gp (vlax-curve-getclosestpointto c (cadr gr)))
  150.           (setq a (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv c (vlax-curve-getparamatpoint c gp))))
  151.           (setq d (vlax-curve-getdistatpoint c gp))
  152.           (setq bll (entget bl))
  153.           (setq atl (entget (entnext bl)))
  154.           (setq bll (subst (cons 10 gp) (assoc 10 bll) bll))
  155.           (setq bll (subst (cons 50 a) (assoc 50 bll) bll))
  156.           (setq atl (subst (cons 11 (polar gp (- a (* pi 0.5)) (* 2.0 (getvar 'textsize)))) (assoc 11 atl) atl))
  157.           (setq atl (subst (cons 50 (+ a (* 3.0 (* pi 0.5)))) (assoc 50 atl) atl))
  158.           (setq atl (subst (cons 1 (rtosta (+ st (* f d)) 2 2)) (assoc 1 atl) atl))
  159.           (entupd (cdr (assoc -1 (entmod bll))))
  160.           (entupd (cdr (assoc -1 (entmod atl))))
  161.         )
  162.       )
  163.       (if (= (car gr) 3) (setq loop nil))
  164.       (if (or (= (car gr) 11) (= (car gr) 25))
  165.         (progn
  166.           (setq loop nil lp nil)
  167.           (*error* nil)
  168.         )
  169.       )
  170.     )
  171.   )
  172.   (setvar 'attdia attd)
  173.   (setvar 'textsize otxts)
  174.   (princ)
  175. )
  176.  

Regards, and all the best in your work, M.R.
[EDIT : Note that I modified both codes to make it more user friendly and meet required needs...]
« Last Edit: October 15, 2014, 03:43:28 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

todor

  • Mosquito
  • Posts: 19
Re: line length Anywhere along the line
« Reply #14 on: September 08, 2014, 02:58:24 AM »
Hvala puno Marko, to je to......
Samo, ako nije problem, jos neke korekcije, izvini,
1.  na pocetku trazi da unesem stacionazu u obliku 0+000.00 ako pritisnem ENTER da bude podrazumevana stacionaza 0+000.00
2. kad program zavrsi postavljanje stacionaze na poliliniju da nastavlja proces (vrti u krug).

Pozdrav i hvala jos jednom.


Thank you very much Mark, that's it ......
Only if it is not a problem, even some corrections, sorry
1. at the beginning looking to enter the chainage in the form 0 + 000.00 if I press ENTER to be the default chainage 0 + 000.00
2. When the program finishes setting up stations on the polyline to continue the process (running in circles).

Hello and thank you once again.
« Last Edit: September 08, 2014, 04:00:17 AM by todor »