Hải_Duy Posted October 2, 2023 Posted October 2, 2023 i am looking for a lispcad that strips points on a curve to points on a straight line. help me create such a lisp, thanks! Drawing1.dwg Quote
marko_ribar Posted October 2, 2023 Posted October 2, 2023 (edited) 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 October 2, 2023 by marko_ribar 1 Quote
Hải_Duy Posted October 2, 2023 Author Posted October 2, 2023 @marko_ribar thanks for your great code, it's helpful for me Quote
Recommended Posts
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.