TXT2MTXT: Changing DTEXT to MTEXT

Lisp Geeks, (& I say that "lovingly", because I love lisp routines)
Currently testing BricsCAD to see if it will do the job of replacing Acad.
So far so good except for this & another routine I use every day; need them to function for sure.
Problem #1:
In Acad, TXT2MTXT is associated w/ leaderex.arx, but was unable to get the arx file to load in BricsCAD.
Anyone have a lisp routine that will change DTEXT to MTEXT? I use TXT2MTXT as a daily routine bringing our old dwgs into the 21st century.
Thanks, Mike

Comments

  • Mike,

    Take a look at Express Tools for BricsCAD. It's free and provides access to the same express tools found in AutoCAD.

    Regards,
    Jason Bourhill
    CAD Concepts

  • Jason,
    You are a life saver. I spent all day yesterday trying to resolve Acad Express Tools I use daily & need in BricsCAD, thank you for the answer. Downloaded the ExpressTools_BricscadV18.zip & will be trying it shortly.
    Mike

  • Jason,
    Tried "TXT2MTXT" from BricsCAD Express Tools & it does not work very good.
    Selecting 4 different DTEXT text strings produces 4 different MTEXT text strings.
    What I need is 4 different DTEXT text strings to become 1 MTEXT text string.
    You know, making the old multiline DTEXT strings of text into 1 MTEXT entity.
    Perhaps I'm missing a step, if so please inform me of the proper procedure.
    Mike

  • In the past I know I have used a Dtext to Mtext utility, that worked by merging any number of Dtext objects. The lines could be optionally sorted by the sequence they are chosen, or by Y coordinate. But, the BricsCAD Express tools don't seem to work that way.

    -Joe

  • @MDunn said:
    Jason,
    Tried "TXT2MTXT" from BricsCAD Express Tools & it does not work very good.
    Selecting 4 different DTEXT text strings produces 4 different MTEXT text strings.
    What I need is 4 different DTEXT text strings to become 1 MTEXT text string.
    You know, making the old multiline DTEXT strings of text into 1 MTEXT entity.
    Perhaps I'm missing a step, if so please inform me of the proper procedure.
    Mike

    Hi Mike,
    If you have issues, you're best to raise a support request with Express Tools. Martin Drese is very helpful.

    I know with TXT2MTXT that it will combine to a single MTEXT if the TEXT is all in the same vertical alignment. There maybe some settings that govern this behaviour. The included help alludes to some settings, perhaps an earlier version of the command.

    Not sure what DTEXT you are using, but for most things using a FIELD is a better option. Particularly for BricsCAD which has limited options for working with DTEXT.

    Regards,
    Jason Bourhill
    CAD Concepts

  • MDunn,

    Is the one from Sofoco tools fail in the same manner as the one from Expresstools?
    I can't use Expresstools (only have Bricscad Classic) so I can't compare them myself.

    see TXT2MTXT on : https://bricsys.com/applications/a/?sofoco-tools-a252

  • @Peter_DV said:
    ... I can't use Expresstools (only have Bricscad Classic) ...

    I think it should work, possibly depending on which version of Classic you have. I have v17 Classic, and Express Tools works fine with that.

  • Anthony Apostolaros
    edited May 2018

    @MDunn said:
    Tried "TXT2MTXT" from BricsCAD Express Tools & it does not work very good.
    Selecting 4 different DTEXT text strings produces 4 different MTEXT text strings.
    What I need is 4 different DTEXT text strings to become 1 MTEXT text string.
    You know, making the old multiline DTEXT strings of text into 1 MTEXT entity.
    Perhaps I'm missing a step, if so please inform me of the proper procedure.

    It works fine for me.

    • Execute the command.
    • Press Enter or N, depending on whether you want line breaks included.
    • Select the dtext that's to become the first line of the mtext.
    • DON'T press Enter or Space.
    • Select all the dtexts, or at least all except the one already selected.
    • Press Enter or Space.

    It works for me regardless of whether the dtexts are aligned.

  • @Anthony Apostolaros said:
    It works for me regardless of whether the dtexts are aligned.

    I wonder why this is so different from my experience. I often get each individual dtext converted into a one-line mtext. I wonder if there is a certain tolerance for how far the X value can vary?

    Anyway, I recall that my work-around was to highlight the Dtext I want to merge, and then using the properties to change the X value to a single value. Then they can be merged. But, even then, it would not always work. I soon gave up, but now that the topic is up again, perhaps other issues may be justification differences or something like that.

    Thanks for the Lee Mac suggestion. His stuff is always top-notch.

    -Joe

  • @Anthony Apostolaros said:

    @Peter_DV said:
    ... I can't use Expresstools (only have Bricscad Classic) ...

    I think it should work, possibly depending on which version of Classic you have. I have v17 Classic, and Express Tools works fine with that.

    Considering that it's marked as needing Bricscad PRO for every version you can find, going back all the way to V12, I didn't bother installing it.

  • rwills2691
    edited May 2018

    See if this works for you...

    ;========== begin text-to-mtext

    (defun rw-objmod (modent moditm modval / moddat)
    (setq moddat (entget modent)) ; Sets moddat to the entity data
    ; for entity name moddat.
    (setq moddat
    (subst (cons moditm modval)
    (assoc moditm moddat) ; Changes the moditm group in
    moddat ; moddat to modval.
    )
    )
    (entmod moddat) ; Modifies entity value in drawing.
    (entupd modent) ; updates entity object
    )

    (defun menuitem2str (inp)
    (cond ((= inp nil)(setq ret "BYLAYER"))
    ((= inp 256)(setq ret "BYLAYER"))
    ((= inp 0)(setq ret "BYBLOCK"))
    ((and (> inp 0)(< inp 255))(setq ret (itoa inp)))
    (t nil)
    )
    )

    (defun CHK_TXT( OBJ ) ; Verifies that OBJ is single line text.
    (if (/= (cdr (assoc 0(entget OBJ))) "TEXT")
    (progn (prompt "\n ===Selection is not TEXT====")
    (setq OBJ nil)
    )
    OBJ
    )
    )

    (defun C:TMT ( / MT_LAY MT_STY MT_IPT MT_ROT MT_WID MT_TMP OLD_LAY MT_TXT MT_CLR TXT_OBJ U_CE activecolor) ; Main routine
    (setq U_CE (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (setq activecolor (getvar "CECOLOR"))

      (while (not TXT_OBJ)
             (setq TXT_OBJ (car (entsel "\nSelect TEXT object... ")))
             (if TXT_OBJ (setq TXT_OBJ (Chk_Txt TXT_OBJ)))
             )
    
      (setq MT_STY (cdr (assoc 7 (entget TXT_OBJ))) ; style
            MT_LAY (cdr (assoc 8 (entget TXT_OBJ))) ; layer
            MT_IPT (cdr (assoc 10 (entget TXT_OBJ))) ; insertion point
            MT_ROT (cdr (assoc 50 (entget TXT_OBJ))) ; rotation
            MT_HGT (cdr (assoc 40 (entget TXT_OBJ))) ; text height
            MT_CLR (cdr (assoc 62 (entget TXT_OBJ))) ; text color
            MT_TXT (strcat (cdr (assoc 1 (entget TXT_OBJ))) "\\P") ; gets text and adds line-feed
            MT_WID (* MT_HGT (strlen MT_TXT)) ; text box width
            )
    
      (if TXT_OBJ (entdel TXT_OBJ))    ; TEST    
    
      (while (setq TXT_OBJ (entsel "\nSelect next TEXT object, <Enter> to finish... "))
             (setq TXT_OBJ (car TXT_OBJ))
             (if (Chk_Txt TXT_OBJ)
                 (progn (setq MT_TXT (strcat MT_TXT (cdr (assoc 1 (entget TXT_OBJ))) "\\P")) ; adds line-feed
                        (setq MT_TMP (* MT_HGT (strlen (cdr (assoc 1 (entget TXT_OBJ))))))
                        (if (> MT_TMP MT_WID)
                            (setq MT_WID MT_TMP) ; text box width)
                            )
                        (entdel TXT_OBJ)
                        )
                 )
             ) 
    
      (setq OLD_LAY(getvar "clayer"))
      (setvar "clayer" MT_LAY)
      (if (/= MT_CLR nil) (setvar "CECOLOR" (menuitem2str MT_CLR)) ; active color
                                              )
      (command "-MTEXT" MT_IPT "S" MT_STY "W" MT_WID MT_TXT "")
    
      (setq TXT_OBJ (entlast))
      (rw-objmod TXT_OBJ 50 MT_ROT) ; angle
      (rw-objmod TXT_OBJ 40 MT_HGT) ; size
      (rw-objmod TXT_OBJ 10 MT_IPT) ; insertion point
      (rw-objmod TXT_OBJ 62 MT_CLR) ; default color (see active color above)
    
      (setvar "clayer" OLD_LAY)
      (setvar "cmdecho" U_CE)
      (setvar "CECOLOR" activecolor)
      (princ)
      )
    

    ;========== end text-to-mtext

  • @Anthony Apostolaros

    BTW, I tried and as indicated in the requirements, Express tools does indeed NOT work on Classic because it doesn't allow for .des files or .BRX type of files.

    Are you sure you have Classic and not Pro or even Platinum ?

  • rwills2691
    edited May 2018

    This site is painful for sharing code. Try the attached file. Load it and type MTM.

    Wrong! ... type TMT. Sorry.

  • I apologize. What I said above in this thread about the text to mtext conversion in Express Tools is not actually true of the Express Tools command. It describes the operation of Dotsoft's free TXT2MTXT command, which I installed a long time ago and forgot about.

    I thought I was using the Express Tools version, because it's what I get when I pull down the Express Tools menu and select "Convert Text to Mtext." The two versions use the same command string, and apparently the DotSoft version takes precedence.

    I temporarily changed the command string in the lisp file for the DotSoft command, and found that the Express Tools version has the problems that others reported. I highly recommend the DotSoft command, which is still available at http://www.dotsoft.com/freestuff.htm

  • Anthony Apostolaros
    edited May 2018

    @Peter_DV said:
    @Anthony Apostolaros

    BTW, I tried and as indicated in the requirements, Express tools does indeed NOT work on Classic because it doesn't allow for .des files or .BRX type of files.

    Are you sure you have Classic and not Pro or even Platinum ?

    Yes, I'm using BricsCAD Classic Version 17.2.12 (x64) revision 49652. I don't understand why our experience is different.

    I don't remember which version of Express Tools I downloaded, but when I open the Help screen it says "Thank you for installing the Bricscad V16 Express Tools," so maybe I actually installed version 16 instead of 17. Maybe I just got lucky somehow, and maybe the tools that use .des or .brx files don't work. I hardly ever use any Express Tools. I only got it for the Overkill command, which does work on my system.

  • @rwills2691 said:
    This site is painful for sharing code. ...

    Pull down the cryptogram just left of the smiley face and select Code. See attached image.

  • @Anthony Apostolaros, "Pull down the cryptogram".

    I had done that with the first post ... you see how it turned out. It is unreadable.

  • Jason, Joe, Peter, Anthony, Charles, rwills2691,
    Been gone 3 days, thanks guys for all the help.
    Embarrassing though, it was as simple as Joe pondered, "I wonder if there is a certain tolerance for how far the X value can vary".
    Hadn't considered this because it was never an issue in Acad. Sure enough, that's it.
    My original test was 4 Dtext objects, Top, Left, Middle, Bottom, w/ the Left text off to the left. Middle & Bottom were relatively close together "Y", & same "X", w/ Top considerably above Middle & Bottom but same "X".
    Middle & Bottom became one Mtext. So I tried moving them all w/ in the same "X" plane & roughly equal distance apart "Y" & bingo, it works.
    Running the Demo version, to see if this will replace Acad, so I definitely will need to know if the Classic version will support the Express Tools as it looks like the Classic version is all we will need; unless it will NOT support Express Tools.
    Again, thanks for the group effort in solving this. It is great to see so many people involved in lisp routines w/ BricsCAD.
    @rwills2691, will look @ that routine too, looks intriguing.

  • Joe Dunfee
    edited May 2018

    @rwills2691 said:
    @Anthony Apostolaros, "Pull down the cryptogram".

    I had done that with the first post ... you see how it turned out. It is unreadable.

    This sort of thing is my experience as well. Formatting code on this forum is not reliable. Aside from sometimes unpredictable formatting, it will sometimes modify code.

    -Joe

  • @MDunn said:
    Running the Demo version, to see if this will replace Acad, so I definitely will need to know if the Classic version will support the Express Tools as it looks like the Classic version is all we will need; unless it will NOT support Express Tools.

    Mike, The majority of Express Tools will work with BricsCAD Classic, it is largely LISP based and Classic supports this. Some functions utilise OpenDCL with LISP, which won't run on Classic.

    If you can use RUNASLEVEL to force BricsCAD to run at a particular level. If you set it to Classic and restart, then you can check for yourself what will and won't work from Express Tools.

    If you're considering purchasing BricsCAD, then in my opinion you should look at BricsCAD Pro as a minimum. It saves having to worry about this sort of thing, plus opens the opportunity of utilising the full development API. BricsCAD has a very flat cost profile. Apart from the initial purchase price, the cost for maintenance or upgrade is the same across all the levels, meaning over time there is very little difference between them all. That said you can always upgrade :-). Nice to have choices.

    Regards,
    Jason Bourhill
    CAD Concepts

  • @Jason Bourhilll

    I downloaded Expresstools_BricscadV18 and when opening the zip I see this

    As you can see, there's no .lsp file in sight but instead it's mainly .dll - .des - .brx type of files. There for I would love to hear how I would be able to get this to work in the Classic version of Bricscad.

    @ MDunn
    If you like how lisp routines can take your life easier then indeed getting the Bricscad Pro is a good deal because it has an even deeper and more comprehensive Lisp compatibility especially for the more elaborate lisp routines one can find.

    P.S.: The reason I looked at the Expresstools is because I'm only interested in the layerwalk command, something that I haven't been able to find anywhere else as a standalone lisp file, the rest of the express tools I have as separate lisp routines or are just not interested in.

  • @rwills2691:
    To format a code block the forum software requires an empty line before the element. The same applies to lists.

  • @Peter_DV said:

    I downloaded Expresstools_BricscadV18 and when opening the zip I see this

    As you can see, there's no .lsp file in sight but instead it's mainly .dll - .des - .brx type of files. There for I would love to hear how I would be able to get this to work in the Classic version of Bricscad.

    .des files are encrypted LISP. Classic will load them and treat them like normal LISP routines. The .dll & .brx relate to the aforementioned OpenDCL, this is only required for some of the dialogue based commands.

    Regards,
    Jason Bourhill
    CAD Concepts

  • @Jason Bourhill

    Thank you for the explanation. I had tried it earlier but didn't get anything of it to work but this time around I got the toolbars up and running.

    Most of them work with exception of Layerwalk, yep the one I really want. That one does need a bit of .brx code.

    Thank you kindly never the less for the showing the error of my ways.

    Have a nice one
    Peter

  • Looks like the LayerWalk command starts with a DIALOG BOX. So no ODCL for you.
    I would & did upgrade to Pro.

    But you may want to look at these:
    ------------- Isolate Layer -------------------
    http://www.theswamp.org/index.php?topic=30392.0 Isolate object by Tim Willey
    http://www.theswamp.org/index.php?topic=30142.0 Isolate nested layers by RonJonp
    http://www.theswamp.org/index.php?topic=9131.msg117714#msg117714 by CAB
    http://www.theswamp.org/index.php?topic=34490.0 by John

  • @Peter_DV said:
    Most of them work with exception of Layerwalk, yep the one I really want. That one does need a bit of .brx code.

    You realise that you can Layer Walk using the Drawing EXPLORER. :smiley:

    Regards,
    Jason Bourhill
    CAD Concepts

  • @Jason Bourhill

    DUH!

    Hadn't thought about using the drawing explorer like that.
    Again, I'm in your debt.

    Thank you kindly,have a nice one
    Peter

  • @Charles Alan Butler

    Thank you for pointing out those LISP routines. Especially the latter two which I hadn't come across before.

    Have a nice one
    Peter

  • rwills2691
    A belated thank you for your TMT lisp routine. :)
    You said:
    "See if this works for you...
    ;========== begin text-to-mtext"
    Yes, it worked flawlessly!!!
    Thank you very much. I returned to these posts today & realized I did not respond to you last summer. My apologies for not giving you thanks for such an elegant lisp routine.
    Mike