Polyine Data Extraction XYZ Data

Polyine Data Extraction XYZ Data

Anonymous
Not applicable
20,821 Views
24 Replies
Message 1 of 25

Polyine Data Extraction XYZ Data

Anonymous
Not applicable

I'm trying to extract object data from a drawing to excel. I have a lot of clsoed polyines and I want to export the Area as well as the Z coordiante. The "dataextraction" command will give me area, but it wont give me z coordinate, or any coordiantes for a polyine. Is there a better way to get the information I am looking for. It really should be built into the dataextraction command.

 

Thanks for any and all help.  

0 Likes
Accepted solutions (1)
20,822 Views
24 Replies
Replies (24)
Message 2 of 25

wispoxy
Advisor
Advisor

Add a field with command ATTDEF then sync with ATTSYNC.

 

wisp_at66d.png

0 Likes
Message 3 of 25

wispoxy
Advisor
Advisor

You'll need probably need a LISP Routine for your coordinate specifics then create a field. In fact you can attach LISP to a field.

0 Likes
Message 4 of 25

Patchy
Mentor
Mentor

Dataextraction doesn't get coord of polylines only lines.

0 Likes
Message 5 of 25

Kent1Cooper
Consultant
Consultant

I'm on an older version here, so I can't check, but if they're Lightweight Polylines, their Z coordinate is stored not as part of their vertex locations, but rather in their elevation [the Elevation VLA Property, or the DXF code 38 entry in entity data).  Can DATAEXTRACTION get that, even though it can't get vertex Z coordinates?

Kent Cooper, AIA
0 Likes
Message 6 of 25

wispoxy
Advisor
Advisor

Autodesk never did make coordinate extraction easy. I do it all through an AutoCAD excel plugin.

0 Likes
Message 7 of 25

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

I'm on an older version here, so I can't check, but if they're Lightweight Polylines, their Z coordinate is stored not as part of their vertex locations, but rather in their elevation ....  Can DATAEXTRACTION get that, even though it can't get vertex Z coordinates?


If Help for 2016, here for the Data Extraction Wizard, in the Select Properties area, is correct that "Properties are the same as those listed in the Properties palette," then although the image there doesn't go far enough down to see it, Elevation should be one that you can include -- it's certainly in the Properties palette in my older version here, so I imagine it must still be there in newer ones.

Kent Cooper, AIA
0 Likes
Message 8 of 25

leeminardi
Mentor
Mentor

Give the LIST command and then select the polyline.

Select the area and coordinates in the text window and copy and paste into Excel.

List1.png

 

After pasting into Excel it will look like this.

List2.png

Delete the columns you do not want.  If when you do the paste the values do not go into separate columns, you can use  Excel's Data, Text to Columns and specify space as the delimiter.

 

~Lee

 

 

 

lee.minardi
Message 9 of 25

leeminardi
Mentor
Mentor

If you are going to use VLISP to extract 3D coordinates of a LWPOLYLINE you can extract the unit vector normal of the plane containing the polyline (DXF code 210) and the distance that plane is from the WCS origin (DXF code 38).  Multipling the two together gives you the location in WCS coordinates of the origin of the plane containing the polyline.  The x direction for this plane can be found by taking the cross product of the WCS z axis (0,0,1) and the polyline plane normal.  The y axis is the normal cross the x axis (of the polyline).  Knowing the unit vectors in x and y of the plane you can calculate a point's 3D WCS cooridnates by vector addition.  Not difficult but tedious.    I think using the LIST command I mentioned is much easier unless you are going to do this alot!

 

~Lee 

lee.minardi
0 Likes
Message 10 of 25

wispoxy
Advisor
Advisor

@leeminardi That looks the same or similar to what my plug-in does, well said.

0 Likes
Message 11 of 25

Anonymous
Not applicable

I'm going to have several hundred polylines, listing a copying and pasting will take to much time. 

0 Likes
Message 12 of 25

Kent1Cooper
Consultant
Consultant

@lminardigmail wrote:

If you are going to use VLISP to extract 3D coordinates of a LWPOLYLINE .... 


But I'm not, and the OP doesn't want to, if I'm interpreting the original question correctly.  They want the "Area as well as the Z coordinate."  Partly because of that being in the singular, and partly because it's hard to imagine a reason to want all the Z coordinates of vertices without the X & Y coordinates, I took that to mean they're just looking for the Polyline's elevation, the one Z coordinate that applies to all its vertices.  Unless they write back to say I misunderstood, I'll try when I'm at my newer-version location, but maybe someone out there can answer the question at the end of Post 5 sooner -- can DATAEXTRACTION include the Elevation Property?

 

