Author Topic: text changed  (Read 2176 times)

0 Members and 1 Guest are viewing this topic.

taner

  • Guest
text changed
« on: September 17, 2009, 08:05:10 PM »
Dear all,

Can anyone do me a favour to write such a program described as the attachment.
I guess it may use reactor.

Thanks in advance.
« Last Edit: September 17, 2009, 09:17:40 PM by Tsec2nd »

Crank

  • Water Moccasin
  • Posts: 1503
Re: text changed
« Reply #1 on: September 18, 2009, 01:21:48 PM »
You don't need a reactor, this is possible with a field.
Objects > Object > (select the other text) > Contents
Vault Professional 2023     +     AEC Collection

Crank

  • Water Moccasin
  • Posts: 1503
Re: text changed
« Reply #2 on: September 18, 2009, 02:13:07 PM »
Code: [Select]
(defun c:sametext (/ ent1 ent2 objID)
(command "_undo" "BEGIN")
(vl-load-com)
(setq ent1 (car (entsel "\nSelect original text: ")))
;;convert the entity to an object
(setq objID (vla-get-objectid (vlax-ename->vla-object ent1))
     str   (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos objID 2 0) ">%).TextString>%")
)
(setq ent2 (vlax-ename->vla-object (car (entsel "\nSelect text to be the same: "))))
(vla-put-textstring ent2 str)
(vla-update ent2)
(command "_undo" "END")
(princ)
)
Vault Professional 2023     +     AEC Collection

taner

  • Guest
Re: text changed
« Reply #3 on: September 18, 2009, 07:42:07 PM »
Code: [Select]
(defun c:sametext (/ ent1 ent2 objID)
)

Thanks very much for your code,but I do not like to select twice(target and source).While one was change,the other(which has some special relatation with the first "text1")would be changed at the same time just like block.

Thanks!

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: text changed
« Reply #4 on: September 18, 2009, 08:01:20 PM »

Tsec2nd 


First:
You have to SETUP your second text to read the first text VALUE.
Crank's program does this.
Run his code.

THEN :-

When you change the value of the first text, REGEN and the second value should change.


 
 
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

taner

  • Guest
Re: text changed
« Reply #5 on: September 18, 2009, 08:34:14 PM »

Tsec2nd 


First:
You have to SETUP your second text to read the first text VALUE.
Crank's program does this.
Run his code.

THEN :-

When you change the value of the first text, REGEN and the second value should change.


 
 


Thanks! Kerry and Crank

It runs well,but how to erase the bankground of 2nd "text1"?
thanks

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: text changed
« Reply #6 on: September 18, 2009, 09:01:48 PM »

Command: FIELDDISPLAY
Enter new value for FIELDDISPLAY <1>: 0
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Crank

  • Water Moccasin
  • Posts: 1503
Re: text changed
« Reply #7 on: September 19, 2009, 10:50:02 AM »
Tsec2nd, I should leave FIELDDISPLAY=1, because then you know which text you have to change. The background isn't plotted anyway.
Vault Professional 2023     +     AEC Collection