Jump to content

Alignment with offset and chainage Lisp


souvik

Recommended Posts

Is it possible to make a lisp which will create a Alignment with given offset and put chainage of given meter interval. Suppose I have a polyline which 6000 mts. It is the centerline. Now I have to create a offset of 40 mt. witdth (i.e 20 mt. at right and 20 mt. at left) and put a tik mark at 100 mt interval. At each interval the chainage will increase by 100 mt. and a text will put like 0.0 km, 0.1 km, 0.2 km etc.

Link to comment
Share on other sites

Thank you Lee. But I actually need the chainage with double offset.

 

I know you do, but I can't justify the time spent writing the entire program for you on voluntary time. ;)

Link to comment
Share on other sites

I know you do, but I can't justify the time spent writing the entire program for you on voluntary time. ;)

Sorry, Lee. I didn't want to insult you. I just inform you what I need. That's all.

Link to comment
Share on other sites

Try this draft ...

 

(defun c:Test (/ Text o i n k j ss in l l1 l2 sn e e1 r p pt)
 (vl-load-com)
 ;;; Tharwat 02. Sep. 2012 ;;;
 (defun Text (l l1 l2 / j i pt)
   (setq j 0
         i 0.0
         )
   (repeat (fix (/ l 100.))
     (entmakex (list '(0 . "TEXT")
                     '(40 . 10.0)
                     (cons 1 (strcat (rtos (setq i (+ i 0.1)) 2 1) "Km."))
                     (cons 10 (setq pt (nth j l1)))
                     (cons 11 pt)
                     (cons 50 (setq r (angle (nth j l1) (nth j l2))))
                     )
               )
     (setq j (1+ j))
     )
   )
 (if (setq ss (ssget "_:L" '((0 . "LWPOLYLINE"))))
   (repeat (setq in (sslength ss))
     (setq o 20.
           n 100.
           k 100.
           )
     (if (> (setq l (vlax-curve-getdistatparam (setq sn (ssname ss (setq in (1- in)))) (vlax-curve-getendparam sn)))
            100.
            )
       (progn (vla-offset (vlax-ename->vla-object sn) o)
              (setq e (entlast))
              (repeat (fix (/ (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) 100.))
                (setq l1 (cons (vlax-curve-getpointatdist e n) l1))
                (setq n (+ n k))
                )
              (vla-offset (vlax-ename->vla-object sn) (- o))
              (setq e1 (entlast))
              (setq n 100.)
              (repeat (fix (/ (vlax-curve-getdistatparam e1 (vlax-curve-getendparam e1)) 100.))
                (setq l2 (cons (vlax-curve-getpointatdist e1 n) l2))
                (setq n (+ n k))
                )
              (if (< (car (vlax-curve-getstartpoint sn)) (car (vlax-curve-getendpoint sn)))
                (setq l1 (reverse l1)
                      l2 (reverse l2)
                      )
                )
              (Text l l1 l2)
              (entmakex (list '(0 . "TEXT")
                              '(40 . 10.0)
                              (cons 10 (setq pt (vlax-curve-getstartpoint e)))
                              (cons 11 pt)
                              (cons 1 "0.0Km.")
                              (cons 50 r)
                              )
                        )
              (setq e nil
                    i 0.0
                    )
              )
       (princ "\n Polyline is shorter than 100.0 units long !!")
       )
     (setq l1 nil
           l2 nil
           )
     )
   (princ)
   )
 (princ)
 )

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...