[Further EDIT:  Now I'm noticing the Subject line that includes XYZ, so I'm wondering whether they do want all XYZ vertex locations, and if so, why only the Z coordinate is mentioned in Post 1.]

Kent Cooper, AIA
0 Likes
Message 13 of 25

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> looking for the Polyline's elevation, the one Z coordinate that applies to all its vertices

That needs to make sure that all 2D-/LW-Polylines are parallel to WCS! If not the polylines vertices will have different Z-values for each XY position and will not be equal to the "Elevation" property.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 14 of 25

Anonymous
Not applicable

Kent you are correct, I only want the Z elevation and Area for the entire polyline.

No the elevation is not an option for export. Its really saddening how limited my options are. 

Example1.JPG

I need to know what the volume is at every inch for a non uniform shape. I'm going to have polylines similar to this, cut every 1" for 50'. I will use the Z elevation to tell me the order, and the area to calc the volume for that 1" slice. 

Data Extraction Looks like this. 

Example2.JPGExample3.JPG

Now there are a ton of options here and I have looked through them all. What Im looking for should be under misc. or Geometry.

Example4.JPG

Which only leaves me with this. If it exported in an order that made sense it would work but in my small sample set the order is random. which is why I need the Z Elevation Value. 

 

-Chris

0 Likes
Message 15 of 25

Anonymous
Not applicable

All my Z values will be parallel to the WCS and thus the same across the entire 2d polyine section. Each section will be at a 1" set interval too. I only need the Z value to determine the order of the area values for the polyines. 

0 Likes
Message 16 of 25

leeminardi
Mentor
Mentor

Chris,  If what you really want is the volume, and you have a series of closed polyline, why not just use LOFT to make a solid out of the sections and use MASSPROP to determine the volume?  It will be approximately as accurate as doing it by summing 1" thick slabs.

 

Also, using your method, if you know that the sections are 1" apart you do not need to know their elevation.  Just multiply the sum of the areas by 1" to get the volume.

~Lee

lee.minardi
0 Likes
Message 17 of 25

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....

No the elevation is not an option for export. Its really saddening how limited my options are. 

 

....

Then I assume you'll need something like an AutoLisp routine to get the two Properties [Area and Elevation] from the Polylines and feed them out to a file.  It shouldn't be difficult.  What format should the extracted Properties be in, in relation to each other?  That is, what should a line in such a file look like?

 

Alternatively, a routine could get those Properties and sort them into Elevation order within itself, and only feed out to an external file the Areas, already in the correct order.  Does that sound viable?

Kent Cooper, AIA
Message 18 of 25

leeminardi
Mentor
Mentor

The areas do not need to be in the correct order to determine the volume.  They would if you were computing center of mass or moment of inertia.

~Lee

lee.minardi
0 Likes
Message 19 of 25

ВeekeeCZ
Consultant
Consultant
Accepted solution

Perhaps simple lisp like this...

 

Spoiler
(vl-load-com)

(defun c:PLList ( / *error* i file en rep erea elev)

  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if file (close file))
    (princ))

  ;------------------------------------------------------------------------------------------------------
  
  (if (and (setq file (open (getfiled "Define name of exported file" (getvar 'DWGPREFIX) "csv" 1) "a"))
	   (princ "\nNeed closed polylines,")
	   (setq ss (ssget '((0 . "LWPOLYLINE") (-4 . "&") (70 . 1))))
	   (write-line "Area,Elevation" file)
	   )
    (repeat (setq i (sslength ss))
      (if (and (setq en (ssname ss (setq i (1- i))))
	       (setq area (vlax-get (vlax-ename->vla-object en) 'area))
	       (setq elev (cdr (assoc 38 (entget en)))))
	(progn
	  (setq rep (strcat (rtos area) "," (rtos elev)))
	  (terpri) (princ rep)
	  (write-line rep file)))
      ))
  (*error* "end")
)

 

 

Message 20 of 25

Anonymous
Not applicable

Thanks for the lisp, this does exactly what I need. 

 

Post 16 - Lee, I dont need the total volume, I need to be able to know the volume at every 1 inch increment. So that I can know that to fill the void another inch is going to take another X amount of material. 

 

Post 17 - Kent, Yes a lisp will work, as has been created here. 

 

Thanks for everyones help. 

 

-Chris

0 Likes