+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Jan 2009
    Posts
    4

    Default From dtext to a z-position

    Registered forum members do not see this ad.

    Greetings,

    I am designing a road for my final school project and I just received a height map. The problem is, is that the heights are dtext's and I need to create points with the height written in the texts. I would add them manually but there are about 30.000 texts so that's not a realistic option.

    So my question is; is there a way to automatically create points at the origin of the dtexts, where the z-value of the points comes from the texts-content and the x and y-value comes from text's geometry?

    Some extra info:
    - The origins of the texts are 5 units apart in both x and y-directions.
    - I'm using AutoCAD 2008.

    Thanks a lot.
    Last edited by Veryname; 23rd Jan 2009 at 01:50 pm.

  2. #2
    Forum Deity
    Using
    AutoCAD 2002
    Join Date
    Sep 2006
    Location
    East Sussex, U.K.
    Posts
    3,000

    Default

    The quick answer is yes, this could be done using Lisp.

    The slow answer is that you would have to get the attention of someone who could write this Lisp - possibly post a thread in that section of the Forum

  3. #3
    Super Moderator Tiger's Avatar
    Computer Details
    Tiger's Computer Details
    Operating System:
    Windows 7 Enterprise 64 bit
    Computer:
    Dell Precision M4500
    CPU:
    Intel Core i5 2.40GHz
    RAM:
    8GB
    Graphics:
    NVIDIA Quadro FX 880M
    Primary Storage:
    280 GB
    Monitor:
    2 x Samsung SyncMaster 2443 24''
    Using
    AutoCAD 2012
    Join Date
    Nov 2006
    Location
    Sthlm, Sweden
    Posts
    4,606

    Default

    Eldon's right, at least I think he's right, you'll probably need a lisp to get this done - so I moved your thread to the Lisp-part of the forum in the hopes you'll get faster help here
    Life doesn't suck, although we all go through periods when it may be easier to think that, than to discern the solution to whatever problem is the most formidable
    at the moment in one's personal UCS.
    Go to PLAN view instead. - Dadgad

  4. #4
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Jan 2009
    Posts
    4

    Default

    Thanks for the replies.

    If it's that much work I'll use the macro I created, I don't want to put someone else through that much trouble. It took me three hours to make the macro and it takes 2 second per text but I'll just have to let it run all night I was just hoping there was some secret command/function I wasn't aware of to speed things up incase I have to do this again in the future.

    PS, if someone wants to make it I wont object

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,816

    Default

    A LISP for this shouldn't be too hard - one question - does the text items only contain the z-value and no other text? Also, are we talking only DTEXT, or MTEXT also?

    Also - I can create a LISP in which the user will select the text manually - (using a selection set). - or, if all the heights are on the same layer, or if they are the only text (or DTEXT) in the drawing, then I can set the LISP to automatically do the selecting for you. -- For this to happen the text needs some "defining" factor, so a filter list can be created. - i.e. on own layer, or the only DTEXT, or have their own colour etc etc.
    Last edited by Lee Mac; 23rd Jan 2009 at 04:46 pm.
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,816

    Default

    Also, what layer do you want these "Points" to be on? - and I assume they are just standard ACAD Points.

    So, if I am correct, you want to use the base points of the text for the x,y and the contents of the text for the z?

    Thanks

    Lee
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  7. #7
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Jan 2009
    Posts
    4

    Default

    To answer your question:
    • Yes, the text only contains the height value, e.g.: "129.30"
    • All off them are dtext, no mtexts.
    • The file only contains the texts and they are all the same layer/color. The layer is "49" and the color is "12", which is a redish color.
    • The points can be on any layer, I'll just move them if need be.
    • They are just regular AutoCAD points.
    • "You want to use the base points of the text for the x,y and the contents of the text for the z?" <- Yep.
    Thanks for the help

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,816

    Default

    OK, try this:

    Code:
    (defun c:zht (/ varlist oldvars ss eLst bPt zVal nbPt ptLst)
      (vl-load-com)
      (setq varlist (list "CMDECHO" "OSMODE")
        oldvars (mapcar 'getvar varlist))
      (mapcar 'setvar varlist (list 0 0))
      (if (setq ss (ssget "X" '((0 . "TEXT")(8 . "49")(62 . "12"))))
        (progn
          (setq eLst (vl-remove-if 'listp
               (mapcar 'cadr (ssnamex ss))))
          (foreach e eLst
        (setq bPt (cdr (assoc 10 (entget e)))
              zVal (atof (cdr (assoc 1 (entget e))))
              nbPt (subst zVal (last bPt) bPt)
              ptLst (cons nbPt ptLst)))
          (foreach pt ptLst
        (command "_point" pt)))
        (princ "\n<!> No Text Found <!>"))
      (mapcar 'setvar varlist oldvars)
      (princ))
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  9. #9
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Jan 2009
    Posts
    4

    Love

    Sweet, worked like a charm

    Here are the points loaded in some program I Googled:



    Thanks alot!!

  10. #10
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,816

    Default

    Registered forum members do not see this ad.

    No Probs VeryName, glad it worked for you

    Let me know if you have any more questions
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

Similar Threads

  1. Dtext issue
    By hdcompany in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 17th May 2007, 08:06 pm
  2. how to make dtext all uppercase?
    By runovryou in forum AutoCAD General
    Replies: 4
    Last Post: 10th Jan 2007, 02:54 pm
  3. Using stacked fractions with DTEXT
    By Autodesk in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 18th Nov 2006, 12:50 am
  4. fractions in dtext
    By mrsdrafter in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 19th Oct 2006, 07:23 pm
  5. dtext to mtext
    By XAVIER in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 3rd Oct 2003, 09:53 pm

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