souvik Posted May 7, 2014 Posted May 7, 2014 Is it possible to subtract or add multiple real text value to other multiple text value and put the result at same X coordinate. Here I want to subtract from Row 1 to Row 2. Text values of Row 1 and Row 2 are in the same X axis. Now I want to select the Row 1 first then Row 2 Second and pick the Result row for placing the result. Quote
BIGAL Posted May 7, 2014 Posted May 7, 2014 Here is a start ;Writes the difference text1-text2 to text3 (defun C:T1t2 () (setq text1 (entget (car (entsel "\nSelect text 1 ")))) (setq anst1 (atof (cdr (assoc 1 text1)))) (setq text2 (entget (car (entsel "\nSelect text 2 ")))) (setq anst2 (atof(cdr (assoc 1 text2)))) (setq ans (rtos (- anst1 anst2) 2 3)) (setq en (entsel "\nSelect destination text:")) (setq el (entget (car en))) (setq el (subst (cons 1 ans) (assoc 1 el) el)) (entmod el) ;(entupd en) ) end defun (PRINC) 1 Quote
souvik Posted May 7, 2014 Author Posted May 7, 2014 (edited) Thanks BIGAL. But here I cannot select Multiple text. Edited May 7, 2014 by souvik Quote
BIGAL Posted May 8, 2014 Posted May 8, 2014 Its way more complex selecting lines of text I know it can be done BUT ! one missing text and your screwed. Simple answer is create 3 lists row1 row2 row3 then simply item(1)row1-item(1)row2 update item1(row3) just use ssget with text filter to make 3 lists. If I have time will do. Quote
BIGAL Posted May 9, 2014 Posted May 9, 2014 2nd version this needs more enhancements but will work for what you posted rows or columns, a couple of assumptions that the text is generated in the correct order one after another not random. For random code needs more rework to check x or y row/column. Does not check for uneven number of texts. make row1 row2 copy row2 for row3 it will then update. ; Row1 - Row2 change value Row3 ; by Alan H May 2014 (defun r1r2r3 ( / ss1 ss2 ss3 el1 el2 el3 diff val1 val2) (alert (strcat "Select 1st rowcol of text" "\nPlus Enter to accept")) (setq ss1 (ssget (list (cons 0 "Text")))) (setq len1 (sslength ss1)) (alert (strcat "Select 2nd row/col of text" "\nEnter to accept")) (setq ss2 (ssget (list (cons 0 "Text")))) (setq len2 (sslength ss2)) (alert (strcat "Select 3rd row/col of text" "\nEnter to accept")) (setq ss3 (ssget (list (cons 0 "Text")))) (setq len3 (sslength ss3)) ; needs a check here len1=len2=len3 for unbalanced (setq x 0) (repeat len1 (setq el1 (entget (ssname ss1 x))) (setq val1 (atof (cdr (assoc 1 el1)))) (setq el2 (entget (ssname ss2 x))) (setq val2 (atof (cdr (assoc 1 el2)))) (setq diff (rtos (- val1 val2) 2 3)) (setq el3 (entget (ssname ss3 x))) (entmod (subst (cons 1 diff) (assoc 1 el3) el3)) (setq x (+ x 1)) ) ; repeat ) ; defun (r1r2r3) Quote
Recommended Posts
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.