Thanks lee mac for the last code that is was seeking in last week. (Great)
But to my surprise on Thursday i have to make another routine where the user guess a length between x line segment. I called this line segment y1. Then the code have to calculate the y line segment and add this to the y1 line segment to give the the space between the x line segments.
An example:
User input:
Distance between 1 st. point and 2.nd is 135mm.
Weld length x is 25mm.
A guess weld length y1 is 20mm
Lisp routine:
- Then the code should calculate the y line segment to 10mm and draw the polyline.
I have tried to make some change to code but no luck:
(defun c:wzz ( / a d h i l n p q x y y1) (setq h 20.0) (if (and (setq x (getdist "\nWeld Length: ")) (setq y1 (getreal "\nGuess a Weld length space: ")) (setq p (getpoint "\n1st Point: ")) (setq q (getpoint "\n2nd Point: " p)) (setq p (trans p 1 0) q (trans q 1 0) a (angle p q) d (distance p q) i (/ pi 2.0) n (fix (/ d (x+y1))) ) ) (if (< 0 n) (progn (setq y (/ (- d (* x (1+ n))) n)) (repeat n (setq l (cons (cons 10 p) l) l (cons (cons 10 (setq p (polar p a x))) l) l (cons (cons 10 (setq p (polar p (- a i) h))) l) l (cons (cons 10 (setq p (polar p a y))) l) l (cons (cons 10 (setq p (polar p (+ a i) h))) l) ) ) (entmake (append (list '(000 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (1+ (length l))) '(70 . 0) ) (reverse (cons (cons 10 (polar p a x)) l)) ) ) ) (princ "\nDistance too small.") ) ) (princ))