wimal Posted May 14, 2018 Share Posted May 14, 2018 (command "xline""H") I need draw a single xline through a selected point on the screen. And find the coordinates of picked point. The above code is working , but does not stop after inserting one xline. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted May 14, 2018 Share Posted May 14, 2018 It's easy to not use a command call: (defun c:foo (/ p) (if (setq p (getpoint "\Pick a point: ")) (entmakex (list '(0 . "XLINE") '(100 . "AcDbEntity") '(67 . 0) '(8 . "XLINE") '(100 . "AcDbXline") (cons 10 p) '(11 1.0 0.0 0.0) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 14, 2018 Share Posted May 14, 2018 You might also find this custom xline program useful. Quote Link to comment Share on other sites More sharing options...
wimal Posted May 15, 2018 Author Share Posted May 15, 2018 Thanks for both of you providing the codes.But I need to display the xline before the point picking.Point to be decided helping the xline. Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted May 15, 2018 Share Posted May 15, 2018 (command "_.xline" "_horizontal" pause "") (getvar 'lastpoint) Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted May 15, 2018 Share Posted May 15, 2018 Thanks for both of you providing the codes.But I need to display the xline before the point picking.Point to be decided helping the xline. maybe rubber band helps? (setvar 'polarmode 1 ) (and (setq p1 (getpoint "\nSpecify 1st point.. ")) (setq p2 (getpoint [color="red"]p1[/color] "Specify 2nd point.. ")) (apply 'vla-AddXline (cons msps (mapcar ''((x) (vlax-3d-point (trans x 1 0))) (list p1 p2)) ) ) ) Quote Link to comment Share on other sites More sharing options...
Grrr Posted May 15, 2018 Share Posted May 15, 2018 Heres another way, using grread and LM:grsnap - ; Vertical/Horizontal XLINE demo ; Requires: ; http://www.lee-mac.com/grsnap.html (defun C:test ( / *error* ) (defun *error* ( m ) (redraw) (and m (princ m)) (princ) ); defun *error* (cond ( (not LM:grsnap:snapfunction) (alert "\nPlease define 'LM:grsnap:snapfunction'") ) ( ( (lambda ( / osf osm a1 a2 vec s g k v d ) '(84 104 105 115 32 100 101 109 111 32 119 114 105 116 116 101 110 32 98 121 32 71 114 114 114 33 32 58 41) (setq osf (LM:grsnap:snapfunction)) (setq osm (getvar 'osmode)) (mapcar 'set '(a1 a2 vec) '(0 1. (11 1.0 0.0 0.0))) (princ "\nSpecify point for the xline [V]ertical: ") (while (not s) (mapcar 'set '(k v) (setq g (grread t 15 0))) (cond ( (or (eq s '(2 13)) (= 25 k)) (setq s t) ) ( (= k 5) (setq d (* 3 (getvar 'viewsize))) (redraw) (setq v (osf (cadr g) osm)) (grdraw (polar v (* a1 PI) d) (polar v (* a2 PI) d) 1 3) ) ( (= k 3) (entmakex (append '( (0 . "XLINE") (100 . "AcDbEntity") (67 . 0) (100 . "AcDbXline") ) (list (cons 10 (trans (osf (cadr g) osm) 1 0))) (list vec) ) ); entmakex (setq s t) ) ( (and (= k 2) (member v '(86 118))) (princ "\nSpecify point for the xline [H]orizontal: ") (mapcar 'set '(a1 a2 vec) '(0.5 1.5 (11 0.0 1.0 0.0))) ) ( (and (= k 2) (member v '(72 104))) (princ "\nSpecify point for the xline [V]ertical: ") (mapcar 'set '(a1 a2 vec) '(0 1. (11 1.0 0.0 0.0))) ) ); cond ); while ); lambda ) ) ); cond (*error* nil) (princ) ); defun Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted May 15, 2018 Share Posted May 15, 2018 my $0.02 setvar snapang with cursorsize 100 Quote Link to comment Share on other sites More sharing options...
wimal Posted May 16, 2018 Author Share Posted May 16, 2018 my $0.02 setvar snapang with cursorsize 100 Yes cursor setting is better . 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.