Jump to content

Get Z coordenate from a point or 3Dpolyline


toxicsquall

Recommended Posts

I'm having a problem getting a Z coordinate from a point or a object, like a 3dPolyline.

I need to put a text in front of it. I have this one, but it only gets the X and Y coordinates and I just need the Z coordinate.

 

 

Quote

 

(defun C:incoord (/ pc)
 (setq pc (getpoint "\nClick on the point: "))
 (while pc
    (##InsTextCoord pc)
    (setq pc (getpoint "\nNext Point [Or <Enter> to end]: "))
  )
  (princ)
)

(defun ##InsTextCoord (ponto / px py)
    (setq px (car ponto))
    (setq py (cadr ponto))
    (command ".text" ponto "" "" (strcat "X= " (rtos px) ", Y= " (rtos py)))
)

(princ "\n INCOORD to start")
(princ)

 

 

Link to comment
Share on other sites


(defun C:incoord (/ pc)
  (setq pc (getpoint "\nClick on the point: "))
  (while pc
    (##InsTextCoord pc)
    (setq pc (getpoint "\nNext Point [Or <Enter> to end]: "))
  )
  (princ)
)

(defun ##InsTextCoord (ponto / px py pz)
    (setq px (car ponto))
    (setq py (cadr ponto))
    (setq pz (caddr ponto))
    (command ".text" ponto "" "" (strcat "X= " (rtos px) ", Y= " (rtos py) ", Z= " (rtos pz) ))
)

(princ "\n INCOORD to start")
(princ)

  • Like 1
Link to comment
Share on other sites

You could just

 

(defun c:incoord (/ pc)
  (while (setq pc (getpoint "\nClick on the point or Enter to End : "))
    (command ".text" pc "" "" (strcat "Z = " (rtos (caddr pc))))
    ;(command ".text" pc "" "" (strcat "X = " (rtos (car pc)) ",Y = " (rtos (cadr pc)) ",Z = " (rtos (caddr pc))))
  )
  (princ)
)
(princ "\nType incoord to start")
(princ)

 

If you want X,Y & Z comment out the first (command ".text" ....) and uncomment the second (command ".text" ....)

Link to comment
Share on other sites

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