Jump to content

Extract polyline X,Y,Z,Dwg_Layer to .csv


Sindarin

Recommended Posts

Hi guys,

 

There are a number of forum topics around the internet asking similar questions, each with good answers (e.g. Lee Mac here) but so far I haven't found an answer to my problem.

 

What I would like to do is extract information from several long polylines (each on specific layers) and create a csv text file of the output, saved to the same directory and with the same name as the .dwg file.

 

I need each row of the .csv file to contain the coordinates of one point on a polyline (X,Y,Z) but then additionally include a fourth 'label' column which would be in the format:

 

[DrawingName]_[Layer]

 

DrawingName = name of the .dwg file

Layer = layer the polyline is on

 

Example output:

X,Y,Z,Dwg1_layer1

X,Y,Z,Dwg1_layer1 ;one row for each point on polyline

X,Y,Z,Dwg1_layer1

....

X,Y,Z,Dwg1_layer2 ;this is the next polyline, on 'layer2'

X,Y,Z,Dwg1_layer2

X,Y,Z,Dwg1_layer2

etc

 

The label column is necessary as I need to combine information from many different files and the ability to identify and sort where the data came from is essential.

 

I've attempted to modify existing 'extract XYZ' code that I've found around the internet but it seems to be beyond my current lisp skills :(. Any help you guys can give would be simply amazing!

Link to comment
Share on other sites

to point you in the right direction...

the DXF group code for the layer an object is on is: 8

the system varible "dwgname" will get you the file name

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...