- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to amend a lisp routine that currently reads selected text objects and places a vertical 3d line to the value of the number within the text object at the base point of each text object, for example a text object of 'x136.12' a vertical line is created to the length of 136.12 and is placed at the beginning of a text object. However, In some instances I need some 3D lines to be placed at the end of a text string because the 'x' character is at the end of the text string e.g. '136.12x'. I was wondering if it is possible to amend the below to place the 3D line either by recognising the 'x' character or to use a second lisp routine which I would just apply to text that has the 'x' at the end of the text string - that would place the 3D line at the end of the text string.
(DEFUN txt23derr(S)
(IF(/= S "Function cancelled")
(PROGN(PRINC "error: ")(PRINC S)))
(SETVAR "CMDECHO" VCMDEC)
(setvar "osmode" vsnap)
(setq *error* verror)
(PRINC)
)
(DEFUN C:txt23d (/ awa kerroin e awal l luku p1 p2)
(SETQ VCMDEC(GETVAR "CMDECHO") vsnap (getvar "osmode")
verror *error* *error* tzt23derr)
(SETVAR "CMDECHO" 0)
(PROMPT "\nSelect Text objects:")
(SETQ AWA (SSGET))
(setq kerroin (getreal "\nZ scale factor?:"))
(if (not kerroin) (setq kerroin 1.0))
(setq l 0 awal (sslength awa) luku 0)
(setvar "osmode" 0)
(while (< l awal)
(if (= "TEXT" (cdr (assoc 0 (setq e (entget (ssname awa l))))))
(progn
(setq zeta (* kerroin (atof (cdr (assoc 1 e))))
apis (cdr (assoc 10 e))
epis (cadr (textbox e))
va (list (car apis) (cadr apis) 0)
oy (list (car apis) (cadr apis) zeta)
luku (1+ luku)
)
(command "line" va oy "")
)
)
(setq l (1+ l) )
)
(SETQ AWA NIL)
(SETVAR "CMDECHO" VCMDEC)
(setvar "osmode" vsnap)
(setq *error* verror)
(prompt (strcat "\n I created " (itoa luku) " lines!"))
(PRINC)
)
Solved! Go to Solution.