+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Junior Member
    Using
    AutoCAD 2013
    Join Date
    Nov 2015
    Posts
    11

    Default Separate Mtext to individual text

    Registered forum members do not see this ad.

    Currently, I have an Excel table. Numbers of column contains 0 or 1.
    1213.jpg
    I have to copy column by column into notepad and then copy the notepad contain to CAD.
    After that, I have serval individual column of Mtext. Then I further explode them into text.
    A numbers of individual text are pasted on CAD and this is what I want.
    However, if I do copy multiple column into notepad, the result is a whole Mtext which is containing all columns. I explode the Mtext and I will obtain multiple line of text.
    I am searching for a lisp to convert/separate Mtext to individual text.
    123.jpg
    For more advance, I want these 1 and 0 located in different destination point from excel to CAD by a lisp.

  2. #2
    Senior Member
    Computer Details
    Happy Hobbit's Computer Details
    Operating System:
    Win 7
    Discipline
    Electrical
    Using
    AutoCAD 2014
    Join Date
    Jun 2012
    Location
    Dorset, England
    Posts
    175

    Default

    I found this somewhere, the user copies text from Excel or Word for example. The user invokes the PSTSP command & the text gets pasted as individual text items. I've changed it slightly to capitalise the text:

    Code:
    (defun c:PSTSP (/ _GetClipBoardText ent_last last_ent pt str)
     (vl-load-com)
      (defun _GetClipBoardText (/ htmlfile result)
        (setq result
               (vlax-invoke
                 (vlax-get
                   (vlax-get
                     (setq htmlfile (vlax-create-object "htmlfile"))
                     'ParentWindow
                   )
                   'ClipBoardData
                 )
                 'GetData
                 "Text"
               )
        )
        (vlax-release-object htmlfile)
        result
      )
    
      (if (not (setq ent_last (entlast)))
        (progn
          (entmake '(
                     (0 . "POINT")
                     (100 . "AcDbEntity")
                     (100 . "AcDbPoint")
                     (10 . (0.0 0.0 0.0))
                    )
          )
          (setq ent_last (entlast)
                last_ent ent_last
          )
        )
      )
      (if (and (setq str (_GETCLIPBOARDTEXT))
               (setq pt (getpoint "\nSpecify text start point: "))
          )
        (progn
          (setq str (strcase str))
          (entmake (list
                     '(0 . "MTEXT")
                     '(100 . "AcDbEntity")
                     '(100 . "AcDbMText")
                     (cons 10 pt)
                     (cons 1 str)
                   )
          )
          
          (command "_.explode" "_L")
        )
      )
      (if last_ent
        (entdel last_ent)
      )
      (princ)
    )

  3. #3
    Junior Member
    Using
    AutoCAD 2013
    Join Date
    Nov 2015
    Posts
    11

    Default

    Thank you!
    However, I would like to do this:
    124213.jpg
    If I copy muliple column in Excel, the result is left one.
    I want the right instead of left.
    Each 1 and 0 should be seperated text.

  4. #4
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,901

    Default

    There are lots of examples of read excel file into Autocad via each individual cell as say a text value. Have a search here for "excel", you do not need a intermediate step via notepad etc.

    There was something maybe last week will try to find.
    A man who never made mistakes never made anything

  5. #5
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    637

    Default

    This tool may have what you want : http://www.cadtutor.net/forum/showth...ext-editor-RLX


    Follow instructions (rename vt.lsp to vt.vlx and then use (load "vt.vlx") ...)


    When you start the command press space or R-mouse to start quick menu and select function PasteSpec. Rest should be easy.


    gr. Rlx

  6. #6
    Junior Member
    Using
    AutoCAD 2013
    Join Date
    Nov 2015
    Posts
    11

    Default

    Thank you BIGAL and rlx!!
    I found Lee Mac: http://www.lee-mac.com/readcsv.html and I am successful to use this to make as individual text.

    rlx, I tried your lisp. It is quite powerful lisp.
    However, I want more code example to study how to write a lisp for a task.

    By the way, thank you all a lot!

  7. #7
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    637

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by CloudJack View Post
    Thank you BIGAL and rlx!!
    I found Lee Mac: http://www.lee-mac.com/readcsv.html and I am successful to use this to make as individual text.

    rlx, I tried your lisp. It is quite powerful lisp.
    However, I want more code example to study how to write a lisp for a task.

    By the way, thank you all a lot!



    You're welcome , see also link below , last part of lsp has the excel code


    http://www.cadtutor.net/forum/showth...or-lsp-amp-dcl


    Gr. Rlx
    Last edited by rlx; 4th Dec 2015 at 09:50 am.

Similar Threads

  1. Rotating lots of individual bits of text at once
    By Barneel in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 9th Sep 2013, 06:00 pm
  2. Individual Text Object
    By mac111 in forum AutoCAD Beginners' Area
    Replies: 1
    Last Post: 20th Jun 2011, 03:06 am
  3. separate mass overlapping text.
    By hay123 in forum AutoCAD General
    Replies: 3
    Last Post: 2nd Dec 2008, 11:56 am
  4. How to separate text into individual lines?
    By Chris333 in forum AutoCAD Beginners' Area
    Replies: 7
    Last Post: 29th Oct 2007, 01:14 pm
  5. Exporting individual layouts to separate drawings?
    By Gideon in forum AutoCAD General
    Replies: 3
    Last Post: 5th May 2005, 03:53 pm

Tags for this Thread

Bookmarks

Posting Permissions

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