Sindarin 发表于 2022-7-6 06:25:34

Extract polyline X,Y,Z,Dwg_Lay

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 = 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!

LibertyOne 发表于 2022-7-6 07:05:22

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

Sindarin 发表于 2022-7-6 07:38:20

Thanks, I'll give it another go when I have some spare time.
页: [1]
查看完整版本: Extract polyline X,Y,Z,Dwg_Lay