kleber Posted January 18, 2022 Posted January 18, 2022 Hi, I was wondering if anyone could help me with a simple (I assume) lisp. Essentially I would like to the lisp to: -Prompt the user to select a line or polyline (1st element). "Select pipe line" -Prompt the user to select a point within the selected line/polyline (1st point) "Select connection point" -Prompt the user to select a second line or polyline (2nd element) "Select boundary line" -Create a line perpendicular to the 1st element which extends 1m beyond the 2nd element (2nd point). Thanks Quote
BIGAL Posted January 18, 2022 Posted January 18, 2022 (edited) Google "draw line perp to point lisp autocad". There are numerous solutions out there already. Then will need a extend 1m added. Note step1 & 2 are actually 1 step when select point on line etc. Thinking aloud can get 1stderiv angle of line/pline at a point use xline to intersect with 2nd object then extend. Edited January 18, 2022 by BIGAL Quote
kleber Posted January 19, 2022 Author Posted January 19, 2022 Quote 11 minutes ago, BIGAL said: Thinking aloud can get 1stderiv angle of line/pline at a point use xline to intersect with 2nd object then extend. Gosh, I wished I could understand what you are talking about Quote
devitg Posted January 19, 2022 Posted January 19, 2022 For better understanding, and maybe get further help, please upload such sample.dwg Quote
BIGAL Posted January 19, 2022 Posted January 19, 2022 (edited) Try this found problem the xline is a bit fussy about ang direction. ; https://www.cadtutor.net/forum/topic/74329-perpendicular-extend-beyond-1m/ ; line sq off line pline crossing another line + 1 to dist ; By AlanH info@alanh.com.au Jan 2022 (defun c:sqp ( / ent obj pt ang obj2 obj3 intpt oldsnap oldang) (defun alg-ang (objpl pnt) (angle '(0. 0. 0.) (vlax-curve-getfirstderiv objpl (vlax-curve-getparamatpoint objpl pnt ) ) ) ) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 512) (setq oldang (getvar 'aunits)) (setvar 'aunits 3) (setq oldangbase (getvar 'angbase)) (setvar 'angbase 0) (setq oldangdir (getvar 'angdir)) (setvar 'angdir 0) (setq ent (entsel "\Pick line or pline pt ")) (setq pt (cadr ent)) (setq obj (vlax-ename->vla-object (car ent))) (setq pt (vlax-curve-getclosestpointto obj pt)) (setq obname (vla-get-objectname obj)) (setq ang (+ (alg-ang obj pt) (/ pi 2.0))) (setq obj3 (vlax-ename->vla-object (car (entsel "\nPick other object" )))) (command "xline" "A" ang pt "") (setq obj2 (vlax-ename->vla-object (entlast))) (setq intpt (vlax-invoke obj2 'intersectWith obj3 acExtendnone)) (command "erase" (entlast) "") (setq pt2 (polar pt (angle pt intpt) (+ 1.0 (distance pt intpt)))) (command "LINE" pt pt2 "") (setvar 'osmode oldsnap) (setvar 'aunits oldang) (setvar 'angdir oldangdir) (setvar 'angbase oldangbase) (princ) ) (c:sqp) Edited January 19, 2022 by BIGAL Quote
kleber Posted January 19, 2022 Author Posted January 19, 2022 Hi Bigal, that's AWESOME! Thank you so much. But after testing I realized the brief was not quite right. Would be possible to make a few changes to this function? What if I want to include a 3rd line for the user to pick which would define another offset. Basically, the second point (pt2) is an intersection of 1st and 2nd bdy lines as shown in picture below. However starting from that intersection point might be another solution. Cheers Quote
BIGAL Posted January 19, 2022 Posted January 19, 2022 Yes have that, if you had said for sewer house lot connections would have done that, I did multiple lots in one go, pick "100" line then drag over lot boundaries all done. That is why its a good idea to always post at least an image. Had a look and I used a block so will need to change. It also takes into account angled lot boundary. Like Devitg post a sample dwg. Quote
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.