Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

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

Data Extraction in UCS X,Y,Z

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
3090 Views, 4 Replies

Data Extraction in UCS X,Y,Z

Hi there,

I have a .dwg file with circle objects I created. When I extract the Center X,Y,Z (using dataextraction wizard) they reset back to the WCS (World Coordinate Sytem), when in fact I want their relative positions to a UCS origin (user Coordinate System) that I have defined on the drawing.

Any help with this would be much appreciated! Thanks!

(P.s.: First-time user of AUTOCAD)

4 REPLIES 4
Message 2 of 5
cadffm
in reply to: Anonymous

Impossible,
dataextract extract the saved object datas and object datas are ever stored in wcs coordinates.

If you have a simple ucs (not rotated) you can do this easily in excel, but there isn't an option in this command.
If you need this not so often, move/rotate your objects and extract then.

Sebastian

Message 3 of 5
Patchy
in reply to: Anonymous

If you have a lot points, upload your drawing, let's give it a test.

Message 4 of 5
leeminardi
in reply to: Anonymous

Hereā€™s a clumsy but valid method to convert WCS coordinates to the coordinates of a named ucs by using only AutoCAD commands and Excel.  It was fun using Excel to manipulate the data. No vlisp required.

 

In addition to the list of points in WCS coordinates you will need the matrix of the UCS. To get the UCS matrix do the following (note, Iā€™m sure there is an easier method with VLISP):

Make the desired UCS current.

Name the current ucs with:

    UCS  NA S (Iā€™ve given it the name ucs1 in my example).

Make the WCS current with

   UCS [Enter] [Enter]                                

Get the matrix of ucs1:

   UCS NA ? ucs1

 ucs-1.JPG

The matrix has 4 rows and 3 columns. Enter these values into Excel via copy and paste with the x axis as the FIRST row and the origin as the FOURTH row.  

ucs-3.JPG

 

The UCS matrix is used to convert UCS coordinates To WCS coordinates.  We want to do the opposite so we need to invert the UCS matrix. To invert a matrix it must have the same number of rows and columns.  Iā€™ve added a fourth column to the matrix (0 0 0 1) to make it a square matrix (cells B2:E5).  Cells F2:I5 use the Excel MINVERSE function to invert the matrix.

Finally, all we need to do to convert extracted x,y,z WCS coordinates to UCS coordinates is to multiply the WCS coordinates and the inverted UCS matrix.  Note that a 1 is included as a fourth coordinate for the WCS point. This is required because the UCS matrix has 4 rows.

 

Donā€™t worry if you do not follow all of the math outlined above.  All you need to do is to list the WCS coordinates in cells B9, C9, and D9 down.  Fill down cells F9:H9 as far down as needed for the number of points you have.  Since these cells make use of an Excel array functions you must select all three cells when doing the fill-down.

In my example I had a point at x=1, y=2, z=3 in UCS coordinates (10.5946, 4.3371, 6.2618 WCS coordinates). You can see that the conversion from WCS is not exact.  This is due to the 4 decimal place rounding I used for the point and the matrix.  For better results, set the precision higher with LUPREC.

 

This process could be done with a VLISP program that makes use of functions to do the conversions but I thought it an interesting challenge to do it with Excel alone. 

 

 

 

 

 

lee.minardi
Message 5 of 5
Anonymous
in reply to: leeminardi

Thank you Lee Minardi, that was indeed a novel way to go about it šŸ™‚

 

For others looking for a simpler route, Alfred has suggested another solution to copy the rotated base with UCS to a new drawing centered at WCS here:

https://forums.autodesk.com/t5/autocad-forum/data-extraction-in-ucs-x-y-z/m-p/8265320#M948823

 

Thanks again everyone for your help.

Kind Regards

Ian

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report