Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Coordinates format in Data Extraction

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
anoopXR6VK
645 Views, 11 Replies

Coordinates format in Data Extraction

Hi,

I am extracting the coordinates of a text layer through Data Extraction. I don't understand why the coordinate format in the extract don't match with what I see on screen.

This is what I see on screen:

anoopXR6VK_0-1719049484541.png

This is the corresponding extracted value:

anoopXR6VK_1-1719049558090.png

Any pointers on how I can get the extract in the same format visible on screen?

Thanks in advance!

11 REPLIES 11
Message 2 of 12
parkr4st
in reply to: anoopXR6VK

post the dwg and explain what the data is relevant to, coordinate system, metric or imperial.  any of that may help get a solution.

Message 3 of 12
anoopip
in reply to: anoopXR6VK

Thanks for the response!

I have attached a sample of the dwg file.

The relevant layer is PVCase Stringing Numbers. I am looking to extract the geometric positions of these text fields. These represnt the electrical strings for a PV plant.

anoopip_0-1719051692467.png

I have to dig deeper into what these coordinates represent. But a great first step would be to get the same output when I extract the data into an excel file (attached).

I hope this clear enough

Message 4 of 12
parkr4st
in reply to: anoopip

parkr4st_0-1719052859548.png

What is the application you are using?  I am unable to do anything with your file

Message 5 of 12
anoopip
in reply to: parkr4st

I am using AutoCAD 2025. Are you using 2024?
Message 6 of 12
anoopXR6VK
in reply to: anoopXR6VK

Please click on continue opening DWG file..It should work normally, let me know if you are still facing issues

Message 7 of 12
parkr4st
in reply to: anoopXR6VK

2020

 

go back to post 3 image.  recapture the full screen to include everything  on the screen and post that.

 

That should show the software title & coordinate information 

Message 8 of 12
anoopXR6VK
in reply to: anoopXR6VK

anoopXR6VK_0-1719080450209.png

 Here you go. Hope this helps.

Message 9 of 12
calderg1000
in reply to: anoopXR6VK

Regards @anoopXR6VK 

You are working with a relative coordinate system, it is rotated and with its origin at the point that I show in the image
That is why with ID, it shows you a value corresponding to the current system. But with DE, it shows you the value of its location in the Universal system.
Apply UCS->W->ENTER, Then PLANT->CURRENT UCS and you will be in the Universal system. Then by applying DE, you will already have coordinate matches.
But my question is which of the 2 coordinate values ​​do you require. The universal or the relative...?

 

calderg1000_0-1719111151002.png

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Message 10 of 12
anoopXR6VK
in reply to: anoopXR6VK

@calderg1000 Thanks Carlos! This is very insightful.

Ideally I  want the relative system in the DE as it is more intutive. Is there a way we can get the relative coordinates in the DE?


Message 11 of 12
calderg1000
in reply to: anoopXR6VK

Regards @anoopXR6VK 

With DE, I don't think it's possible directly. Since it always obtains the coordinates in the Universal system. Maybe moving your entire drawing to (0,0) and rotating it to coincide with the Y axis can achieve what you require.

Try this code to obtain the coordinate table of the insertion points of the texts in the current coordinate system, verified in the file you attached...

(Defun c:Coord_tx (/ LData ss i e tx ccoord X_ Y_ eData Obj_Table Tname crow)
  (vl-load-com)
  (if
    (setq LData nil
          ss    (ssget '((0 . "MTEXT")))
    )
     (progn
       (repeat (setq i (sslength ss))
         (setq e  (vlax-ename->vla-object (ssname ss (setq i (1- i))))
               tx (vlax-get e 'textstring)
         )
         (if (= (atoi (substr tx 2 1)) 3)
           (progn
             (setq ccoord (trans (vlax-get e 'InsertionPoint) 0 1)
                   X_     (car ccoord)
                   Y_     (cadr ccoord)
                   eData  (list tx X_ Y_)
                   LData  (cons eData LData)
             )
           )
         )
       )                                          ;repeat
       (setq LData (vl-sort LData '(lambda (m n) (< (Car m) (car n)))))
       (setq Obj_Table
              (vlax-invoke
                (vlax-get (vla-get-ActiveLayout
                            (vla-get-activedocument (vlax-get-acad-object))
                          )
                          'Block
                )
                'Addtable
                (trans (getpoint "\nPick point for Table:") 1 0)
                2
                3
                25
                150
              )
       )
       (setq Tname "COORDINATE TABLE")
       (vla-settext Obj_Table 0 0 Tname)
       (vla-setcelltextheight Obj_Table 0 0 8.0)
       (mapcar '(lambda (y)
                  (vla-settext Obj_Table 1 (car y) (cadr y))
                  (vla-setcelltextheight Obj_Table 1 (car y) 8.0)
                )
               (list '(0 "Contents") '(1 "Position X") '(2 "Position Y"))
       )
       (foreach j LData
         (vla-insertrows
           Obj_Table
           (1+ (setq crow (vla-get-rows Obj_Table)))
           15
           1
         )
         (vla-setcelltextheight Obj_Table crow 0 8.0)
         (vla-setCellAlignment Obj_Table crow 0 5)
         (vla-setCellValue Obj_Table crow 0 (car j))
         (vla-setCellValue Obj_Table crow 1 (cadr j))
         (vla-setCellValue Obj_Table crow 2 (caddr j))
         (vla-setcelltextheight Obj_Table crow 1 8.0)
         (vla-setcelltextheight Obj_Table crow 2 8.0)
         (vla-setCellAlignment Obj_Table crow 1 5)
         (vla-setCellAlignment Obj_Table crow 2 5)
         (vla-setcellformat Obj_Table crow 1 "%lu2%pr3%ps[, m]")
         (vla-setcellformat Obj_Table crow 2 "%lu2%pr3%ps[, m]")
       )
       (vla-setColumnWidth Obj_Table 1 100)
       (vla-setColumnWidth Obj_Table 2 100)
     )
  )
  (princ)
)

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Message 12 of 12
anoopXR6VK
in reply to: anoopXR6VK

Amazing! Thank you so much for this @calderg1000 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


AutoCAD Beta