Burrr Posted May 27, 2019 Share Posted May 27, 2019 Hey guys, I have a task to do with lisp. So I want to choose 3 points (getpoint) in autoCAD, connect them with a closed line and define the points with the pointstyle 33 (pdmode). My "coding" so far: ( defun c:punktverb () ; ; LISP fragt nacheinander drei Punkte ab und stellt sie als geschlossenen Linienzug dar mit dem Punkstil 33 (alert "Geben Sie drei Punkte ein") ; Eingabe von Punkten (setq p1 (getpoint "Eingabe von Punkt 1")) (setq p2 (getpoint "Eingabe von Punkt 2")) (setq p3 (getpoint "Eingabe von Punkt 3")) (setq x1 (nth 0 p1) y1 (nth 0 p1) x2 (nth 0 p2) y2 (nth 0 p2) x3 (nth 0 p3) y3 (nth 0 p3)) (command "_line" (list x1 y1) (list x2 y2) (list x3 y3)"") So my problem is, after I choosed the three points in CAD, I get a line, but the line is straight and dont lies on the points. In addition the line isnt a straight line, its splitted in two. I appreciate every help Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted May 27, 2019 Share Posted May 27, 2019 (setq y# (nth 1 p#)) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 27, 2019 Share Posted May 27, 2019 Hi, Simple codes for you to learn from. (defun c:punktverb ( / p1 p2 p3) (and (setq p1 (getpoint "Eingabe von Punkt 1")) (setq p2 (getpoint "Eingabe von Punkt 2")) (setq p3 (getpoint "Eingabe von Punkt 3")) (entmake (list '(0 . "LINE") (cons 10 p1) (cons 11 p2))) (entmake (list '(0 . "LINE") (cons 10 p2) (cons 11 p3))) (entmake (list '(0 . "LINE") (cons 10 p3) (cons 11 p1))) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 27, 2019 Share Posted May 27, 2019 (edited) Just for fun ; LISP fragt nacheinander drei Punkte ab und stellt sie als geschlossenen Linienzug dar mit dem Punkstil 33 (defun c:punktverb ( / mygetpoint lst p_lst cnt) (alert "Geben Sie drei Punkte ein") (defun mygetpoint (p_txt / pt ) (setq pt (getpoint (strcat "\nEingabe von Punkt " p_txt " : "))) (entmake (list (cons 0 "POINT") (cons 10 pt))) pt );end_defun (setvar 'pdmode 33) (setq lst (list "1" "2" "3")) (mapcar '(lambda (x) (setq p_lst (cons (mygetpoint x) p_lst))) lst) (setq p_lst (reverse (cons (last p_lst) p_lst)) cnt 0 );end_setq (repeat (1- (length p_lst)) (entmake (list '(0 . "LINE") (cons 10 (nth cnt p_lst)) (cons 11 (nth (1+ cnt) p_lst)))) (setq cnt (1+ cnt)) );end_repeat (princ) );end_defun Edited May 27, 2019 by dlanorh Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 28, 2019 Share Posted May 28, 2019 My $0.05 (command "line" p1 p2 p3 p1 "") or (command "pline" p1 p2 p3 "c") Quote Link to comment Share on other sites More sharing options...
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.