+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Full Member
    Using
    AutoCAD 2012
    Join Date
    May 2012
    Posts
    63

    Default Alignment with offset and chainage Lisp

    Registered forum members do not see this ad.

    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.

  2. #2
    Forum Deity Organic's Avatar
    Discipline
    Civil
    Using
    AutoCAD 2015
    Join Date
    Feb 2009
    Posts
    2,206

    Default

    Yes, it is possible for that to be done.

  3. #3
    Full Member
    Using
    AutoCAD 2012
    Join Date
    May 2012
    Posts
    63

    Default

    How? I can not make it.

  4. #4
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electrical.
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Great Syria , Lives in Abu Dhabi
    Posts
    4,020

    Default

    Can you post a snapshot or upload a sample drawing ?
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  5. #5
    Full Member
    Using
    AutoCAD 2012
    Join Date
    May 2012
    Posts
    63

    Default

    Quote Originally Posted by Tharwat View Post
    Can you post a snapshot or upload a sample drawing ?
    Sure. Just check the sample.........
    Drawing1-Model.jpg

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,919

    Default

    This will help you with the offset:

    http://lee-mac.com/doubleoffset.html
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  7. #7
    Full Member
    Using
    AutoCAD 2012
    Join Date
    May 2012
    Posts
    63

    Default

    Quote Originally Posted by Lee Mac View Post
    This will help you with the offset:

    http://lee-mac.com/doubleoffset.html
    Thank you Lee. But I actually need the chainage with double offset.

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,919

    Default

    Quote Originally Posted by souvik View Post
    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.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  9. #9
    Full Member
    Using
    AutoCAD 2012
    Join Date
    May 2012
    Posts
    63

    Default

    Quote Originally Posted by Lee Mac View Post
    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.

  10. #10
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electrical.
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Great Syria , Lives in Abu Dhabi
    Posts
    4,020

    Default

    Registered forum members do not see this ad.

    Try this draft ...

    Code:
    (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)
      )
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

Similar Threads

  1. Replies: 6
    Last Post: 11th Sep 2012, 08:20 pm
  2. Road alignment drafting problem using lisp routine
    By aloy in forum AutoLISP, Visual LISP & DCL
    Replies: 16
    Last Post: 23rd Jun 2012, 11:47 pm
  3. Lisp for Civil 3D objects - Station from Alignment into a User Defined Property
    By Bill_Myron in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 21st Mar 2012, 04:00 pm
  4. Horizonal Alignment Lisp Inquiry
    By runner214 in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 26th Apr 2010, 08:50 am
  5. importing alignment points (sta,offset,elev)
    By shooter1 in forum AutoCAD Beginners' Area
    Replies: 1
    Last Post: 18th Mar 2010, 06:23 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts