Share
 
 

LISP: Add Text At Point (AddTextAtPoint)

Command line automation to add selected object text to be displayed at a selected point on the object. The function is called AddTextAtPoint and can be called from the command line or from LISP as follows.

(AddTextAtPoint text_index ename 3dpoint Report_Name)

Where text_Index is one of the following:

Item_Number 1

Item_Size 2

Item_Elevation 3

Item_Alias 4

Item_Set 5

Item_Length 6

Item_Custom 7

ename is the entity name, 3dpoint is the position for the text to be displayed, and Report_Name is required when used with Item_Custom text type.

The following sample LISP routine can be loaded and run using the ADDALLTXT command, which will add all the text to the object. This example uses a Custom Report called "SPOOL" which must pre-exist.

(setq Item_Number 1)

(setq Item_Size 2)

(setq Item_Elevation 3)

(setq Item_Alias 4)

(setq Item_Set 5)

(setq Item_Length 6)

(setq Item_Custom 7)

(defun c:addalltxt()

(setq textSize (getvar "TextSize"))

(setq textSize (+ textSize (/ textSize 10)))

(setq obj (entsel))

(setq ent (car obj))

(setq pnt (cadr obj))

(AddTextAtPoint Item_Number ent pnt)

(setq pnt (list (car pnt) (+ (cadr pnt) TextSize) (caddr pnt)))

(AddTextAtPoint Item_Size ent pnt)

(setq pnt (list (car pnt) (+ (cadr pnt) TextSize) (caddr pnt)))

(AddTextAtPoint Item_Elevation ent pnt)

(setq pnt (list (car pnt) (+ (cadr pnt) TextSize TextSize TextSize) (caddr pnt)))

(AddTextAtPoint Item_Alias ent pnt)

(setq pnt (list (car pnt) (+ (cadr pnt) TextSize) (caddr pnt)))

(AddTextAtPoint Item_Set ent pnt)

(setq pnt (list (car pnt) (+ (cadr pnt) TextSize) (caddr pnt)))

(AddTextAtPoint Item_Length ent pnt)

(setq pnt (list (car pnt) (+ (cadr pnt) TextSize) (caddr pnt)))

(AddTextAtPoint Item_Custom ent pnt "Spool")

(princ)

Was this information helpful?