+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Full Member kArThIcK hAcKeR's Avatar
    Computer Details
    kArThIcK hAcKeR's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    HP Compaq LE1911
    CPU:
    Intel Xeon
    RAM:
    8 GB
    Graphics:
    nvidia
    Discipline
    Mechanical
    kArThIcK hAcKeR's Discipline Details
    Occupation
    Design Engineer
    Discipline
    Mechanical
    Details
    Design Engineer In L&T Ship-building
    Using
    AutoCAD 2014
    Join Date
    Jul 2013
    Location
    Chennai, India
    Posts
    49

    Question Extract Text data at a XYZ coordinate from Autocad

    Registered forum members do not see this ad.

    Hi guys,

    Attachment: Test Drawing.dwg

    I want to retrive the text's content, the text is placed at a certain XYZ co-ordinate in Autocad, (same coordinates, always for all the drawings).

    [Refering to the attachment]: The text below the "Surface Area" and the "Weight", are mostly the texts i'm trying to get.

    These texts sometimes come as a single line text or as a mtext or within blocks..
    but always they appear at the same coodinates.

    Can somebody help me with this?
    Don't Hesitate !!!

  2. #2
    Super Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2014
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    1,213

    Default

    I think this text should be part of title block and reside in it as attribute values... So I strongly suggest that you keep title blocks as they are - do not explode them (burst)... In this way you will be able to easily get attribute values based on their tag names... The drawing you posted is inadequate for your specific request - it even doesn't matter if the position of text is the same - your drawings that have title block can be placed independently of UCS origin, but if they are prepared for batch plot or publish I also suggest that they don't change position... So please revise all your DWGs so that they have title block with which you can easily manipulate extract data or change values of texts/fields...

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  3. #3
    Full Member kArThIcK hAcKeR's Avatar
    Computer Details
    kArThIcK hAcKeR's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    HP Compaq LE1911
    CPU:
    Intel Xeon
    RAM:
    8 GB
    Graphics:
    nvidia
    Discipline
    Mechanical
    kArThIcK hAcKeR's Discipline Details
    Occupation
    Design Engineer
    Discipline
    Mechanical
    Details
    Design Engineer In L&T Ship-building
    Using
    AutoCAD 2014
    Join Date
    Jul 2013
    Location
    Chennai, India
    Posts
    49

    Default

    Thanks for the reply marko,
    the drawings are being created by a piping software which mass publishes the drawings,
    and it doesn't create the values as block attributes...
    also the drawing which was attached before was a representation drawing, I'm sorry but I couldn't give you the drawing since its confidential drawing of my office...
    is there a way to get the text value from the drawing at the co-ordinates

    PS:
    My idea was for retriving the data; was to convert the drawings to dxf, use a text finding program to find the text beneatht the dxf codes using regex.
    (AcDbText
    10
    205.6000061
    20
    11.89999962
    30
    0
    40
    2
    1
    0.787719
    7
    )
    Don't Hesitate !!!

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

    Default

    Try this not tested

    (setq ss (SSGET "C" '(2 2) '(0 0) ))
    (if (/= ss nil)(princ "Object found")(exit)) ; note exits if nothing found
    (if (> (sslength ss) 1 )(exit)) ; to many objects
    (setq obj (vlax-ename->vla-object (ssname ss 0)))
    (setq isname (vla-get-Objectname obj))
    (if (= isname "AcDbText")(alert "Text String found " (vla-get-textstring obj)))
    (if (= isname "AcDbMText")(alert "MText String found " (vla-get-textstring obj)))
    A man who never made mistakes never made anything

  5. #5
    Full Member kArThIcK hAcKeR's Avatar
    Computer Details
    kArThIcK hAcKeR's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    HP Compaq LE1911
    CPU:
    Intel Xeon
    RAM:
    8 GB
    Graphics:
    nvidia
    Discipline
    Mechanical
    kArThIcK hAcKeR's Discipline Details
    Occupation
    Design Engineer
    Discipline
    Mechanical
    Details
    Design Engineer In L&T Ship-building
    Using
    AutoCAD 2014
    Join Date
    Jul 2013
    Location
    Chennai, India
    Posts
    49

    Default

    Thanks for the code BIGAL.

    I tried to alter the code from there, but AutoCAD says "Object found; error: too many arguments"...
    [SPOILER]
    Code:
    (defun c:test5 ()
      (setq
        point1 '(496.344 -32.5268 0.0)
        point2 '(514.247 -41.9455 0.0)
      )
      (setq ss (ssget "C" point1 point2))
      (if (/= ss nil)(princ "Object found")(exit)) ; note exits if nothing found
    (if (> (sslength ss) 1 )(exit)) ; to many objects
    (setq obj (vlax-ename->vla-object (ssname ss 0)))
    (setq isname (vla-get-Objectname obj))
    (if (= isname "AcDbText")(alert "Text String found " (vla-get-textstring obj)))
    (if (= isname "AcDbMText")(alert "MText String found " (vla-get-textstring obj)))
    )
    [/SPOILER]
    Don't Hesitate !!!

  6. #6
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,049

    Default

    Something like this?

    Code:
    (defun c:Test  (/ ss i lst)
      ;; Tharwat - 12.Jul.2016 ;;
      (if (setq ss (ssget "_C"
                          '(496.344 -32.5268 0.0)
                          '(514.247 -41.9455 0.0)
                          '((0 . "*TEXT"))))
        (progn
          (repeat (setq i (sslength ss))
            (setq lst
                   (cons
                     (cdr (assoc 1 (entget (ssname ss (setq i (1- i))))))
                     lst))
            )
          (if (and lst (< (length lst) 11))
            (alert
              (strcat "Text string(s) :\n"
                      (apply 'strcat
                             (mapcar '(lambda (o) (strcat o "\n"))
                                     (reverse lst)))))
            (progn
              (princ "\nText string(s) :\n")
              (mapcar '(lambda (o) (princ (strcat o "\n")))
                      (reverse lst))
              (textscr)
              )
            )
          )
        (princ "\nNo text(s) found !")
        )
      (princ)
      )

  7. #7
    Full Member kArThIcK hAcKeR's Avatar
    Computer Details
    kArThIcK hAcKeR's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    HP Compaq LE1911
    CPU:
    Intel Xeon
    RAM:
    8 GB
    Graphics:
    nvidia
    Discipline
    Mechanical
    kArThIcK hAcKeR's Discipline Details
    Occupation
    Design Engineer
    Discipline
    Mechanical
    Details
    Design Engineer In L&T Ship-building
    Using
    AutoCAD 2014
    Join Date
    Jul 2013
    Location
    Chennai, India
    Posts
    49

    Default

    Ah,
    just the one I was looking for...

    Thank tharwat,
    I'll include your code in my loop though files code..(so that the data can be retrived for all the files inside a folder)
    Don't Hesitate !!!

  8. #8
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,049

    Default

    Registered forum members do not see this ad.

    Nice, you are welcome.

Similar Threads

  1. extract all coordinate and dimension from autocad drawing
    By raj patel in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 10th Oct 2015, 03:06 pm
  2. Text and text coordinate extract to csv along polyline.
    By sanju2323 in forum AutoLISP, Visual LISP & DCL
    Replies: 24
    Last Post: 30th Jun 2015, 04:12 am
  3. extract and copy attribute and move to X,Y coordinate
    By GISdude in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 26th Apr 2013, 05:18 am
  4. Extract coordinate data from AutoCAD
    By ahmerjaved in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 23rd Jan 2013, 05:27 pm
  5. extract vertices coordinate
    By idhoe in forum AutoCAD 3D Modelling & Rendering
    Replies: 4
    Last Post: 20th Nov 2009, 03:02 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