Jump to content

Lisps for Inserting Z value and annotating between z values

Recommended Posts




Im a complete novice at lisp routines and I’m having trouble finding something out there that has been written already, to do what I need it to.


Problem 1: 

I need LISP routine to annotate a level where I chose a point on a point cloud.


Failing that, one which I can click a point on the 3D Polylines, like I do currently but will annotate with text and potentially a block symbol too, instead of having to type the value. 

Problem 2:

I need a LISP which utilises the DIST command and then annotates the Delta Z value for me when I select between two points on 3D Polylines.



Could anyone help with the coding, I have tried a few things but I’m completely out of my depth.






Edited by MattMc

Share this post

Link to post
Share on other sites

Here is a start at a very basic level, and can be improved on. Uses text style "Standard" with style height set to 0.0. Re using blocks say RL=xxx in a box thats also your homework.


txtpt just pick a point.


txt2pt  just pick 2 points and drag the mouse for angle or type a value. The sort of additional options are align text based on points picked and check readability. That's your homework  only way to learn !


(defun c:txtpt ( / pt z oldsnap)
(setq oldsnap (getvar 'osmode)) ; save the current osnap settings
(setvar 'osmode 9) ; set the osnaps to node & end
(while (setq pt(getpoint "\nPick point or end Enter to exit ")) ; pick end or point continue till press Enter
	(setq z (caddr pt)) ; get z value
	(command "text" "S" "Standard" pt 2.5 0.0 (rtos z 2 3) ) ; write the text using Standard and a height of 2.5 with 3 decs
) ; end while
(setvar 'osmode oldsnap) ; reset osnaps

(defun c:txt2pt ( / pt1 pt2 z1 z2 oldsnap diff)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 9)
(while 	(setq pt1 (getpoint "\nPick point or end Enter to exit "))
		(setq pt2 (getpoint "\nPick next point "))
		(setq z1 (caddr pt1))
		(setq z2 (caddr pt2))
		(setq diff (rtos (abs (- z1 z2)) 2 3))
		(setq pt (mapcar (function (lambda (a b) (/ (+ a b) 2.0))) pt1 pt2))
		(setq pt (list (car pt)(cadr pt))) ; remove z for text command
		(setvar 'osmode 0)
		(command "text" "S" "Standard" pt 2.5 pause diff )
		(setvar 'osmode 9)
(setvar 'osmode oldsnap)

You said you google'd you must not have looked to hard there is plenty of other examples out there, try "leader Point Autocad"

Edited by BIGAL

Share this post

Link to post
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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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