ktbjx Posted January 10, 2018 Share Posted January 10, 2018 i dont understand hot to use entmod to change the value of text heres what i got so far.. i just wanted to change the number value. (defun C:ddip (/ ss d dstring) (setq ss (ssget "_:S" '((0 . "TEXT")))) (setq d (getint "\nEnter Dip :")) (setq dstring (strcat (itoa d)"°")) (entmod (subst dstring)) (princ)) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 10, 2018 Share Posted January 10, 2018 (entmod (subst (cons 1 (strcat (itoa d) "%%C")) (assoc 1 (setq e (entget (ssname ss 0)))) e)) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 10, 2018 Share Posted January 10, 2018 (edited) A Vl version also if d is only being used here why make it a number ? I know error trap but you have to have some faith in end users. (defun c:ddip ( / obj str ) (setq obj (vlax-ename->vla-object (car (entsel "pick text object")))) (if (or (= "AcDbText" (vla-get-objectname obj)) (= "AcDbMText" (vla-get-objectname obj)) ) (progn (setq str (strcat (getstring "\nEnter dip") "%%c")) (vla-put-textstring obj str) ) ) ) Edited January 10, 2018 by BIGAL Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 10, 2018 Share Posted January 10, 2018 BIGAL, have a look again at your codes. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 10, 2018 Share Posted January 10, 2018 Thanks Tharwat changed as you must have typed reply. Its 8:21 pm here what time where you are ? Had one version in notepad other in Vlide posted wrong one. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 10, 2018 Share Posted January 10, 2018 Its 8:21 pm here what time where you are ? Sorry for this late reply. The time was 1:21 pm here so there are five hours deference between our both timing. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 11, 2018 Share Posted January 11, 2018 No worries Tharwat. Added the mtext check for simple text edit. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 11, 2018 Share Posted January 11, 2018 No worries Tharwat. Added the mtext check for simple text edit. Hi, Actually there is no need to convert to vla-object to get the job done. Anyway, if I planned to write it with vlisp then I will go with the following track. (defun c:ddip (/ obj str) (and (setq obj (car (entsel "\nPick text object :"))) (setq obj (vlax-ename->vla-object obj)) (wcmatch (vla-get-objectname obj) "AcDb*Text") (/= "" (setq str (getstring "\nEnter dip :"))) (vla-put-textstring obj (strcat str "%%c")) ) (princ) ) (vl-load-com) Quote Link to comment Share on other sites More sharing options...
Grrr Posted January 11, 2018 Share Posted January 11, 2018 ... (wcmatch (vla-get-objectname obj) "AcDb*Text") ... Thats clever! .. (vla-put-textstring obj (strcat str "%%c")) ... Just a minor correction - it doesn't look like OP wants the diameter symbol, but the degree slope one: _$ (vl-list->string '(37 37 99)) "%%c" ; <- labels pipe diameter _$ (chr 176) "°" ; <- labels slope in degrees Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 11, 2018 Share Posted January 11, 2018 Thats clever! Thank you. Just a minor correction - it doesn't look like OP wants the diameter symbol, but the degree slope one: I agree with you, so the OP has two options now ( diameter / degrees [ %%C , %%D ] ). Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 12, 2018 Share Posted January 12, 2018 2nd very clever using wildcard Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 12, 2018 Share Posted January 12, 2018 2nd very clever using wildcard Thank you BIGAL. Quote Link to comment Share on other sites More sharing options...
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.