Greetings,
I work with topographical cad files which normally contain well behaved polyline entities (2d, 2d with elevation and 3d linework). Most of the tools I have deal with these various entities. However, I often run across older cad files that contain polymesh entities. These rascals have been almost impossible to deal with. Upto this point, I have been redigitizing the linework using a 2d with elevation line. Very time consuming and not exact.
After messing around with these entities trying different approaches, I found that if I expost these entities to a DXF file, all the vertex data is found in a well behaved manner.
What I plan on doing is to export the offending entities to a DXF (nothing else included) then parse the file and creating a data line containing the data set for each vertex then placing each data line in a text file. I will ignore anything else in the dxf file.
In the dxf file, the data of interest consists of 22 lines and a sample is as follows
VERTEX
5
75
330
74
100
AcDbEntity
8
MINOR
100
AcDbVertex
100
AcDbPolyFaceMeshVertex
10
1262334.232859563
20
687059.6123241198
30
0.0
70
192
0
I want this to be paced in a text file like so
VERTEX,5,75,330,74,100,AcDbEntity,8,MINOR,100,AcDbVertex,100,AcDbPolyFaceMeshVertex,10,1262334.23285956,20,687059.612324119,30,0,70,192,0
From here, I can manipulate this as I like either using a spreadsheet or other tools available.
I have been playing with code to do this and have been wildly unsuccessfull.
Please be kind. My programming skills are rudimentary although I aspire to better....
Any thought, comments and or corrections are appreciated.
Brian
I work with topographical cad files which normally contain well behaved polyline entities (2d, 2d with elevation and 3d linework). Most of the tools I have deal with these various entities. However, I often run across older cad files that contain polymesh entities. These rascals have been almost impossible to deal with. Upto this point, I have been redigitizing the linework using a 2d with elevation line. Very time consuming and not exact.
After messing around with these entities trying different approaches, I found that if I expost these entities to a DXF file, all the vertex data is found in a well behaved manner.
What I plan on doing is to export the offending entities to a DXF (nothing else included) then parse the file and creating a data line containing the data set for each vertex then placing each data line in a text file. I will ignore anything else in the dxf file.
In the dxf file, the data of interest consists of 22 lines and a sample is as follows
VERTEX
5
75
330
74
100
AcDbEntity
8
MINOR
100
AcDbVertex
100
AcDbPolyFaceMeshVertex
10
1262334.232859563
20
687059.6123241198
30
0.0
70
192
0
I want this to be paced in a text file like so
VERTEX,5,75,330,74,100,AcDbEntity,8,MINOR,100,AcDbVertex,100,AcDbPolyFaceMeshVertex,10,1262334.23285956,20,687059.612324119,30,0,70,192,0
From here, I can manipulate this as I like either using a spreadsheet or other tools available.
I have been playing with code to do this and have been wildly unsuccessfull.
Code:
set fi [open data_files\\strings_dtms\\topos\\1998\\polymesh.dxf "r"]
set fo [open tempwrite.str "w"]
set a "VERTEX"
while {[gets $fi line] >= 0} {if {$a == $line} { {set var 0} {for {set i 1} {$i<=22} {incr $i} {{append $var "," $fi}{gets $fi line}}}{puts $fo $var}} else {gets $fi
line}}
close $fi
close $fo
Please be kind. My programming skills are rudimentary although I aspire to better....
Any thought, comments and or corrections are appreciated.
Brian