mdbdesign Posted February 13, 2014 Share Posted February 13, 2014 As per picture: How I can do it with help of lisp? Was trying to position it on AutoCAD but got no idea how without trial and error. Brain dead stage. Please help. Axis 0X and 0Y is the limit. Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted February 14, 2014 Share Posted February 14, 2014 Hi Marek I've tried to solve this problem some time ago and I couldn't find an exact mathematical solution using lisp, but just a (good) approximation. I'll post it if you are interested, although it is a slightly different arrangement: the line starting from the known point H is perpendicular to the midpoint of the segment AB. Anyway, you can use constraints to achieve the same result, or a dynamic block. brackets.dwg Quote Link to comment Share on other sites More sharing options...
mdbdesign Posted February 14, 2014 Author Share Posted February 14, 2014 Hi Marek I've tried to solve this problem some time ago and I couldn't find an exact mathematical solution using lisp, but just a (good) approximation. I'll post it if you are interested, although it is a slightly different arrangement: the line starting from the known point H is perpendicular to the midpoint of the segment AB. Anyway, you can use constraints to achieve the same result, or a dynamic block. [ATTACH]46884[/ATTACH] Stefan, anything solving this problem is very needed. Please post it. I did try constraints. Just wonder about AutoCAD function "grread" that let object slide along line(?) and combining it with constraints maybe work-this is still magic for me. Quote Link to comment Share on other sites More sharing options...
GP_ Posted February 14, 2014 Share Posted February 14, 2014 My attempt (for x and y positive). (defun c:test ( / p ab p1 p2 d ) (setq p (getpoint "Pick a point ")) (setq ab (getdist "\nLength Line ")) (if (< ab (cadr p)) (progn (setq p1 (list 0.0 ab)) (setq d ab) (while (not (equal (cadr p2) 0.0 1e-12)) (setq p2 (polar p1 (- (angle p1 p) (* pi 0.5)) ab)) (if (> (car p2) 0.0) (cond ( (< (cadr p2) 0.0) (setq p1 (polar p1 (* pi 0.5) (setq d (* d 0.5)))) ) ( (> (cadr p2) 0.0) (setq p1 (polar p1 (* pi 1.5) (setq d (* d 0.5)))) ) ) ) ) (setq p1 (list 0.0 (cadr p1))) (setq p2 (list (car p2) 0.0)) (entmake (list '(0 . "LINE") (cons 10 p1) (cons 11 p2))) (grdraw p p1 1 1) (princ (strcat "\nDistance = " (rtos (distance p p1)))) ) (alert (strcat "Out of range" "\nLength max = " (rtos (cadr p)))) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
mdbdesign Posted February 14, 2014 Author Share Posted February 14, 2014 Awesome. Thank you. We almost there. What about actually selecting x and y, because it's always away from standard 0,0 coord and remove limit of location of pick first point? Something like: Pick point: Pick x line: (horizontal) Pick y line: (vertical) Enter length of line: Quote Link to comment Share on other sites More sharing options...
mdbdesign Posted February 14, 2014 Author Share Posted February 14, 2014 After few cosmetics operation (move, rotate, align with 0,0) I achieve what I needed. Big kiss for Valentine Day. Thank you. 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.