See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Marking Edited TEXT/MTEXT Entities

  1. #1
    Member
    Join Date
    2004-03
    Posts
    27
    Login to Give a bone
    0

    Default Marking Edited TEXT/MTEXT Entities

    Our Drafting Supervisor has asked me to provide a method to visually identify all text and multiline text that is edited by changing the font and color. I have existing LISP code to handle this for TEXT entities, but am struggling to come up with a way to do this for MTEXT entities. I would like to continue to use the supplied "internal" editor for the actual MTEXT editing, then somehow automatically choose the just modified text to change the font and color.

    Any suggestions?

    Thanks,
    Bob

  2. #2
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Marking Edited TEXT/MTEXT Entities

    Hi Bob, why not just include MTEXT in Your lisp ?

    It is much more easy to help if You show Your code.
    Otherwise the dxf code for both (0 . TEXT) and (0 . MTEXT) is
    (62 . xx ) for main color and ( 7 . xx ) for main font.
    If You change color and font partly inside the MTEXT You will have problem.

    : ) Happy Computing !

    kennet
    Last edited by kennet.sjoberg; 2004-11-23 at 07:44 AM.

  3. #3
    100 Club
    Join Date
    2000-12
    Posts
    126
    Login to Give a bone
    0

    Default Re: Marking Edited TEXT/MTEXT Entities

    Bob,
    Just out of curiosity, wouldn't it be easier - and more in line with a standard convention - to mark edited text with a box? Possibly on a layer of its own. As Kennet is hinting at, visually changing MTEXT that may have been formatted is not a simple task. At least not if the changes later need to be reverted.

  4. #4
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    2

    Default Re: Marking Edited TEXT/MTEXT Entities

    This is a good time to use a reactor routine. In this case two reactors are required. The first is an acdb reactor and the second is a command ended reactor. The acdb reactor catches the modification event and makes a list of entities changed in the command and the command ended reactor changes the list of entities to be color 1 for example. You may find the actual creation of the entity will cause the entities to change but you can modifiy this routine to allow for not changing them upon creation.

    Peter Jamtgaard

    Code:
    (defun evtObjectModified (objReactor lstObjectModified / objModified)
     (setq objModified (vlax-ename->vla-object (cadr lstObjectModified)))
     (if (and (wcmatch (vla-get-objectname objModified) "AcDbMText,AcDbText")
    		  (not blnRerun))
      (setq lstObjectsModified (cons objModified lstObjectsModified)))
     (princ)
    )
    (defun evtCommandEnded (evtCall lstCallback / objModified)
     (if lstObjectsModified
      (progn   
       (setq blnRerun 'T)
       (foreach objModified lstObjectsModified
    	(vla-put-color objModified 1))   
       (setq blnRerun		   nil
    		 lstObjectsModified nil)))
     (princ)
    )
    (setq rxnObjectModified (vlr-acdb-reactor nil   '((:vlr-objectModified . evtObjectModified )))
    	  rxnCommandEnded   (vlr-editor-reactor nil '((:vlr-commandended   . evtCommandEnded))))
    

  5. #5
    Member
    Join Date
    2004-03
    Posts
    27
    Login to Give a bone
    0

    Default Re: Marking Edited TEXT/MTEXT Entities

    Peter,

    You have identified what it is that I am trying to accomplish. I understand event driven programming having spent several years developing software using the Windows SDK. But, my knowledge of ACAD reactors is not much more than knowing they exist.

    I'll take a shot at using your sample code to do what I need to do. It will be next week before I can try it. Any suggestions on how to learn more about reactors?

    Thanks to everyone that has responded.

    Happy Thanksgiving,
    Bob

  6. #6
    AUGI Addict Glenn Pope's Avatar
    Join Date
    2001-05
    Location
    Austin, TX USA
    Posts
    2,201
    Login to Give a bone
    0

    Default Re: Marking Edited TEXT/MTEXT Entities

    A good place to learn about reactors is Afralisp. Check out the lisp Tutorials, under Visual Lisp Tutorials.

  7. #7
    Member
    Join Date
    2004-03
    Posts
    27
    Login to Give a bone
    0

    Question Re: Marking Edited TEXT/MTEXT Entities

    Peter ...

    I finally got some time to work on this. I modifed your sample code to select TEXT and MTEXT entities for modification. Here is my expanded version of you r orginal exmple:

    Code:
    (defun evtObjectModified (objReactor lstObjectModified / objModified)
     (setq objModified (vlax-ename->vla-object (cadr lstObjectModified)))
     (if (and (wcmatch (vla-get-objectname objModified) "AcDbMText,AcDbText")
    		  (not blnRerun))
      (setq lstObjectsModified (cons objModified lstObjectsModified)))
     (princ)
    )
    (defun evtCommandEnded (evtCall lstCallback / objModified)
     (if (and lstobjectsmodified (or (= (car lstCallback) "DDEDIT")
                                     (= (car lstCallback) "MTEDIT")))
      (progn   
       (setq blnRerun 'T)
       (foreach objModified lstObjectsModified
    	(vla-put-color objModified 4)
            (vla-put-PlotStyleName objModified "HEAVY")
            (vla-put-StyleName objModified "20DEG")
       )  
      )
     )
     (setq blnRerun nil)
     (setq lstObjectsModified nil)
     (princ)
    )
    (setq rxnObjectModified (vlr-acdb-reactor nil   '((:vlr-objectModified . evtObjectModified )))
    	  rxnCommandEnded   (vlr-editor-reactor nil '((:vlr-commandended   . evtCommandEnded))))

    This works just fine. However, when an "UNDO" command is exited to undo the modifications I get a bunch of copies of the following message:


    "Automation Error. Description was not provided."

    There appears to be possibly one such message for each entity in the drawing. (Not sure of this, but the number increases with the number of entities.)

    The UNDO works just fine and a REDO works as well. Can you tell me what this message is trying to tell me and ho w to prevent it or suppress it.

    Thanks,
    Bob
    Last edited by RobertB; 2004-12-07 at 01:11 AM. Reason: Place code in code format tags

Similar Threads

  1. 2013: Text indenting changes each time it's edited
    By trialbyfire in forum Revit Structure - General
    Replies: 13
    Last Post: 2017-05-25, 03:37 PM
  2. 2009: Differentiate text entities from mtext entities
    By samirjoshi in forum AutoCAD General
    Replies: 4
    Last Post: 2012-01-16, 11:08 AM
  3. SHP text entities
    By barrett.alistair in forum AutoCAD Map 3D - Import/Export
    Replies: 1
    Last Post: 2010-10-25, 10:01 PM
  4. Unable to save edited Attribute Text
    By rw4 in forum AutoCAD Fields
    Replies: 2
    Last Post: 2008-10-15, 03:59 AM
  5. Updating Text Mask once Text has been edited
    By r_soula in forum AutoCAD General
    Replies: 8
    Last Post: 2007-06-05, 03:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •