Jump to content

Recommended Posts

Posted

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))

Posted
(entmod (subst (cons 1 (strcat (itoa d) "%%C")) (assoc 1 (setq e (entget (ssname ss 0)))) e))

Posted (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 by BIGAL
Posted

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.

Posted
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.

Posted

No worries Tharwat.

 

Added the mtext check for simple text edit.

Posted
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)

Posted

...
(wcmatch (vla-get-objectname obj) "AcDb*Text")
...

 

Thats clever! :thumbsup:

 

 

..
(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

Posted
Thats clever! :thumbsup:

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 ] ). ;)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...