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

0 Members and 1 Guest are viewing this topic.

hyposmurf

  • Guest
Re: Generate a Pline from a list of points?
« Reply #15 on: March 04, 2006, 11:16:19 AM »
Side tracking I know, but it has to be said as well as producing nice code you have one very cool avatar. :-)

LE

  • Guest
Re: Generate a Pline from a list of points?
« Reply #16 on: March 04, 2006, 11:32:12 AM »
Evgeniy;

My question was in general, since I noticed that the topic is how to generate a pline from a list of points, all the code provided was just for straight pline...

Here is one code to generate a pline with straight and curve segments.

Download the ZIP file.... please and open pline_vlisp.lsp

Have fun.
Luis Esquivel

Correction: Removing the code and placing it into a ZIP file...
« Last Edit: March 04, 2006, 04:41:21 PM by LE »

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Generate a Pline from a list of points?
« Reply #17 on: March 04, 2006, 11:35:39 AM »
Side tracking I know, but it has to be said as well as producing nice code you have one very cool avatar. :-)
AutoCad 2000 + Accurender

PS. Modify =>  + Photoshop
« Last Edit: March 04, 2006, 12:31:35 PM by ElpanovEvgeniy »

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Generate a Pline from a list of points?
« Reply #18 on: March 04, 2006, 12:14:49 PM »
Very cool the code!
You could see only my public code.
My work code I cannot show. :-(

LE

  • Guest
Re: Generate a Pline from a list of points?
« Reply #19 on: March 04, 2006, 12:21:01 PM »
Very cool the code!
You could see only my public code.
My work code I cannot show. :-(

No problem... for what I have seen so far, looks like you really know how to code and you are a problem solver...

Again welcome here...
« Last Edit: March 06, 2006, 10:53:02 AM by LE »

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Generate a Pline from a list of points?
« Reply #20 on: March 05, 2006, 06:49:39 PM »
I work with polylines much...
My old programs:

Reverse "LWPOLYLINE"
Code: [Select]
(defun c:rlw (/ E LW X1 X2 X3 X4 X5 X6)
  (if (and (setq lw (car (entsel "\nSelect lwpolyline")))
           (= (cdr (assoc 0 (setq e (entget lw)))) "LWPOLYLINE")
      ) ;_  and
    (progn
      (foreach a1 e
        (cond
          ((= (car a1) 10) (setq x2 (cons a1 x2)))
          ((= (car a1) 40) (setq x4 (cons (cons 41 (cdr a1)) x4)))
          ((= (car a1) 41) (setq x3 (cons (cons 40 (cdr a1)) x3)))
          ((= (car a1) 42) (setq x5 (cons (cons 42 (- (cdr a1))) x5)))
          ((= (car a1) 210) (setq x6 (cons a1 x6)))
          (t (setq x1 (cons a1 x1)))
        ) ;_  cond
      ) ;_  foreach
      (entmod
        (append
          (reverse x1)
          (append
            (apply
              (function append)
              (apply
                (function mapcar)
                (cons
                  'list
                  (list x2
                        (cdr (reverse (cons (car x3) (reverse x3))))
                        (cdr (reverse (cons (car x4) (reverse x4))))
                        (cdr (reverse (cons (car x5) (reverse x5))))
                  ) ;_  list
                ) ;_  cons
              ) ;_  apply
            ) ;_  apply
            x6
          ) ;_  append
        ) ;_  append
      ) ;_  entmod
      (entupd lw)
    ) ;_  progn
  ) ;_  if
) ;_  defun

Direction "LWPOLYLINE" 
Code: [Select]
(defun c:lwcl (/ LW LST MAXP MINP)
  (setq lw (vlax-ename->vla-object (car (entsel))))
  (vla-GetBoundingBox lw 'MinP 'MaxP)
  (setq
    minp (vlax-safearray->list minp)
    MaxP (vlax-safearray->list MaxP)
    lst  (mapcar
           (function
             (lambda (x)
               (vlax-curve-getParamAtPoint
                 lw
                 (vlax-curve-getClosestPointTo lw x)
               ) ;_  vlax-curve-getParamAtPoint
             ) ;_  lambda
           ) ;_  function
           (list minp
                 (list (car minp) (cadr MaxP))
                 MaxP
                 (list (car MaxP) (cadr minp))
           ) ;_  list
         ) ;_  mapcar
  ) ;_  setq
  (if (or
        (<= (car lst) (cadr lst) (caddr lst) (cadddr lst))
        (<= (cadr lst) (caddr lst) (cadddr lst) (car lst))
        (<= (caddr lst) (cadddr lst) (car lst) (cadr lst))
        (<= (cadddr lst) (car lst) (cadr lst) (caddr lst))
      ) ;_  or
    t
  ) ;_  if
) ;_  defun

LE

  • Guest
Re: Generate a Pline from a list of points?
« Reply #21 on: March 05, 2006, 05:51:08 PM »
I work with polylines much...
My old programs:

Reverse "LWPOLYLINE"
Code: [Select]
(defun c:rlw (/ E LW X1 X2 X3 X4 X5 X6)
 ) ;_  defun

Direction "LWPOLYLINE" 
Code: [Select]
(defun c:lwcl (/ LW LST MAXP MINP)
  (setq lw (vlax-ename->vla-object (car (entsel))))
  (vla-GetBoundingBox lw 'MinP 'MaxP)
 ) ;_  defun


I am testing C:LWCL ... it always returning NIL.... what is supposed to do? or what I am doing wrong here...

Thanks.

Serge J. Gianolla

  • Guest
Re: Generate a Pline from a list of points?
« Reply #22 on: March 05, 2006, 06:00:36 PM »
Quote
I am testing C:LWCL ... it always returning NIL.... what is supposed to do?


Not tested it, but I think it is checking if pline drawn CW or CCW!

LE

  • Guest
Re: Generate a Pline from a list of points?
« Reply #23 on: March 05, 2006, 06:01:38 PM »
Eso entendi Sergio... solo que a mi me regresa solamente NIL

He he...

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Generate a Pline from a list of points?
« Reply #24 on: March 05, 2006, 06:04:10 PM »
Code: [Select]
(entmakex
  '((0 . "LWPOLYLINE")
    (100 . "AcDbEntity")
    (100 . "AcDbPolyline")
    (90 . 4)
    (70 . 1)
    (10 0. 0.)
    (10 100. 0.)
    (10 100. 100.)
    (10 0. 100.)
   )
) ;_  entmakex
c:lwcl=> NIL

(entmakex
  '((0 . "LWPOLYLINE")
    (100 . "AcDbEntity")
    (100 . "AcDbPolyline")
    (90 . 4)
    (70 . 1)
    (10 0. 0.)
    (10 0. 100.)
    (10 100. 100.)
    (10 100. 0.)
   )
) ;_  entmakex
c:lwcl => T

Serge J. Gianolla

  • Guest
Re: Generate a Pline from a list of points?
« Reply #25 on: March 05, 2006, 06:05:06 PM »
Hey Luis,
How you do that? You are not listed in users on line, and yet!!!!

LE

  • Guest
Re: Generate a Pline from a list of points?
« Reply #26 on: March 05, 2006, 06:08:32 PM »
OK,

I got it working now...

Thanks.

Serge J. Gianolla

  • Guest
Re: Generate a Pline from a list of points?
« Reply #27 on: March 05, 2006, 06:09:58 PM »
Mi scusi, Luis

The thingy [yeah I get technical at times] on the left says you are offline. Neat!

LE

  • Guest
Re: Generate a Pline from a list of points?
« Reply #28 on: March 05, 2006, 06:12:23 PM »
 :-D

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Generate a Pline from a list of points?
« Reply #29 on: March 05, 2006, 06:18:39 PM »
Serge ;
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.