Jump to content

Recommended Posts

Posted

hi

 

i manage to write this

 

(defun C:TEST(/ l le strpt endpt)

(entmake (list (cons 0 "LWPOLYLINE")        ;***
              (cons 100 "AcDbEntity")      ;***
              (cons 8 "0")
              (cons 100 "AcDbPolyline")    ;***
              (cons 90 2)                  ;***
              (cons 10 '(40.0 432.0 0.0))         ;***
          (cons 10 '(3.0 400.0 0.0))
        )
             )

   (entmake (list (cons 0 "LWPOLYLINE")        ;***
              (cons 100 "AcDbEntity")      ;***
              (cons 8 "0")
              (cons 100 "AcDbPolyline")    ;***
              (cons 90 2)                  ;***
              (cons 10 '(4.0 400.0 0.0))         ;***
          (cons 10 '(400.0 4.0 0.0))
        )
             )

(setq l (cdr (car (entget (entlast)))))

(setq le (vlax-ename->vla-object l))
(setq strpt (vlax-curve-getPointAtParam le 0))
(setq endpt (vlax-curve-getPointAtParam le 1))

)

its working but i wonder if its the right way to go?

 

Shay

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • samifox

    7

  • Snownut

    6

  • David Bethel

    3

  • Tharwat

    2

Posted

To retrieve the first and last points of a LWPOLYLINE :

 

(defun massoc (key alist / x nlist)
 (foreach x alist
   (if (eq key (car x))
       (setq nlist (cons (cdr x) nlist))))
 (reverse nlist))
 
(and (setq ss (ssget '((0 . "LWPOLYINE"))))
    (setq i 0)
    (while (setq en (ssname ss i))
           (setq ed (entget en))
           (setq pl (massoc 10 ed))
           (setq sp (car pl))       ;start point
           (setq lp (last pl))      ;last point
           (setq i (1+ i)))))

 

-David

Posted

David,

 

I think your barking up a dead tree.....

Posted
David,

 

I think your barking up a dead tree.....

 

Yep ------------------

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...