0 Members and 1 Guest are viewing this topic.
(defun c:test ( / p )(setq xy (list (getreal "\nEnter x ") (getreal "\nEnter Y "))) (if (setq p (getpoint "\nSpecify point: ")) (entmake (list '(0 . "POINT") (cons 10 (trans (mapcar '+ p xy) 1 0)))) ) (princ))
One way with the use of polar function.Code - Auto/Visual Lisp: [Select](defun c:Test (/ p) (or (not (zerop (getvar 'PDMODE))) (setvar 'PDMODE 3)) (if (setq p (getpoint "\nSpecify a point : ")) (entmake (list '(0 . "POINT") (cons 10 (polar (polar p 0.0 1.0) (* pi 0.5) 1.0)) ) ) ) (princ))
Code - Auto/Visual Lisp: [Select](defun c:test ( / p ) (if (setq p (getpoint "\nSpecify point: ")) (entmake (list '(0 . "POINT") (cons 10 (trans (mapcar '+ p '(1 1)) 1 0)))) ) (princ))
Perhaps a bit more so X & Y can vary, could add default values if do all the time or as per image.Code: [Select](defun c:test ( / p )(setq xy (list (getreal "\nEnter x ") (getreal "\nEnter Y "))) (if (setq p (getpoint "\nSpecify point: ")) (entmake (list '(0 . "POINT") (cons 10 (trans (mapcar '+ p xy) 1 0)))) ) (princ))
Code - Auto/Visual Lisp: [Select](defun c:Test (/ p d g) (or (not (zerop (getvar 'PDMODE))) (setvar 'PDMODE 3)) (and (setq p (getpoint "\nSpecify a point : ")) (setq d (getpoint "\nSpecify X direction : " p)) (setq g (angle p d)) (entmake (list '(0 . "POINT") (cons 10 (polar (polar p g 1.0) (+ g (* pi 0.5)) 1.0)) ) ) ) (princ))
If you have the list of coordinates then you can iterate through each point with angle and distance as I did in my last reply.
If so then you can specify the angle in the routine as indicated in the codes below and change it to suit yours.Code - Auto/Visual Lisp: [Select](defun c:Test (/ p g) (or (not (zerop (getvar 'PDMODE))) (setvar 'PDMODE 3)) (and (setq p (getpoint "\nSpecify a point : ")) (setq g (* pi 0.25)) ;; = 45 Degree (entmake (list '(0 . "POINT") (cons 10 (polar (polar p g 1.0) (+ g (* pi 0.5)) 1.0)) ) ) ) (princ))