Author Topic: Generate a Pline from a list of points?  (Read 25363 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Generate a Pline from a list of points?
« Reply #30 on: March 05, 2006, 06:20:37 PM »
OK,

I got it working now...

Thanks.

Luis,
Did you change the code, or just determine what it was doing ?  :-)
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.

LE

  • Guest
Re: Generate a Pline from a list of points?
« Reply #31 on: March 05, 2006, 06:24:52 PM »
Did you change the code, or just determine what it was doing ?  :-)

The code was OK... for some reasons it was showing only NIL... my bad doing wrong testing.... it is Sunday and did a lot of handy-man work today - excuse # 232434556436

Serge J. Gianolla

  • Guest
Re: Generate a Pline from a list of points?
« Reply #32 on: March 05, 2006, 06:31:18 PM »
Quote
it is Sunday and did a lot of handy-man work today

No placido Domingo 4 u?

Quote
Eso entendi Sergio... solo que a mi me regresa solamente NIL

It works now. Tell you what, that Evgeniy is a man of few words, programmatically. He has a knack in compressing to simplest core.

Thanks Kerry, it appears that there is more than meet the eyes on that new forum!

LE

  • Guest
Re: Generate a Pline from a list of points?
« Reply #33 on: March 05, 2006, 06:37:56 PM »
It works now. Tell you what, that Evgeniy is a man of few words, programmatically. He has a knack in compressing to simplest core.

 :kewl:

And very good for this forum....

LE

  • Guest
Re: Generate a Pline from a list of points?
« Reply #34 on: March 05, 2006, 06:42:59 PM »
Evgeniy;

Вы пишете в другом языке программирования?

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Generate a Pline from a list of points?
« Reply #35 on: March 05, 2006, 06:44:40 PM »
And very good for this forum....
Thanks  :-)
My the friend has shown this forum - (kpblc)
http://www.theswamp.org/index.php?action=profile;u=1044

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Generate a Pline from a list of points?
« Reply #36 on: March 05, 2006, 06:48:05 PM »
Evgeniy;

Вы пишете в другом языке программирования?
Почти нет, основные AutoLISP, DCL и SQL...
« Last Edit: March 05, 2006, 06:52:40 PM by ElpanovEvgeniy »

snoopychen

  • Guest
Re: Generate a Pline from a list of points?
« Reply #37 on: March 06, 2006, 02:09:27 AM »
ElpanovEvgeniy
Thank you very much for your help.
Now I can draw a pl with different bulge width from a list.
I think it can be use for match two pline with some character, for example, width or bulge.
Most of the following code comes from you:),Thank you~
Code: [Select]
(defun c:test()
(if (and (setq en (car (entsel)))
         (= (cdr (assoc 0 (entget en))) "LWPOLYLINE")
    ) ;_  and
  (setq lst-pt    (mapcar (function cdr)
                          (vl-remove-if-not (function (lambda (a) (= (car a) 10))) (entget en))
                  ) ;_  mapcar
        lst-bulge (mapcar (function cdr)
                          (vl-remove-if-not (function (lambda (a) (= (car a) 42))) (entget en))
                  )
        lst-w1    (mapcar (function cdr)
                          (vl-remove-if-not (function (lambda (a) (= (car a) 40))) (entget en))
                         
                  ) ;_  mapcar
        lst-w2 (mapcar (function cdr)
                          (vl-remove-if-not (function (lambda (a) (= (car a) 41))) (entget en))
                  ) ;_  mapcar
  ) ;_  setq
 
       
  )
) ;_  if


(defun c:test1()
(entmakex
  (apply
    (function append)
    (cons
      (list
        '(0 . "LWPOLYLINE")
        '(100 . "AcDbEntity")
        '(67 . 0)
        '(410 . "Model")
        '(8 . "New_polyline")
        '(62 . 3)
        '(100 . "AcDbPolyline")
        (cons 90 (length lst-pt))
        '(70 . 0)
        ;;'(70 . 1) = Closed
      ) ;_  list
      (mapcar
        (function list)
        (mapcar (function (lambda (a) (cons 10 a))) lst-pt)
        (mapcar (function (lambda (a) (cons 40 a))) lst-w1)
        (mapcar (function (lambda (a) (cons 41 a))) lst-w2)
        (mapcar (function (lambda (a) (cons 42 a))) lst-bulge)

      ) ;_  mapcar
    ) ;_  cons
  ) ;_  apply
) ;_  entmakex
)

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Generate a Pline from a list of points?
« Reply #38 on: June 05, 2006, 02:03:34 PM »
The new version lw_arc.lsp
http://www.theswamp.org/index.php?topic=8878.msg114384#msg114384

