merdrignac Posted August 7, 2008 Posted August 7, 2008 *^C^C^C^C_id;\_-mtext;@;_j;ml;_h;$M=$(*,1,$(getvar,dimscale));@1 I came across this button macro some years ago to place co-ordinate (X & Y) values at the picked point, with a point marker on the picked point. Only trouble is that it does not seem to work at small dimension scales below 1 to 20 (text height 2mm). Has anyone any ideas how to make it work properly at all dim scales, or perhaps suggest a better alternative. Quote
lpseifert Posted August 7, 2008 Posted August 7, 2008 Here is a lisp to annotate the coordinates of a picked point with a boxed leader, allows you to pick a base point other than WCS 0,0. ;;;Annotate a coordinate w/ a boxed leader, LPS 2008 (defun C:xy (/ oldecho pt1 pt2 txtx txty dg) (setq temperr *error*) ;store *error* (setq *error* errortrap) ;re-assign *error* (setq oldecho (getvar "cmdecho")) ;restore variables (setq oldlayer (getvar "clayer")) (setq oldsnap (getvar "osmode")) (setq olddimgap (getvar "dimgap")) (setvar "cmdecho" 0) (setvar "dimgap" -0.1) (command "undo" "m") (setq ptb (getpoint "Pick base point: <World>")) (if (not (null ptb)) (command "ucs" "o" ptb) (command "ucs" "o" '(0 0)) );if (setq pt1 T) (while (not (null pt1)) (setq pt1 (getpoint "\nPick coordinate point: ")) (if pt1 (progn (setq pt2 (getpoint pt1 "\nPick text location: ")) (if pt2 (progn (setq txtX (strcat "X: " (rtos (car pt1)2 2) " ")) (setq txtY (strcat "Y: " (rtos (cadr pt1) 2 2) "\n")) (command "leader" pt1 pt2 "Annotation" txtX txtY "") ) ) ) ) );while (setvar "cmdecho" oldecho) (setvar "dimgap" olddimgap) (command "ucs" "p") (setq *error* temperr) (princ) );defun (defun errortrap (msg) ;define function (command "undo" "b") (setvar "osmode" oldsnap) ;restore variables (setvar "clayer" oldlayer) (setvar "cmdecho" oldecho) (setvar "dimgap" olddimgap) (command "ucs" "p") (setq *error* temperr) ;restore *error* (prompt "\nResetting System Variables ") ;inform user (princ) );defun Quote
merdrignac Posted August 7, 2008 Author Posted August 7, 2008 Thanks for that. Can you tell me how to adjust text size, and put a point instead of the leader? Quote
lpseifert Posted August 7, 2008 Posted August 7, 2008 adjust value in red for plotted text height ;;;Annotate a coordinate w/ a point marker, LPS 2008 (defun C:xy (/ oldecho pt1 pt2 txtx txty dg) (setq temperr *error*) ;store *error* (setq *error* errortrap) ;re-assign *error* (setq oldecho (getvar "cmdecho")) ;restore variables (setq oldlayer (getvar "clayer")) (setq oldsnap (getvar "osmode")) (setq oldtxtsize (getvar "textsize")) (setvar "cmdecho" 0) (setvar "textsize" (* [color=Red]0.1[/color] (getvar "dimscale"))) (command "undo" "m") (setq ptb (getpoint "Pick base point: <World>")) (if (not (null ptb)) (command "ucs" "o" ptb) (command "ucs" "o" '(0 0)) );if (setq pt1 T) (while (not (null pt1)) (setq pt1 (getpoint "\nPick coordinate point: ")) (if pt1 (progn (setq pt2 (getpoint pt1 "\nPick text location: ")) (if pt2 (progn (setq txtX (strcat "X: " (rtos (car pt1)2 2) " ")) (setq txtY (strcat "Y: " (rtos (cadr pt1) 2 2) )) (command "point" pt1 "") (command "text" pt2 "" "" txtx "") (command "text" "" txty "") ) ) ) ) );while (setvar "cmdecho" oldecho) (setvar "textsize" oldtxtsize) (command "ucs" "p") (setq *error* temperr) (princ) );defun (defun errortrap (msg) ;define function (command "undo" "b") (setvar "osmode" oldsnap) ;restore variables (setvar "clayer" oldlayer) (setvar "cmdecho" oldecho) (setvar "textsize" oldtxtsize) (command "ucs" "p") (setq *error* temperr) ;restore *error* (prompt "\nResetting System Variables ") ;inform user (princ) );defun Quote
merdrignac Posted August 13, 2008 Author Posted August 13, 2008 Thanks again. Works a treat. I like the way it can be adjusted to cope with any UCS setting. Has Just made life much easier. BTW I've managed to sort the macro, now as follows: *^C^C^C^C_id;\_-mtext;@;_j;ml;_h;$M=$(*,1,$(getvar,dimscale));@; X=$(rtos,$(index,^M;0,$(getvar,lastpoint)),2,0); Y=$(rtos,$(index,1,$(getvar,lastpoint)),2,0);;_point;@; 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.