Jump to content

Recommended Posts

Posted

;WC.LSP is a programme to write coordinates. eldon Nov 1999
(defun C:WC (/ pt0 e east eastin n north northin)
;here begins the loop that gets the actual positions
  (while (setq PtCoord (getpoint "\nPick co-ordinate point:  "))
          (setq
        xval (car PtCoord) 2 4)
            yval (cadr PtCoord) 2 4)
            zval (caddr PtCoord) 2 4)
        east (rtos xval 2 4)
            north (rtos yval 2 4)
            elev (rtos zval 2 4)
            xval (strcat   "X=" east)
            yval (strcat   "Y=" north)
            zval (strcat   "z=" elev) 
         )
  (command "TEXT" pt0 "0.5" "0" xval);size of text changed manually
  (command "TEXT" "" yval)
  (command "TEXT" "" zval)
   )
   (princ)
)

 

The Z value doesnt write on the screen.... what is wrong?

How can i put the text with a leader directed to the entry point?

 

i have seen lisp like this and worked... if someone has one please release it for me , please.

Posted

Something like this?

 

(defun c:mpt (/ M-Text pt)

 (defun M-Text (pt val)
   (entmakex (list (cons 0 "MTEXT")
                   (cons 100 "AcDbEntity")
                   (cons 100 "AcDbMText")
                   (cons 10 (list (car pt) (cadr pt) 0.0))
                   (cons 1 val))))

 (while (setq pt (getpoint "\nPick Point: "))
   (setq pt (trans pt 1 0))
   (M-Text pt
     (apply 'strcat
       (mapcar 'strcat '("X = " "\nY = " "\nZ = ") (mapcar 'rtos pt)))))

 (princ))

Posted

The Z value doesnt write on the screen.... what is wrong?

How can i put the text with a leader directed to the entry point?

 

i have seen lisp like this and worked... if someone has one please release it for me , please.

 

The code as posted above will not work, in any version.

 

Since Lee posted a better overall solution, there is no need to fix your original code.

 

The only improvement I would suggest to Lee's code is to possibly place the annotation at elevation 0.0 regardless of the point chosen because text that uses TTF looks fuzzy/distorted when it's at a non-zero elevation.

Posted

Yap something like that...well it is that...but with a leader..

this leader could have a box where the text is at...or a subline for the z value... can you do that to me?

Posted

I believe ASMI created a LISP, which I have slightly modified, that may suit

 

;; ==================================================================== ;;
;;                                                                      ;;
;;  ORDI.LSP - This lisp for labeling X,Y coordinates with              ;;
;;             standard _DIMORDINATE dimension. The dimension           ;;
;;             properties is defined by current dimension               ;;
;;             style and variables DIMSCALE, DIMLFAC                    ;;
;;             and DIMDEC.                                              ;;
;;                                                                      ;;
;; ==================================================================== ;;
;;                                                                      ;;
;;  Command(s) to call: ORDI                                            ;;
;;                                                                      ;;
;;  ... and pick, pick, pick... till Esc is pressed.                    ;;
;;                                                                      ;;
;; ==================================================================== ;;
;;                                                                      ;;
;;  THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD ON ANY    ;;
;;  MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS PROGRAM OR        ;;
;;  PARTS OF IT ABSOLUTELY FREE.                                        ;;
;;                                                                      ;;
;;  THIS PROGRAM PROVIDES 'AS IS' WITH ALL FAULTS AND SPECIFICALLY      ;;
;;  DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS        ;;
;;  FOR A PARTICULAR USE.                                               ;;
;;                                                                      ;;
;; ==================================================================== ;;
;;                                                                      ;;
;;  V1.3, 12 May, 2005, Riga, Latvia                                    ;;
;;  © Aleksandr Smirnov (ASMI)                                          ;;
;;  For AutoCAD 2000 - 2008 (isn't tested in a next versions)           ;;
;;                                                                      ;;
;;                             http://www.asmitools.com                 ;;
;;                                                                      ;;
;;  ~ Modified by Lee Mac  ~  14.02.10 ~                                ;;
;;                                                                      ;;
;; ==================================================================== ;;


(defun c:ordi (/ *error* fPt oldEcho dScl dFlc dDec)

 (defun *error*(msg)
   (and oldEcho (setvar "CMDECHO" oldEcho))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ))
 
 (princ (apply (function strcat)
               (mapcar (function strcat) '("\nDIMSCALE = " " DIMLFAC = " " DIMDEC = ")
                       (mapcar (function rtos)
                               (mapcar (function set) '(dScl dFlc dDec)
                                       (mapcar (function getvar)
                                               '("DIMSCALE" "DIMLFAC" "DIMDEC")))))))
 (setq oldEcho (getvar "CMDECHO"))
 (setvar "CMDECHO" 0) (terpri)
 (while (setq fPt (getpoint "\rSpecify Point: "))
   (command "_.dimordinate" "_non" fPt "_t"
            (strcat    "X=" (rtos (* dFlc   (car fPt)) 2 dDec)
                    "\\XY=" (rtos (* dFlc  (cadr fPt)) 2 dDec)) pause))

 (setvar "CMDECHO" oldEcho)
 (princ))

Posted

Thats nice :D but doesnt give me the z value... :( i am a topograph survey i really need the z value.

 

i tried to combine two lisp´s:

 

(defun c:mpt (/ Text pt)

 (defun Text (pt val)
 (entmakex (list (cons 0 "MTEXT")
                   (cons 100 "AcDbEntity")
                   (cons 100 "AcDbMText")
                   (cons 10 (list (car pt) (cadr pt) 0.0))
                   (cons 1 val))))

 (while (setq pt (getpoint "\nPick Point: "))
    (setq pt (trans pt 1 0))
    (setq midpt (getpoint pt))
    (setq endpt (getpoint midpt))
    (command "leader" pt midpt endpt "" "" "n")
    (Text pt
      (apply 'strcat
        (mapcar 'strcat '("X = " "\nY = " "\nZ = ") (mapcar 'rtos pt)))))

 (princ))

 

 

...but as you will see, the text doesnt stays where i want it.

it should stay at the top of the midle poit of the leader...but with the coordinates of the first point... Can you edit this one, in a way that stays like i want? i really would apreciate it.

 

try to run the one i just wrote here... its kind a messy ending.. but it will give you the "idea"

 

 

ps: also edited yours...but cant get to put the z value under the y value... i´ve juste added:

 

"\\XZ=" (rtos (* dFlc (caddr fPt)) 2 dDec)) pause))

 

it apears the z Value :D but not under the Y value :(

Posted

As the Autor of the Lisp posted at the start of the thread, I must point out that the Lisp has been modified since I posted it.

 

On lines 6, 7 & 8 there is a surplus 2 4) at the ends of the lines, and in line 16, pt0 should read PtCoord which also has not been declared as a local variable.

 

Looking at the date of writing, I must have been almost clever in those days.

Posted

ps: also edited yours...but cant get to put the z value under the y value... i´ve juste added:

 

"\\XZ=" (rtos (* dFlc (caddr fPt)) 2 dDec)) pause))

 

it apears the z Value :D but not under the Y value :(

 

The problem is that, when using the dimordinate command to create the leader, one can only use two lines (if not using MText).

 

But try this:

 

;; ==================================================================== ;;
;;                                                                      ;;
;;  ORDI.LSP - This lisp for labeling X,Y coordinates with              ;;
;;             standard _DIMORDINATE dimension. The dimension           ;;
;;             properties is defined by current dimension               ;;
;;             style and variables DIMSCALE, DIMLFAC                    ;;
;;             and DIMDEC.                                              ;;
;;                                                                      ;;
;; ==================================================================== ;;
;;                                                                      ;;
;;  Command(s) to call: ORDI                                            ;;
;;                                                                      ;;
;;  ... and pick, pick, pick... till Esc is pressed.                    ;;
;;                                                                      ;;
;; ==================================================================== ;;
;;                                                                      ;;
;;  THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD ON ANY    ;;
;;  MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS PROGRAM OR        ;;
;;  PARTS OF IT ABSOLUTELY FREE.                                        ;;
;;                                                                      ;;
;;  THIS PROGRAM PROVIDES 'AS IS' WITH ALL FAULTS AND SPECIFICALLY      ;;
;;  DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS        ;;
;;  FOR A PARTICULAR USE.                                               ;;
;;                                                                      ;;
;; ==================================================================== ;;
;;                                                                      ;;
;;  V1.3, 12 May, 2005, Riga, Latvia                                    ;;
;;  © Aleksandr Smirnov (ASMI)                                          ;;
;;  For AutoCAD 2000 - 2008 (isn't tested in a next versions)           ;;
;;                                                                      ;;
;;                             http://www.asmitools.com                 ;;
;;                                                                      ;;
;;  ~ Modified by Lee Mac  ~  14.02.10 ~                                ;;
;;                                                                      ;;
;; ==================================================================== ;;


(defun c:ordi (/ *error* fPt oldEcho dScl dFlc dDec)

 (defun *error*(msg)
   (and oldEcho (setvar "CMDECHO" oldEcho))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ))
 
 (princ (apply (function strcat)
               (mapcar (function strcat) '("\nDIMSCALE = " " DIMLFAC = " " DIMDEC = ")
                       (mapcar (function rtos)
                               (mapcar (function set) '(dScl dFlc dDec)
                                       (mapcar (function getvar)
                                               '("DIMSCALE" "DIMLFAC" "DIMDEC")))))))
 (setq oldEcho (getvar "CMDECHO"))
 (setvar "CMDECHO" 0) (terpri)
 (while (setq fPt (getpoint "\rSpecify Point: "))
   (command "_.dimordinate" "_non" fPt "_M"
            (strcat    "X=" (rtos (* dFlc   (car fPt)) 2 dDec)
                    "\\PY=" (rtos (* dFlc  (cadr fPt)) 2 dDec)
                    "\\PZ=" (rtos (* dFlc (caddr fPt)) 2 dDec)) pause))

 (setvar "CMDECHO" oldEcho)
 (princ))

Posted
As the Autor of the Lisp posted at the start of the thread, I must point out that the Lisp has been modified since I posted it.

 

On lines 6, 7 & 8 there is a surplus 2 4) at the ends of the lines, and in line 16, pt0 should read PtCoord which also has not been declared as a local variable.

 

Looking at the date of writing, I must have been almost clever in those days.

 

By the way Eldon, I realise this is probably an old LISP of yours, but I would recommend steering clear of using (command) to create text (and attdefs for that matter).

 

I have probably mentioned this before, but I have found it quite unreliable in various drawings and it is also much slower than the entmake alternative.

 

To make it easier, I created this thread :)

 

Lee

Posted
By the way Eldon, I realise this is probably an old LISP of yours, but I would recommend steering clear of using (command) to create text (and attdefs for that matter).

 

I have probably mentioned this before, but I have found it quite unreliable in various drawings and it is also much slower than the entmake alternative.

 

To make it easier, I created this thread :)

 

Lee

 

Where were you in November 1999 when I needed you :shock:

Posted

Lee Mac, thanks a lot... its working just nice....

thanks a lot really...you guys are awsome.

Posted
Lee Mac, thanks a lot... its working just nice....

thanks a lot really...you guys are awsome.

 

You're welcome ManAtWork :)

Posted

listen i´m with another biiiig problem...

i got a bunch of points representated with a cross block, this blocks have x,y,z coordinates and i want to list those coordinates.... i´ve made a polyline with them...but when i do list it doesnt give me the z value of each "point", in fact they are not points...are a them cross that is really bad created as a block....what the hell can i do to export all those coordinates with the z of each cross????

i´ve tryed everything i know...and nothing... please give me ideas...

Posted
listen i´m with another biiiig problem...

i got a bunch of points representated with a cross block, this blocks have x,y,z coordinates and i want to list those coordinates.... i´ve made a polyline with them...but when i do list it doesnt give me the z value of each "point", in fact they are not points...are a them cross that is really bad created as a block....what the hell can i do to export all those coordinates with the z of each cross????

i´ve tryed everything i know...and nothing... please give me ideas...

 

When you draw a polyline through 3D points, make sure that you use the 3DPolyline. If you use an ordinary polyline, all the points will have the elevation of the first point. With a 3D polyline, the x, y & z are listed.

Posted

Eldon thanks for the tip....gonna try that

lol in fact i was using the 2d...im a dumb ass.

Posted
im a dumb ass.

 

Not so! Merely on a learning curve :thumbsup:

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...