Label Co-ordintes
I'm using AutoCAD 2007.I have the lsp below for labeling co-oredinates.
Unfortunately in one drawing I've recieved the points are lebelled in metres, but drawn in mm.
It would make my life much easier if the lsp below could be amended to take this into account. So rather than give co-ord of 949846.00,2474211.00, I would like it read as 949.846,2474.211.
Unfortunatly I not good enough to amend the lsp.
Are any of you abel to amend it?
Many thanks.
(defun c:lblpt () (setq precis 2);;set decimal places here (while (setq pt (getpoint "\nSelect point to label: ")) (setq Xval (car pt) Yval (cadr pt)) (setq Xtxt (rtos Xval 2 precis)) (setq Ytxt (rtos Yval 2 precis)) (command "text" pt "" "0" Xtxt) (command "text" "" ytxt) );while (princ) )(prompt "\nType lblpt to run command.")(princ) Divide coordinates to 1000.
(defun c:lblpt () (setq precis 2);;set decimal places here (while (setq pt (getpoint "\nSelect point to label: ")) (setq Xval (/(car pt)1000) Yval (/(cadr pt)1000)) (setq Xtxt (rtos Xval 2 precis)) (setq Ytxt (rtos Yval 2 precis)) (command "text" pt "" "0" Xtxt) (command "text" "" ytxt) );while (princ) )(prompt"\nType lblpt to run command.")(princ) If you want coordinates to three decimal places, don't forget to alter the "2" in the second line to "3" May be standard DIMORDINATE with text override better... It can move after picking point
(defun c:ordi(/ fPt oldEcho *error*)(defun *error*(msg) (setvar "CMDECHO" oldEcho) (princ) ); end of *error* (setq oldEcho(getvar "CMDECHO"))(setvar "CMDECHO" 0) (while t (if (setq fPt(getpoint "\nSpecify point or Esc to Quit > ")) (progn (command "_.dimordinate" fPt "_t" (strcat "X=" (rtos(car fPt)2(getvar "DIMDEC")) "\\X" "Y=" (rtos(cadr fPt)2(getvar "DIMDEC")) ); end strcat pause ); end command ); end progn ); end if ); end while (setvar "CMDECHO" oldEcho)(princ)); end of c:ordi Nice way of combining the Ordinate dimensions.
Perhaps the DIMLFAC could be incorporated, giving the scaling factor required for the coordinates.
I think I can do that myself, but daiharv could probably do with a hand.
Yes, now DIMSCALE, DIMLFAC and DIMDEC are works.
(defun c:ordi(/ fPt oldEcho dFlc dDec *error*)(defun *error*(msg) (setvar "CMDECHO" oldEcho) (princ) ); end of *error*(princ(strcat "DIMSCALE="(rtos (getvar "DIMSCALE"))" " "DIMLFAC="(rtos (setq dFlc (getvar "DIMLFAC")))" " "DIMDEC="(rtos (setq dDec (getvar "DIMDEC")))" " ); end strcat); end princ (setq oldEcho(getvar "CMDECHO"))(setvar "CMDECHO" 0) (while t (if (setq fPt(getpoint "\nSpecify point or Esc to Quit > ")) (progn (command "_.dimordinate" fPt "_t" (strcat "X=" (rtos(* dFlc(car fPt))2 dDec) "\\X" "Y=" (rtos(* dFlc(cadr fPt))2 dDec) ); end strcat pause ); end command ); end progn ); end if ); end while (setvar "CMDECHO" oldEcho)(princ)); end of c:ordi Thank you very much ASMI.
It is now a much more elegant solution to labelling coordinates using the dimensioning facilities of AutoCAD. I must add on a header where I got it from >eldon
Thanks for kind words. It only my small hobby.
i cant make this work.i appload the lsp then what Write ordi to command or this overwriting DIMORDINATEcommand.Using Autocad 2008. And new to lisps....
There is similar lsp at different topic. i can makeit work by typing 31thanks...
How do I incorporate this code with 3 decimel places??
页:
[1]
2