Coordinates format in Data Extraction

anoopXR6VK
Explorer
Explorer

Coordinates format in Data Extraction

anoopXR6VK
Explorer
Explorer

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!

0 Likes
Reply
Accepted solutions (1)
1,195 Views
11 Replies
Replies (11)

parkr4st
Advisor
Advisor

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

0 Likes

anoopip
Community Visitor
Community Visitor

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

0 Likes

parkr4st
Advisor
Advisor

parkr4st_0-1719052859548.png

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

0 Likes

anoopip
Community Visitor
Community Visitor
I am using AutoCAD 2025. Are you using 2024?
0 Likes

anoopXR6VK
Explorer
Explorer

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

0 Likes

parkr4st
Advisor
Advisor

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 

0 Likes

anoopXR6VK
Explorer
Explorer

anoopXR6VK_0-1719080450209.png

 Here you go. Hope this helps.

0 Likes

calderg1000
Mentor
Mentor

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.

anoopXR6VK
Explorer
Explorer

@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?


0 Likes

calderg1000
Mentor
Mentor
Accepted solution

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.

0 Likes

anoopXR6VK
Explorer
Explorer

Amazing! Thank you so much for this @calderg1000 

0 Likes