Brandonhar Posted April 25, 2014 Posted April 25, 2014 I am looking for some routine help...I'm sure there is a way to acheive this but I am new to the LISP programming scene. Any help to get me started would be GREATLY appreciated!!! Here's what I'm looking for...I would like the user to pick the first point and select a "path" around objects (having the flexibility to use snaps of course) and pick the last point. With the program maintaining certain criteria around objects? I've attached a couple of PDF's that may help explain this better... Again, any help would be greatly appreciated!!! User inputs.pdf Finished pline.pdf Quote
marko_ribar Posted April 25, 2014 Posted April 25, 2014 It's far more reliable if you draw this manually than make the program to do it and beside that the purpose of this routine isn't clear... You can draw this quick and fast and make score, but I just can't see where you can use routine to accomplish similar tasks in order to finish drawing some step of a bigger project... Quote
Brandonhar Posted April 25, 2014 Author Posted April 25, 2014 Thanks for the response....The purpose of the polyline is to calculate the "travel distance" from bedroom doors to the nearest exit. We have to be within 35'. Currently we are drawing the p-line manually but it seems to be taking about 2 mins to achieve. (Our current process is to draw the required circles that we need around corners, and then draw lines from center of doors to tangent of the circles, we trim the lines and join all those lines into a p-line so we can then "list" the line to get the measurment.) I just thought a lisp routine would take that 2 minutes down to seconds to complete?? I would love to know another trick besides a routine if you have one...I learn something new everyday! Thanks again for your response... Quote
marko_ribar Posted April 25, 2014 Posted April 25, 2014 If that's the purpose, I'd just use pline command and pick those 3 points and get length from properties palette... Just pick them approximately without any arcs, length would be little bigger, but if it's escape route than better to account further distance than nearer one in overall calculations... 1,2,3 clicks and that's it, no routine - the job is finished... Quote
Brandonhar Posted April 25, 2014 Author Posted April 25, 2014 I appreciate it marko_ribar... Anyone else have anything that could help? Quote
BIGAL Posted April 26, 2014 Posted April 26, 2014 (edited) Simple little macro (defun pll ( / obj ) (command "_pline") (while (= (getvar "cmdactive") 1 ) (command pause) ) (setq obj (vlax-ename->vla-object (car (entlast)))) (setq plen (vlax-get-property obj 'length)) (alert (strcat "Pline is " (rtos plen 2 0) " long")) (vla-erase obj) ; if want to remain remove line ) (pll) Edited April 28, 2014 by SLW210 fixed broken code tag. Quote
marko_ribar Posted April 28, 2014 Posted April 28, 2014 (defun c:plarcedcorner ( / osm p1 p2 p3 r LM:PointCircleTangents p1plst p3plst p11 p12 p31 p32 p1p p3p p13pm p13pa obj plen ) (vl-load-com) (setq osm (getvar 'osmode)) (setq p1 (getpoint "\nPick or specify start point : ")) (setq p2 (getpoint "\nPick or specify middle corner point : " p1)) (setq p3 (getpoint "\nPick or specify end point : " p2)) (initget 7) (setq r (getdist "\nPick or specify radius of arc around middle corner point : " p2)) ;; Point-Circle Tangents - Lee Mac ;; Returns the two points for which a line from 'pt' to each point returned ;; is tangent to the circle with centre c1 and radius r1 (defun LM:PointCircleTangents ( pt c1 r1 / a1 a2 d1 ) (if (< r1 (setq a1 (angle c1 pt) d1 (distance pt c1))) (progn (setq a2 (atan (sqrt (- (* d1 d1) (* r1 r1))) r1)) (list (polar c1 (+ a1 a2) r1) (polar c1 (- a1 a2) r1) ) ) ) ) (setvar 'osmode 0) (setq p1plst (LM:PointCircleTangents p1 p2 r)) (setq p3plst (LM:PointCircleTangents p3 p2 r)) (setq p11 (car p1plst)) (setq p12 (cadr p1plst)) (setq p31 (car p3plst)) (setq p32 (cadr p3plst)) (if (> (min (distance p11 p31) (distance p11 p32)) (min (distance p12 p31) (distance p12 p32))) (setq p1p p11) (setq p1p p12) ) (if (> (min (distance p31 p11) (distance p31 p12)) (min (distance p32 p11) (distance p32 p12))) (setq p3p p31) (setq p3p p32) ) (setq p13pm (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) p1p p3p)) (setq p13pa (polar p2 (angle p2 p13pm) r)) (command "_.pline" p1 p1p "_A" "_S" p13pa p3p "_L" p3 "") (setq obj (vlax-ename->vla-object (entlast))) (setq plen (vlax-get-property obj 'length)) (prompt (strcat "Pline is : " (rtos plen 2 15) " long")) (setvar 'osmode osm) (princ) ) M.R. Quote
Brandonhar Posted April 28, 2014 Author Posted April 28, 2014 WOW!! You all are awesome!!! Thank you so much!! Marco_Ribar: This is exactly what I am looking for. I will be able to build off of this to offer more features!! You're great! BIGAL: Thanks to you as well!!! Quote
ROLANDO JR Posted June 25, 2014 Posted June 25, 2014 Good day Marco Ribar! I have the same problem with Brandonhar but mine is a custom linetype. I need to create custom linetype first. I attached an image for you so you understand what I am trying to say. Thank you! Quote
MSasu Posted June 26, 2014 Posted June 26, 2014 ROLANDO JR, you already have a dedicated thread for this matter. Please don't split the discussion! 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.