Ataim Posted Friday at 02:13 PM Posted Friday at 02:13 PM (edited) I'm a land surveyor. Years ago I worked at a company that had a script or lisp to draw a house. Basically you started a polyline and then drug the cursor the direction you wanted to go. Then you would put in the distance. Then you simply type the next distance and would draw that distance 90° to the right of the last line. Or if you put a - in front of the distance it would draw 90° to the left of the last line. Or you could add / or \ to draw 45° to the last line. You would continue until you are done. I would be willing to pay $$$$ if someone could write this for me. Edited Friday at 02:15 PM by Ataim Quote
SLW210 Posted Saturday at 11:11 AM Posted Saturday at 11:11 AM I moved your thread to the AutoLISP, Visual LISP & DCL Forum. Quote
Steven P Posted Saturday at 09:01 PM Posted Saturday at 09:01 PM Do you remember what the command was to run the LISP - you never know, someone might have a copy or a link to it Quote
BIGAL Posted Saturday at 10:20 PM Posted Saturday at 10:20 PM Many years ago "Civilcad" software had that function, draw a shape and click on boundaries you could do things like set a side and slide along that side with updating offset to other sides as one option. So understand what you want but no solution, sorry. Not sure if it ended up in current software "Magnet". Note in the image the offset line to the angled line., it will always be the closest corner and changes automatically depending on the shape. Welcome to Cadtutor. Post a sample dwg with some examples of what your looking for, a before and after is best. Quote
robierzo Posted Sunday at 08:03 PM Posted Sunday at 08:03 PM (edited) I use this Lee Mac lisp. I find it very useful. It's not exactly what you're asking for, but it might be a big help. https://www.lee-mac.com/3pointrectangle.html Edited Sunday at 08:03 PM by robierzo Quote
Steven P Posted Sunday at 08:09 PM Posted Sunday at 08:09 PM (edited) Try this as a first pass, see if I have the idea right: Not quite as described and only draws lines as it is, rather than Polylines, but it being a Sunday and the CAD should be off it will do for a start, or if it inspires anyone tonight. To consider later: Fixing the loop - as it is just escape out of the LISP to end or join last point to start point. Join the lines together as Polylines (See Lee Mac PLJoin?) (defun c:testthis ( / Pta Ptb Pt1 Pt2 MyLine MyDistance MyAngle ed RefLine RefAngle ) (defun LM:roundm ( n m ) ;; Lee Mac ;; Round to nearest m (* m (fix ((if (minusp n) - +) (/ n (float m)) 0.5))) ) (command "line" pause pause "") ; Draw first segment (setq RefLine (entlast)) ; Line entitity name (setq Pta (setq Pt1 (cdr (assoc 10 (entget RefLine)))) ) ; First line start point (setq Ptb (setq Pt2 (cdr (assoc 11 (entget RefLine)))) ) ; first line end point (setq RefAngle (angle Pt1 Pt2) ) ; First line absolute angle (setq endloop "No") ; marker to keep loop going (while ; While loop (and (= endloop "No") ; Marker still 'no' (= (command "line" Pt2 pause "") nil) ; and user draws a line ) ; end and (setq ed (entget (entlast))) ; next segment entity name (setq Pt1 (cdr (assoc 10 ed))) ; next segment start point (also last one end point (Setq Pt1 Pt2) should also work (setq Pt2 (cdr (assoc 11 ed))) ; next segment end point (if (equal Pt2 Pta) ; If next segment end point = first segment start point (progn (princ "Closed Polyline") (setq Endloop "Yes") ; set end loop marker & end loop ) ; end progn (progn ; else (setq MyDistance (distance Pt1 Pt2)) ; Record next segment distance (setq MyAngle (LM:roundm (- (angle Pt1 Pt2) RefAngle) (/ pi 4) )) ; next segment angle relative to first segment, rounded to pi/4 (45 degrees) ; pi/4: 45 degree angles, pi/12 for 15 degrees (setq Pt2 (polar Pt1 (+ MyAngle RefAngle) MyDistance)) ; Calculate new PT from rounded angle (setq ed (subst (cons 11 Pt2) (assoc 11 ed) ed )) ; Modify the segment to perpendicular / 45 degree (entmod ed) ; update next segment ) ; end progn ) ; end if ) ; end loop (princ) ) ; end defun Edited Sunday at 08:54 PM by Steven P Quote
BIGAL Posted Sunday at 11:20 PM Posted Sunday at 11:20 PM @Ataim you need to post a sample dwg showing a before and after. For others I think that this is what has been described this is just one option, draw house shape, set control offset from a boundary and move shape, then SLIDE option set desired offset from another boundary and move house but maintain 1st offset from boundary. As I said the 1990's software had various options. House shape could be very complex not just a rectang. Quote
Stefan BMR Posted 11 hours ago Posted 11 hours ago (edited) If I understand correctly your request, I think you can get the same with the right settings. Just aim the desired direction and specify the distance. Edited 11 hours ago by Stefan BMR 1 Quote
Ataim Posted 9 hours ago Author Posted 9 hours ago Thanks to all that have pitched in. As per suggested here is a couple of screen shots to help. First is the sketch the guys measure in the field. Second is our dwg. What I'm needing is just the 10-key in the distances. Currently we turn ortho on and just move the cursor the direct we want and the type the distance (same as Stefan). Which works, but you have to take your hand off of the keyboard. What I'd like to do is to keep my hand on the 10-key and just type distances. For the following picture (starting at the arrow/donut) I would start the lisp, pick a point, and then the direction with the cursor and then distance 7.7. my next key strokes would simply be: -12 (left 90° turn); 22.8 (right 90° turn); 12 (right 90° turn); -5.9 (left 90° turn); 21.6 (right 90° turn); -0.5 (left 90° turn); \3.5(left 45° turn); 8 (right 90° turn); 2.5 (right 90° turn); \1.5 (left 45° turn); 13.8 (left 90° turn); etc. Quote
mhupp Posted 4 hours ago Posted 4 hours ago (edited) Should get you what your looking for. code below Edited 2 hours ago by mhupp update lisp Quote
BIGAL Posted 3 hours ago Posted 3 hours ago @mhupp great code no reason why input could not be 7.7;-12;22.8;12;-5.9;21.6;-0.5;\3.5;8;2.5;\1.5;13.8 in this case each leg is separated by a semi colon, or more often a comma is used. Could type in say notepad and copy and paste to a getstring. The reason for the paste rather than type direct would be if made a mistake you UNDO fix in notepad and do again. Use "parse to list" defun. @Ataim what do you think about that idea ? 1 Quote
mhupp Posted 3 hours ago Posted 3 hours ago (edited) eah trying to make a gif and keep messing up. ended up making an undo. 24 minutes ago, BIGAL said: @mhupp great code no reason why input could not be 7.7;-12;22.8;12;-5.9;21.6;-0.5;\3.5;8;2.5;\1.5;13.8 Was thinking that as well. would have to tinker with it for a bit. ended up adding an [U]ndo and [C]lose option. *can only use undo on last leg. Edited 2 hours ago by mhupp Quote
Ataim Posted 2 hours ago Author Posted 2 hours ago Not sure how much longer I need admin's approval for my new posts (I totally understand).... Couple of requests....... Can you change - sign to be for a 90° left turn and nothing would be 90° right? And reverse the / and \ so that / is a 45° to the right and \ is a 45° to the left? Currently \ does not seem to working properly. Other than that you ROCK. As far as coding in notepad I personally would not use it. My goal is to just 10-key for inputs. Quote
Ataim Posted 1 hour ago Author Posted 1 hour ago One more thing. If osnap is on it will snap to that object if the line lands on it. Can you automatically turn off osnap at the beginning? Quote
mhupp Posted 1 hour ago Posted 1 hour ago (edited) I was using /# and /-# but using / and \ works to. if the 45 still going the wrong way you just need to flip the first two wcmatch calls. right now line 17 ((wcmatch inp "\\*") line 26 ((wcmatch inp "/*") fix line 17 ((wcmatch inp "/*") line 26 ((wcmatch inp "\\*") PolyHouse.lsp Edited 1 hour ago by mhupp Added + option Quote
Ataim Posted 1 hour ago Author Posted 1 hour ago I've been using already THANKS. I promise this might be my last change. Can you add +distsance just extend the last line that additional amount? 1 Quote
mhupp Posted 1 hour ago Posted 1 hour ago fixed an error with substr to only remove the first char of the string. and added your + option. 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.