Text explode - alternative to txtexp.lsp?

Discussion in 'AutoCAD' started by rllthomas, Aug 12, 2003.

  1. rllthomas

    rllthomas Guest

    The express tool txtexp.lsp doesn't work properly in 2004. The bug is logged and confirmed, no work arounds is known other than the lengthy multi-step process of using wmf files. We've been using the as a work around to an Inventor problem, now the work around is broken :(



    Does anyone know of an alternate way to explode text? I did find a program xt.lsp but it needs the shp files in the same directory as the shx file and has "stringp nil" problems I would assume are related to searchpaths... in short it needs an overhaul. To be honest I haven't done much lisp programing in a long time. My own code looks like total greek to me - LOL. I'm hoping someone else may have some working code they could share.

    Thanks in advance,

    Rich Thomas
     
    rllthomas, Aug 12, 2003
    #1
  2. rllthomas

    Bob Basques Guest

    Just a couple of posts back there was a reference to a TEXT exploder routine SHX2SHP.

    bobb
     
    Bob Basques, Aug 12, 2003
    #2
  3. rllthomas

    Tim Guest

    Try This



     



    ;BRKTXT.LSP
    ;BRKTXT SEARCHES FOR A TEXT STRING WITHIN A TEXT LINE
    ;AND BREAKS THE TEXT AT THAT POINT. THE REST OF THE
    ;TEXT THAT'S BEEN SPLIT CAN THEN BE PLACED ANYWHERE YOU WANT IT.
    (DEFUN C:BRKTXT (/ T D TXT BTXT TST LEN LEN1 E CT+ TXTN TXT2)
    (PROMPT "\nPICK THE LINE OF TEXT TO BREAK:  ")
    (SETQ T (ENTGET (CAR (ENTSEL))))
    (SETQ D (ASSOC 1 T))
    (SETQ TXT (CDR D))
    (SETQ BTXT (GETSTRING 1 "\nEnter sub_string to break:  "))
    (SETQ TST (STRCAT "*" BTXT "*"))
    (IF (/= NIL (WCMATCH TXT TST))
    (PROGN
    (SETQ LEN (STRLEN BTXT))
    (SETQ LEN1 (- LEN 1))
    (SETQ E 1)
    (SETQ CT 1)
    (WHILE E
    (IF (= (SUBSTR TXT CT LEN) BTXT)
    (PROGN
    (SETQ TXTN (SUBSTR TXT 1 (+ CT LEN1)))
    (SETQ TXT2 (SUBSTR TXT (+ CT LEN)))
    (SETQ T (SUBST (CONS 1 TXTN) D T))
    (ENTMOD T)
    (SETQ E NIL)
    (SETQ T (SUBST (CONS 1 TXT2) (CONS 1 TXTN) T))
    (SETQ T (CDR T))
    (ENTMAKE T)
    (SETQ PT1 (CDR (ASSOC 10 T)))
    (COMMAND "MOVE" "1" "" PT1 PAUSE)
    )
    (SETQ CT (+ CT 1)
    )
    )
    ))
    );END BRKTXT.LSP



    "rllthomas" <> wrote in message news:...

    The express tool txtexp.lsp doesn't work properly in 2004. The bug is logged and confirmed, no work arounds is known other than the lengthy multi-step process of using wmf files. We've been using the as a work around to an Inventor problem, now the work around is broken :(



    Does anyone know of an alternate way to explode text? I did find a program xt.lsp but it needs the shp files in the same directory as the shx file and has "stringp nil" problems I would assume are related to searchpaths... in short it needs an overhaul. To be honest I haven't done much lisp programing in a long time. My own code looks like total greek to me - LOL. I'm hoping someone else may have some working code they could share.

    Thanks in advance,

    Rich Thomas
     
    Tim, Aug 12, 2003
    #3
  4. rllthomas

    rllthomas Guest

    ; error: malformed list on input



    I'll have to stare at it some more. I don't see any hosed up () or "" anywhere to cause this. Probably something to do with a carriage return and how notepad would interpret what I pasted.



    THX

    Rich
     
    rllthomas, Aug 12, 2003
    #4
  5. rllthomas

    Ed Jobe Guest

    BTW, I don't think this is what you're looking for. It breaks up text into separat text ents, still text...not lines and arcs.




    --
    Ed
    --




    "rllthomas" <> wrote in message news:...

    ; error: malformed list on input



    I'll have to stare at it some more. I don't see any hosed up () or "" anywhere to cause this. Probably something to do with a carriage return and how notepad would interpret what I pasted.



    THX

    Rich
     
    Ed Jobe, Aug 12, 2003
    #5
  6. rllthomas

    rllthomas Guest

    That was my first impression too, based on the comment lines. Then I figured maybe he is like me and takes something close, changes it all around to do what he wants and never updates the comments - LOL.
     
    rllthomas, Aug 12, 2003
    #6
  7. rllthomas

    Mark Guest

    this is a simple general purpose WMF to Lines routine,
    very similar to the express tools provided...
    make sure you have a look at the WMFOPTS first...
    at the command prompt type WMFOPTS...

    (defun C:WMF2L (/ ss1 vy vx vc vt ll ur ul fnm)
    (setvar "CMDECHO" 0)(setvar "HIGHLIGHT" 1)
    (setvar "OSMODE" 0)(setvar "MIRRTEXT" 1)
    (setvar "WMFBKGND" 0)(setvar "WMFFOREGND" 0)
    (setq fnm (strcat (getvar "TEMPPREFIX") "TempWMF.wmf"))
    (if (setq ss1 nil ss1 (ssget))
    (progn
    (setq vy (getvar "VIEWSIZE")
    vx (* vy (/ (car (getvar "SCREENSIZE"))(cadr (getvar "SCREENSIZE"))))
    vc (getvar "VIEWCTR")
    ll (list (- (car vc)(/ vx 2.0))(- (cadr vc)(/ vy 2.0)) 0.0)
    ur (list (+ (car vc)(/ vx 2.0))(+ (cadr vc)(/ vy 2.0)) 0.0)
    ul (list (car ll)(cadr ur))
    vt (list (car vc)(cadr ur)) ) ;; top middle of view to mirror w/ vc
    (command "_.MIRROR" ss1 "" vc vt "Y"
    "_.WMFOUT" fnm ss1 "" "_.ERASE" ss1 "" "_.WMFIN" fnm ul "2" "" ""
    "_.MIRROR" (entlast) "" vc vt "Y" "_.EXPLODE" (entlast)) )) (princ) )




    work arounds is known other than the lengthy multi-step process of using wmf files. We've been using
    the as a work around to an Inventor problem, now the work around is broken :(
    shp files in the same directory as the shx file and has "stringp nil" problems I would assume are
    related to searchpaths... in short it needs an overhaul. To be honest I haven't done much lisp
    programing in a long time. My own code looks like total greek to me - LOL. I'm hoping someone else
    may have some working code they could share.
     
    Mark, Aug 13, 2003
    #7
  8. rllthomas

    rllthomas Guest

    Mark,



    I don't care what everyone else says about you you're alright! - LOL



    I'd like to thank everyone for their help. Marks code works perfect; mtext or text,TTF or shape file. Certainly a lot smarter approach to what I started yesterday. I was trying to uncompile and explode the shape files LOL.



    Thanks again!



    Rich
     
    rllthomas, Aug 13, 2003
    #8
  9. rllthomas

    Mark Guest

    you are welcome.
    before MWF came to existance, i had written code
    which tranformed shx2shp then read the source code
    and draw the text from the font definition, lines,
    polylines, circles and arcs, there was one major catch,
    it only worked with fonts created and provided by me.
    that is the code you are referring to (XT) most probably.

    file. Certainly a lot smarter approach to what I started yesterday. I was trying to uncompile and
    explode the shape files LOL.
     
    Mark, Aug 13, 2003
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.