Author Topic: Convert a line to a wave  (Read 2661 times)

0 Members and 1 Guest are viewing this topic.

diarmuid

  • Bull Frog
  • Posts: 417
Convert a line to a wave
« on: February 24, 2010, 09:34:25 AM »
I had an old lisp routine that used to draw a wave type line.  This was not associate with any linetype file etc.  so could in effect standalone.  Does wnybody now of a lisp that could draw a line or convert a line to the attached image


If you want to win something run the 100m, if you want to experience something run a marathon

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Convert a line to a wave
« Reply #1 on: February 24, 2010, 09:39:15 AM »
Your image is not attached.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

diarmuid

  • Bull Frog
  • Posts: 417
Re: Convert a line to a wave
« Reply #2 on: February 24, 2010, 09:42:17 AM »
Oops,

forgot to attach the image.

 :oops:

Any help would be greatly appreciated

Regards

Diarmuid
If you want to win something run the 100m, if you want to experience something run a marathon

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Convert a line to a wave
« Reply #3 on: February 24, 2010, 10:04:26 AM »
It's a pline w/ bulges set to 1

diarmuid

  • Bull Frog
  • Posts: 417
Re: Convert a line to a wave
« Reply #4 on: February 24, 2010, 10:54:33 AM »
I see what you are getting at.  However, what i'm trying to do is to alter about 200 P & ID's for a client.  the lines represents a flexible hose connection.  And i was hoping to be able to pick the start and the end point and the hose is drawn.  Their standard wont allow me ot add additional linetype to their acadiso.lin or allow another .lin file. :x . I've seen similar lisp's that create and insulation type line which would not be suitable in this instance.

Again

Thanks for your help

Diarmuid
If you want to win something run the 100m, if you want to experience something run a marathon

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Convert a line to a wave
« Reply #5 on: February 24, 2010, 11:10:08 AM »
Maybe:

Code: [Select]
(defun c:hose (/ p1 p2 rad num ang i lst)

  (setq Rad 2.)
 
  (if (and (setq p1 (getpoint "\nSpecify First Point: "))
           (setq p2 (getpoint "\nSpecify Second Point: " p1)))
    (progn
      (setq num (fix (/ (distance p1 p2) (* 2. rad))) ang (angle p1 p2) i 1)

      (entmakex (append (list (cons 0 "LWPOLYLINE")
                              (cons 100 "AcDbEntity")
                              (cons 100 "AcDbPolyline")
                              (cons 90 num)
                              (cons 70 0)
                              (cons 10 p1)
                              (cons 42 i))

                        (repeat num
                          (setq lst
                            (append lst
                              (list (cons 10 (setq p1 (polar p1 ang (* 2. rad))))
                                    (cons 42 (setq i (* -1 i)))))))))))
  (princ))

diarmuid

  • Bull Frog
  • Posts: 417
Re: Convert a line to a wave
« Reply #6 on: February 24, 2010, 11:40:12 AM »
yes!!!!!!, brilliant.  Thank you thank you thank you.

Thanks for all the input form everybody.

Regards

Diarmuid
If you want to win something run the 100m, if you want to experience something run a marathon

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Convert a line to a wave
« Reply #7 on: February 24, 2010, 11:40:51 AM »
You're welcome Diarmuid  8-)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Convert a line to a wave
« Reply #8 on: February 24, 2010, 11:46:13 AM »
I guess Lee beat me to it, but here is one I wrote that will let you pick at many points as you want, pline style.  It might overlap itself at corners, but well I didn't want to spend that much time on it.

Code: [Select]
(defun c:WavePline (/ DivideDistance EntList Blg Pt nPt cnt Dist Sc )
   
    (defun DivideDistance ( sPt ePt dist / Ang tempDist SpDist Amnt )
       
        (setq Ang (angle sPt ePt))
        (setq tempDist (distance sPt ePt))
        (setq SpDist (/ tempDist (setq Amnt (fix (/ tempDist dist)))))
        (setq Amnt (1+ Amnt))
        (setq cnt (+ Amnt cnt))
        (repeat Amnt
            (setq EntList
                (cons
                    (cons 42 (setq Blg (- Blg)))
                    (cons
                        (cons 41 0.)
                        (cons
                            (cons 40 0.)
                            (cons
                                (cons 10 (list (car sPt) (cadr sPt)))
                                EntList
                            )
                        )
                    )
                )
            )
            (setq sPt (polar sPt Ang SpDist))
        )
        EntList
    )
    ;-------------------------------------------------
    (setq Dist 0.4)
    (setq Sc (getvar 'LtScale))
    (setq EntList
        (list
            (cons 90 2)
            (cons 100 "AcDbPolyline")
            (cons 100 "AcDbEntity")
            (cons 0 "LWPOLYLINE")
        )
    )
    (setq Blg 1.)
    (setq cnt 0)
    (if (setq Pt (getpoint "\n Select first point: "))
        (progn
            (while (setq nPt (getpoint Pt "\n Select next point: "))
                (setq EntList (DivideDistance Pt nPt (* Dist Sc)))
                (setq Pt nPt)
                (setq cnt (1+ cnt))
            )
            (entmake (subst (cons 90 cnt) '(90 . 2) (reverse EntList)))
        )
    )
    (princ)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

diarmuid

  • Bull Frog
  • Posts: 417
Re: Convert a line to a wave
« Reply #9 on: February 24, 2010, 11:50:41 AM »
you guys are just showing off now.

Thanks man
If you want to win something run the 100m, if you want to experience something run a marathon