Jump to content

lisp turns points on a curve into points on a straight line


Hải_Duy

Recommended Posts

Untested, but should work... Otherwise, good start point for develop...

 

(defun c:stripptscur-lin ( / ss s1 i pt pl c dists len p )

  (vl-load-com)

  (prompt "\nSelect curve with points that lie on it...")
  (if (setq ss (ssget))
    (progn
      (sssetfirst nil ss)
      (setq s1 (ssget "_I" '((0 . "POINT"))))
      (sssetfirst)
      (repeat (setq i (sslength s1))
        (setq pt (ssname s1 (setq i (1- i))))
        (ssdel pt ss)
        (setq pl (cons (cdr (assoc 10 (entget pt))) pl))
      )
      (setq c (ssname ss 0))
      (setq pl (vl-sort pl '(lambda ( a b ) (< (vlax-curve-getparamatpoint c a) (vlax-curve-getparamatpoint c b)))))
      (foreach p pl
        (setq dists (cons (vlax-curve-getdistatpoint c p) dists))
      )
      (setq len (vlax-curve-getdistatparam c (vlax-curve-getendparam c)))
      (initget 1)
      (setq p (getpoint "\nPick or specify point to place line : "))
      (entmake (list (cons 0 "LINE") (cons 10 p) (cons 11 (polar p 0.0 len))))
      (foreach dist (reverse dists)
        (entmake (list (cons 0 "POINT") (cons 10 (polar p 0.0 dist))))
      )
    )
  )
  (princ)
)

 

HTH.

M.R.

Edited by marko_ribar
  • Like 1
Link to comment
Share on other sites

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