Code: [Select]
;**************** lw_arc.lsp *************************************
 ;   Substitution of a linear segment in a polyline
 ;   The arc segment.
 ;   Writer Evgeniy Elpanov.
 ;   Last edit 04.06.06
(defun C:LW_ARC (/  LW i P1 P2 P3)
 (vl-load-com)
 (or doc (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))))
 (if (and (setq lw (entsel "\n Select the necessary segment in a polyline. "))
          (= (cdr (assoc 0 (entget (car lw)))) "LWPOLYLINE")
     ) ;_  and
  (progn
   (setq i  (fix (vlax-curve-getParamAtPoint
                  (car
                   lw
                  ) ;_  car
                  (vlax-curve-getClosestPointTo (car lw) (cadr lw))
                 ) ;_  vlax-curve-getParamAtPoint
            ) ;_  fix
         p1 (vlax-curve-getPointAtParam (car lw) i)
         p3 (vlax-curve-getPointAtParam (car lw) (1+ i))
         lw (vlax-ename->vla-object (car lw))
   ) ;_  setq
   (princ "\n Set visually a curvature of a segment. ")
   (vla-StartUndoMark doc)
   (while (and (setq p2 (grread 5)) (= (car p2) 5))
    (vla-SetBulge
     lw
     i
     ((lambda (a) (/ (sin a) (cos a)))
      (/ (- (angle p1 (cadr p2)) (angle (cadr p2) p3)) -2.)
     )
    ) ;_  vla-SetBulge
   ) ;_  while
   (vla-EndUndoMark doc)
  ) ;_  progn
  (princ "\n It is selected nothing or plant not a polyline. ")
 ) ;_  if
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Generate a Pline from a list of points?
« Reply #39 on: June 05, 2006, 04:52:52 PM »
Evgeniy,
I like that a lot. :-)
You do good work. 8-)
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.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Generate a Pline from a list of points?
« Reply #40 on: June 06, 2006, 12:48:05 PM »
Evgeniy,
I like that a lot. :-)
You do good work. 8-)

Yes, I will second that.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Generate a Pline from a list of points?
« Reply #41 on: June 06, 2006, 01:28:21 PM »
> Alan and Gary
Thank you! :-)

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Generate a Pline from a list of points?
« Reply #42 on: June 08, 2006, 01:16:05 PM »
Generate a Pline from a list of points and bulge

If you have (and lst-pt lst-bulge):
Code: [Select]
(if (and (setq en (car (entsel)))
         (= (cdr (assoc 0 (entget en))) "LWPOLYLINE")
    ) ;_  and
  (setq lst-pt    (mapcar (function cdr)
                          (vl-remove-if-not (function (lambda (a) (= (car a) 10))) (entget en))
                  ) ;_  mapcar
        lst-bulge (mapcar (function cdr)
                          (vl-remove-if-not (function (lambda (a) (= (car a) 42))) (entget en))
                  ) ;_  mapcar
  ) ;_  setq
) ;_  if

Example:
Code: [Select]
(entmakex
  (apply
    (function append)
    (cons
      (list
        '(0 . "LWPOLYLINE")
        '(100 . "AcDbEntity")
        '(67 . 0)
        '(410 . "Model")
        '(8 . "New_polyline")
        '(62 . 3)
        '(100 . "AcDbPolyline")
        (cons 90 (length lst-pt))
        '(70 . 0)
        ;;'(70 . 1) = Closed
      ) ;_  list
      (mapcar
        (function list)
        (mapcar (function (lambda (a) (cons 10 a))) lst-pt)
        (mapcar (function (lambda (a) (cons 42 a))) lst-bulge)
      ) ;_  mapcar
    ) ;_  cons
  ) ;_  apply
) ;_  entmakex

>LE
I have answered your question?


Why does this routine not close a polyline? I tried uncommenting the 70.1 but it spit out an error.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Generate a Pline from a list of points?
« Reply #43 on: June 08, 2006, 01:18:11 PM »
Did you comment out the (70 . 0) in front of the (70 . 1)?  You can only have one (like Highlander).
Tim

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

Please think about donating if this post helped you.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Generate a Pline from a list of points?
« Reply #44 on: June 08, 2006, 01:20:34 PM »
THERE CAN BE ONLY ONE!!!!!!  :-D Thanks. :ugly:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC