Baber62 Posted January 25, 2013 Share Posted January 25, 2013 Looking for a quick fix. I need to bisect a line and draw a perpendicular line from the mid-point of the measure line. It would be great if this could be dynamically done i.e. the perpendicular can be drawn either side of the line and to any length. Any assists will abe appreciated. Quote Link to comment Share on other sites More sharing options...
Tyke Posted January 25, 2013 Share Posted January 25, 2013 In your OSNAPs set midpoint and perpendicular. Turn dynamic input on. Press F11 to toggle "object snap trace" on (I think that's what its called in English versions, if not look in the bottem left of the screen and observe and you'll see an icon go on and off, make sure that it is on). Start the line command and snap to the mid point of the line and as you move your cursor away you will get a dotted line and you just need to enter the length of the line and you have exactly what you wished for. Quote Link to comment Share on other sites More sharing options...
Dadgad Posted January 25, 2013 Share Posted January 25, 2013 Just follow Tyke's instructions and you will be a very happy camper. The 3 ICONS which are circled in the image are those to which Tyke refers they are OBJECT SNAPS, OBJECT SNAP TRACKING and DYNAMIC INPUT from left to right. They can be left clicked to turn them on or off, or they can be toggled on and off with F3, F11 & F12 respectively. Quote Link to comment Share on other sites More sharing options...
Baber62 Posted January 25, 2013 Author Share Posted January 25, 2013 Thanks Tyke that works great but I was looking for a lisp routine, as I have loads of lines to draw perpendiculars to. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 25, 2013 Share Posted January 25, 2013 Use this old program and click the midpoint: (defun c:per ( / *error* e o p ) (defun *error* ( m ) (if o (progn (setvar 'orthomode o) (command "_.ucs" "_p"))) (princ) ) (if (and (setq p (getpoint "\nSpecify first point: ")) (setq e (car (nentselp p))) ) (progn (setq p (trans p 1 0)) (command "_.ucs" "_ob" e) (setq o (getvar 'orthomode)) (setvar 'orthomode 1) (command "_.line" "_non" (trans p 0 1)) (while (< 0 (getvar 'cmdactive)) (command "\\")) (setvar 'orthomode o) (command "_.ucs" "_p") ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Tyke Posted January 25, 2013 Share Posted January 25, 2013 Use this old program and click the midpoint: (defun c:per ( / *error* e o p ) (defun *error* ( m ) (if o (progn (setvar 'orthomode o) (command "_.ucs" "_p"))) (princ) ) (if (and (setq p (getpoint "\nSpecify first point: ")) (setq e (car (nentselp p))) ) (progn (setq p (trans p 1 0)) (command "_.ucs" "_ob" e) (setq o (getvar 'orthomode)) (setvar 'orthomode 1) (command "_.line" "_non" (trans p 0 1)) (while (< 0 (getvar 'cmdactive)) (command "\\")) (setvar 'orthomode o) (command "_.ucs" "_p") ) ) (princ) ) That's neat Lee. With Dynamic Input turned on can you type in the line length? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 25, 2013 Share Posted January 25, 2013 Alternatively, (defun c:per ( / e p q ) (if (setq e (ssget "_+.:E:S" '((0 . "LINE")))) (progn (setq e (entget (ssname e 0)) p (trans (cdr (assoc 10 e)) 0 1) q (trans (cdr (assoc 11 e)) 0 1) ) (vl-cmdf "_.line" "_non" (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) p q) (strcat "<" (angtos (+ (angle p q) (/ pi 2.0)))) "\\" "" ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 25, 2013 Share Posted January 25, 2013 That's neat Lee. With Dynamic Input turned on can you type in the line length? Cheers Tyke - yes, you should still be able to type the line length Quote Link to comment Share on other sites More sharing options...
Baber62 Posted January 25, 2013 Author Share Posted January 25, 2013 Thanks Lee and all those who have contributed, appreciated. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 25, 2013 Share Posted January 25, 2013 You're welcome Baber Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 25, 2013 Share Posted January 25, 2013 (edited) Another with grread and grdraw functions . just for fun . (defun c:Test (/ s p ang g st nd pt) ;;; Tharwat 25. Jan. 2013 ;;; (if (and (setq s (car (entsel "\n Select line :"))) (eq (cdr (assoc 0 (entget s))) "LINE") ) (progn (setq p (mapcar (function (lambda (j k) (/ (+ j k) 2.))) (setq st (cdr (assoc 10 (entget s)))) (setq nd (cdr (assoc 11 (entget s)))) ) ang (angle st nd) ) (while (eq (car (setq g (grread t 15 0))) 5) (redraw) (grdraw p (setq pt (polar p (+ ang (* pi 0.5)) (if (> 0 (sin (- (angle st (cadr g)) ang))) (- (distance p (cadr g))) (distance p (cadr g)) ) ) ) 1 0 ) ) (if (or (eq (car g) 3) (eq (car g) 25) ) (entmakex (list '(0 . "LINE") (cons 10 (trans p 1 0)) (cons 11 pt)) ) ) ) ) (redraw) (princ) ) Edited January 25, 2013 by Tharwat small problem with the angle modified with the help of Lee Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 25, 2013 Share Posted January 25, 2013 Another with grread and grdraw functions . just for fun . (defun c:Test (/ s p g st nd pt) < ... > Good attempt Tharwat, but not quite: Consider perhaps something like: ([color=BLUE]defun[/color] c:test ( [color=BLUE]/[/color] a b d e g m p q ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] e ([color=BLUE]ssget[/color] [color=MAROON]"_+.:E:S"[/color] '((0 . [color=MAROON]"LINE"[/color])))) ([color=BLUE]progn[/color] ([color=BLUE]setq[/color] e ([color=BLUE]entget[/color] ([color=BLUE]ssname[/color] e 0)) p ([color=BLUE]trans[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 10 e)) 0 1) q ([color=BLUE]trans[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 11 e)) 0 1) m ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]/[/color] ([color=BLUE]+[/color] a b) 2.0)) p q) a ([color=BLUE]angle[/color] p q) b ([color=BLUE]+[/color] a ([color=BLUE]/[/color] [color=BLUE]pi[/color] 2.0)) ) ([color=BLUE]while[/color] ([color=BLUE]=[/color] 5 ([color=BLUE]car[/color] ([color=BLUE]setq[/color] g ([color=BLUE]grread[/color] [color=BLUE]t[/color] 13 0)))) ([color=BLUE]redraw[/color]) ([color=BLUE]setq[/color] g ([color=BLUE]cadr[/color] g) d ([color=BLUE]distance[/color] m g) q ([color=BLUE]polar[/color] m b ([color=BLUE]if[/color] ([color=BLUE]<[/color] 0 ([color=BLUE]sin[/color] ([color=BLUE]-[/color] ([color=BLUE]angle[/color] p g) a))) d ([color=BLUE]-[/color] d))) ) ([color=BLUE]grdraw[/color] m q -1) ) ([color=BLUE]if[/color] ([color=BLUE]=[/color] 3 ([color=BLUE]car[/color] g)) ([color=BLUE]entmake[/color] ([color=BLUE]list[/color] '(0 . [color=MAROON]"LINE"[/color]) ([color=BLUE]cons[/color] 10 ([color=BLUE]trans[/color] m 1 0)) ([color=BLUE]cons[/color] 11 ([color=BLUE]trans[/color] q 1 0)))) ) ) ) ([color=BLUE]redraw[/color]) ([color=BLUE]princ[/color]) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 25, 2013 Share Posted January 25, 2013 Thank you Lee for the correction , it's very accurate . Quote Link to comment Share on other sites More sharing options...
Baber62 Posted January 25, 2013 Author Share Posted January 25, 2013 Nice coding Thawat, thanks. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 25, 2013 Share Posted January 25, 2013 Nice coding Tharwat, thanks. You're welcome . and really happy to hear that. Quote Link to comment Share on other sites More sharing options...
erbalaji Posted November 17, 2015 Share Posted November 17, 2015 insted of line is there any way to get Linear Dimension? or line with dimensions. Quote Link to comment Share on other sites More sharing options...
rkent Posted November 17, 2015 Share Posted November 17, 2015 A simple macro to rotate the UCS to the line is a very simple way to do all the above. ^C^CUCS Object And another to put it back ^C^CUCS World 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.