Jump to content

Recommended Posts

Posted

Try the attached.

 

(defun c:enz (/ clr key pnt dim a b c)
  ;; Tharwat - 5.Jul.2019
  ;;  (load "enz.lsp") enz
  ;;  https://www.cadtutor.net/forum/topic/68126-require-lisp-3-in-1-for-xyz-coordinates-with-leader/?tab=comments#comment-552696
  
  (setq clr (getvar 'clayer)) 
  (cond ( (null (tblsearch "LAYER"  "Coor Text")) (command "-layer" "_M" "Coor Text" "_C" 7 "" "")) (t (setvar 'clayer "Coor Text")))
  (and
    (or (initget "NoZ All Z")
        (setq key
               (cond
                 ((getkword
                    "\nPick your go [No Elevation , All Coordinates , Z coordinates only] [NoZ/All/Z] < NoZ > :"
                  )
                 )
                 ("NoZ")
               )
        )
    )
    (setq pnt (getpoint "\nSpecify base point : "))
    (while pnt
    (setq dim (getvar 'DIMZIN))
    (setvar 'DIMZIN 0)
    (mapcar 'set
        '(a b c)
        (mapcar '(lambda (k p) (strcat k (rtos p 2 4)))
            '("E=" "N=" "Z=")
            pnt
        )
    )
    (setvar 'DIMZIN dim)
    (command "_.LEADER"
         "_none"
         pnt
         "\\"
         ""
         (nth (vl-position key '("NoZ" "All" "Z"))
          (list (strcat a "\\P" b) (strcat a "\\P" b "\\P" c) c)
         )
         ""
    )
    (setq pnt (getpoint "\nSpecify base point : "))
    ) ; while
  )
  (setvar 'clayer clr)
  (princ)
)

 

  • Like 2
Posted
3 hours ago, Ish said:

 wonderful Sir,

now working perfectly.

Request To You just add code for layer,  create Layer Automatic And All value must come in Layer

layer Name "Coor Text"

👏

Thanks a Lot.

 

Updated code in my last post.

Posted
12 hours ago, dlanorh said:

Try the attached.

 


(defun c:enz (/ clr key pnt dim a b c)
  ;; Tharwat - 5.Jul.2019
  ;;  (load "enz.lsp") enz
  ;;  https://www.cadtutor.net/forum/topic/68126-require-lisp-3-in-1-for-xyz-coordinates-with-leader/?tab=comments#comment-552696
  
  (setq clr (getvar 'clayer)) 
  (cond ( (null (tblsearch "LAYER"  "Coor Text")) (command "-layer" "_M" "Coor Text" "_C" 7 "" "")) (t (setvar 'clayer "Coor Text")))
  (and
    (or (initget "NoZ All Z")
        (setq key
               (cond
                 ((getkword
                    "\nPick your go [No Elevation , All Coordinates , Z coordinates only] [NoZ/All/Z] < NoZ > :"
                  )
                 )
                 ("NoZ")
               )
        )
    )
    (setq pnt (getpoint "\nSpecify base point : "))
    (while pnt
    (setq dim (getvar 'DIMZIN))
    (setvar 'DIMZIN 0)
    (mapcar 'set
        '(a b c)
        (mapcar '(lambda (k p) (strcat k (rtos p 2 4)))
            '("E=" "N=" "Z=")
            pnt
        )
    )
    (setvar 'DIMZIN dim)
    (command "_.LEADER"
         "_none"
         pnt
         "\\"
         ""
         (nth (vl-position key '("NoZ" "All" "Z"))
          (list (strcat a "\\P" b) (strcat a "\\P" b "\\P" c) c)
         )
         ""
    )
    (setq pnt (getpoint "\nSpecify base point : "))
    ) ; while
  )
  (setvar 'clayer clr)
  (princ)
)

 

thanks a lot all member who support 

, now it fine,

finally complete enz lisp.

  • 4 years later...
Posted
On 7/5/2019 at 5:30 AM, BIGAL said:

Please mention command keyword

; pick a point and make a leader
; by Alan H July 2019

(defun C:cxy ( / pt1 pt2 ans txtx txty txtz oldlay)
(command "-layer" "m" "Co-ordinates" "c" 1 "Co-ordinates" "")
(setq oldlay (getvar 'clayer))
(setvar 'clayer "Co-ordinates")
(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(if (= but nil)(setq but 1))
(setq ans (ah:butts but "V"  '("Please choose" "E-N" "E-N-Z" "Z")))
(setvar "cmdecho" 0)
(while (setq pt1 (getpoint "\nPick point for co-ordinate: "))
(setq pt2 (getpoint pt1 "\nPick point for text: "))
(if pt2
(progn
(setq txtx (strcat "E= " (rtos (car pt1) 2 3) ))
(setq txty (strcat "N= " (rtos (cadr pt1) 2 3) ))
(setq txtz (strcat "Z= " (rtos (caddr pt1) 2 3) ))
(princ "\n")
(cond
((= ans "E-N")(command "leader" pt1 pt2 "Annotation" txtx txty ""))
((= ans "E-N-Z")(command "leader" pt1 pt2 "Annotation" txtx txty txtz ""))
((= ans "Z")(command "leader" pt1 pt2 "Annotation" txtz ""))
)
)
)
)
(setvar 'clayer oldlay)
(princ)
)
(c:cxy)

 

.

 

image.png.22f0e0dc782f13a6e1a249c06fdb4688.png

Multi radio buttons.lspUnavailable

 

  • 1 year later...
Posted
On 7/10/2019 at 5:48 PM, dlanorh said:

Try the attached.

 

(defun c:enz (/ clr key pnt dim a b c)
  ;; Tharwat - 5.Jul.2019
  ;;  (load "enz.lsp") enz
  ;;  https://www.cadtutor.net/forum/topic/68126-require-lisp-3-in-1-for-xyz-coordinates-with-leader/?tab=comments#comment-552696
  
  (setq clr (getvar 'clayer)) 
  (cond ( (null (tblsearch "LAYER"  "Coor Text")) (command "-layer" "_M" "Coor Text" "_C" 7 "" "")) (t (setvar 'clayer "Coor Text")))
  (and
    (or (initget "NoZ All Z")
        (setq key
               (cond
                 ((getkword
                    "\nPick your go [No Elevation , All Coordinates , Z coordinates only] [NoZ/All/Z] < NoZ > :"
                  )
                 )
                 ("NoZ")
               )
        )
    )
    (setq pnt (getpoint "\nSpecify base point : "))
    (while pnt
    (setq dim (getvar 'DIMZIN))
    (setvar 'DIMZIN 0)
    (mapcar 'set
        '(a b c)
        (mapcar '(lambda (k p) (strcat k (rtos p 2 4)))
            '("E=" "N=" "Z=")
            pnt
        )
    )
    (setvar 'DIMZIN dim)
    (command "_.LEADER"
         "_none"
         pnt
         "\\"
         ""
         (nth (vl-position key '("NoZ" "All" "Z"))
          (list (strcat a "\\P" b) (strcat a "\\P" b "\\P" c) c)
         )
         ""
    )
    (setq pnt (getpoint "\nSpecify base point : "))
    ) ; while
  )
  (setvar 'clayer clr)
  (princ)
)

 

hello  ,  

Is it possible to add a point to the place where we click with the cursor and make the text dynamic? That is, if we move the point, its coordinates will change

 

 

 

Screenshot 2025-03-08 173614.png

Posted

Hi @thecocuk07

 

Yes, it is possible. You can make dynamic block with those properties and every time when you change the position of the "base point of the block", you will get desired X, Y, Z position. 

 

Best regards. 

  • Like 1
Posted (edited)

@thecocuk07 See attached .. it's a point grouped to an mleader with a field linked to it.

example.dwg

image.thumb.png.f66bf60181078f704c9325c5a75a77e1.png

Edited by ronjonp
  • Like 2
  • 2 months later...
Posted

can anyone convert the lisp to provide Geographic Lat: Long: of particular points 

 

 

image.png.7db498845f321abe1f799c91dcb97f24.png

Posted

Converting a X y to a lat & long is not just use some formula, yes you use a formula but it has all sorts of values in it depending on where you are in the world. As you go around the world you have zones and these are relevant to where you live. 

 

There is formulas out there so google, or if you use CIV3D you can adopt a world zone and display Lat & Long's as a point style.

  • Like 1
Posted (edited)
17 hours ago, smitaranjan said:

can anyone convert the lisp to provide Geographic Lat: Long: of particular points 

 

 

image.png.7db498845f321abe1f799c91dcb97f24.png

 

In short: You need the point to be transformed to be referenced to an official reference system: UTM WGS84, ETRS89, etc., and you also need to know the geographic zone it's in.

Therefore, if your point isn't in an official reference system and you don't have transformation parameters, your first task is to find a way to relate them.

Edited by GLAVCVS
  • Like 1
Posted

I still believe @ronjonp solution is the best way...

 

 

Yes, you need your drawing set up proper as mentioned, no matter the method.

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...