salman Posted April 19, 2009 Share Posted April 19, 2009 this question is more related to maths rather than autocad. Any how I am not able to find a solution so I am sending this post. any help will be deeply appreciated. we have two non parallel lines intersecting each other. Now we offset first line by x distance and the second one by y distance and their point of intersection changes. I want to know how can we find the coordinates of their new point of intersection. Thanks. Quote Link to comment Share on other sites More sharing options...
dbroada Posted April 19, 2009 Share Posted April 19, 2009 I would fillet the lines with 0 radius Quote Link to comment Share on other sites More sharing options...
lpseifert Posted April 19, 2009 Share Posted April 19, 2009 here's a quicky... returns a list of the intersection point(s) (defun c:test () (vl-load-com) (setq obj1 (vlax-ename->vla-object (car (entsel "\nPick first object: "))) obj2 (vlax-ename->vla-object (car (entsel "\nPick object to intersect: "))) ) (setq var (vla-intersectwith obj1 obj2 acExtendBoth) sa (vlax-variant-value var) ip (vlax-safearray->list sa) ) ) Quote Link to comment Share on other sites More sharing options...
David Bethel Posted April 19, 2009 Share Posted April 19, 2009 Or in plain AutoLisp, even if the lines no longer intersect: [b][color=BLACK]([/color][/b]defun c:lint [b][color=FUCHSIA]([/color][/b]/ s1 s2 l1 l2[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]or [b][color=MAROON]([/color][/b]not s1[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]> [b][color=GREEN]([/color][/b]sslength s1[b][color=GREEN])[/color][/b] 1[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]princ [color=#2f4f4f]"\nSelect 1st Line: "[/color][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq s1 [b][color=MAROON]([/color][/b]ssget '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"LINE"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]or [b][color=MAROON]([/color][/b]not s2[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]> [b][color=GREEN]([/color][/b]sslength s2[b][color=GREEN])[/color][/b] 1[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]princ [color=#2f4f4f]"\nSelect 2nd Line: "[/color][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq s2 [b][color=MAROON]([/color][/b]ssget '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"LINE"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq l1 [b][color=NAVY]([/color][/b]ssname s1 0[b][color=NAVY])[/color][/b] l2 [b][color=NAVY]([/color][/b]ssname s2 0[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]inters [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 10 [b][color=GREEN]([/color][/b]entget l1[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 11 [b][color=GREEN]([/color][/b]entget l1[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 10 [b][color=GREEN]([/color][/b]entget l2[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 11 [b][color=GREEN]([/color][/b]entget l2[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] nil[b][color=FUCHSIA])[/color][/b] [b][color=BLACK])[/color][/b] Hopefully the lines are 2D and in the same plane. -David Quote Link to comment Share on other sites More sharing options...
lpseifert Posted April 19, 2009 Share Posted April 19, 2009 I must have been bored... (defun c:test () (vl-load-com) (setq oldsnap(getvar "osmode") oldecho (getvar "cmdecho")) (setvar "osmode" 0) (setvar "cmdecho" 0) (setq ent1 (entsel "\nSelect first object to offset: ") od1 (getdist "\nSpecify offset distance: ") pt1 (getpoint "\nSpecify point on side to offset: ")) (vl-cmdf "offset" od1 ent1 pt1 "") (setq obj1 (vlax-ename->vla-object (entlast))) (setq ent2 (entsel "\nSelect second object to offset: ") od2 (getdist "\nSpecify offset distance: ") pt2 (getpoint "\nSpecify point on side to offset: ")) (vl-cmdf "offset" od2 ent2 pt2 "") (setq obj2 (vlax-ename->vla-object (entlast))) (setq var (vla-intersectwith obj1 obj2 acExtendBoth) sa (vlax-variant-value var) ip (vlax-safearray->list sa) ) (print (strcat "The intersection point is " (rtos (car ip) 2 2)","(rtos (cadr ip)2 2)","(rtos (caddr ip)2 2))) (entdel (entlast)) (entdel (entlast)) (setvar "osmode" oldsnap) (setvar "cmdecho" oldecho) (princ) ) Quote Link to comment Share on other sites More sharing options...
fuccaro Posted April 20, 2009 Share Posted April 20, 2009 You can use the quick calculator to find-out intersection points. From the AutoCAD help file: ill(p1,p2,p3,p4) Determines the intersection point between two lines (p1,p2) and (p3,p4). All points are considered three-dimensional. 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.