MWKINCAID1
2007-03-09, 01:28 AM
This being my first lisp routine I welcome all advice. The help i need is to automate this further. I'm trying to build 2 lists and be able to process each one on the list.
List 1 "PVI STA = 111+11.11"
List 2 "PVI ELEV = 22.22"
I have a variable length of these but they all come in pairs. 1 station to 1 elevation. there all on layer "60 vert text", romans, and rotated 90deg.
My thoughts are to use ssget to select all of the text, run it thru 2 filters to build 2 more lists, and then loop the command thru using list 1 and list 2 for my selections. Any help or advice is welcome
p.s. the bonus I’m working on is to get rid of the "end" for placing the mtext, and have it automatically select the end of the vertical line that originally comes between both of the text entities. my thoughts are to use a crossing window and filter down to a line on a specific layer, then search the line and select the greater y value and use that for the placement of the mtext. anyhow, thank in advance. and here it is...mk
(defun c:VPT (/ ent)
(setq TXA (car (entsel)))
(setq TXB (entget TXA (list "*")))
(setq TXC (cdr (assoc 1 TXB)))
(SETQ TXD (VL-STRING-POSITION (ASCII "+" ) TXC ))
(SETQ TXE (+ TXD 1))
(SETQ TXF (SUBSTR TXC TXE ))
(setq TX1 (car (entsel)))
(setq TX2 (entget TX1 (list "*")))
(setq TX3 (cdr (assoc 1 TX2)))
(SETQ TX4 (VL-STRING-POSITION (ASCII "=" ) TX3 ))
(SETQ TX5 (+ TX4 3))
(SETQ TX6 (SUBSTR TX3 TX5 ))
(SETQ ELE "Elev ")
(SETQ PLS "+")
(SETQ EQU "=")
(SETQ PVI " PI")
(SETQ LINE1 (STRCAT TXF PVI))
(SETQ LINE2 (STRCAT ELE TX6))
(COMMAND ".-MTEXT" "end" pause "rotation""90" "justify""mr" "@" LINE1 LINE2"")
(princ)
)
List 1 "PVI STA = 111+11.11"
List 2 "PVI ELEV = 22.22"
I have a variable length of these but they all come in pairs. 1 station to 1 elevation. there all on layer "60 vert text", romans, and rotated 90deg.
My thoughts are to use ssget to select all of the text, run it thru 2 filters to build 2 more lists, and then loop the command thru using list 1 and list 2 for my selections. Any help or advice is welcome
p.s. the bonus I’m working on is to get rid of the "end" for placing the mtext, and have it automatically select the end of the vertical line that originally comes between both of the text entities. my thoughts are to use a crossing window and filter down to a line on a specific layer, then search the line and select the greater y value and use that for the placement of the mtext. anyhow, thank in advance. and here it is...mk
(defun c:VPT (/ ent)
(setq TXA (car (entsel)))
(setq TXB (entget TXA (list "*")))
(setq TXC (cdr (assoc 1 TXB)))
(SETQ TXD (VL-STRING-POSITION (ASCII "+" ) TXC ))
(SETQ TXE (+ TXD 1))
(SETQ TXF (SUBSTR TXC TXE ))
(setq TX1 (car (entsel)))
(setq TX2 (entget TX1 (list "*")))
(setq TX3 (cdr (assoc 1 TX2)))
(SETQ TX4 (VL-STRING-POSITION (ASCII "=" ) TX3 ))
(SETQ TX5 (+ TX4 3))
(SETQ TX6 (SUBSTR TX3 TX5 ))
(SETQ ELE "Elev ")
(SETQ PLS "+")
(SETQ EQU "=")
(SETQ PVI " PI")
(SETQ LINE1 (STRCAT TXF PVI))
(SETQ LINE2 (STRCAT ELE TX6))
(COMMAND ".-MTEXT" "end" pause "rotation""90" "justify""mr" "@" LINE1 LINE2"")
(princ)
)