File Exchange

image thumbnail

dxf2coord 2.0

version 1.0 (5.48 KB) by

reads the coordinates and layernames of some entities of a acad r2000 - r2007 ascii .dxf file

3 Ratings



View License

the primary target of this script was to make a simple dxf import for matlab for the most important autocadcad entities. the script reads the coordinates and layernames of entities of a acad r2000 - r2007 ascii .dxf file and saves the results as workspace variables. it works on points, lines, circles, lwpolylines (with and without elevation), 3d polylines and 3dfaces. other entities are ignored. if an recognizable entity does not exist in the .dxf file, the corresponding output variable will not be created.

CAUTION: for all the people who had problems with prior versions of dxf2coord try this one (with no guarantee that it will work). sorry for ignoring your emails! i just posted this one because i have it unused on my pc (at the moment scilab is my choice)

this code is freeware. i will NOT guarantee for the functionality of this script, nor will i be responsible in any kind for any damage because of the use of this script or the use of results calculated by this script. it's usage is all on your own risk. there is ABSOLUTELY NO WARRANTY, not even for MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. if you don't accept these terms don't use this script. !!!!!!! CHECK THE RESULTS FOR PLAUSIBILITY !!!!!!!

Comments and Ratings (4)


Gordon (view profile)

When used for importing 3D polylines your code returns duplicate entries of 3Dpoly vertexes (as result of multiplying 'threedvertices' matrix rows and columns in row 337). When this row is changed so that only columns are multiplied results for 3Dpoly are single vertexes. I suggest changing row 337 of your code to: >threedvertices=repmat(threedvertices,1,2);<


Hamid (view profile)

Hi there,
I have a sample dxf file that includes a Box, a Cylinder, a Pyramid, a Sphere, a Torus, a Cone, and a Widget. I have loaded that ASCII file in MATLAB based on your code and looked at the ENTITY part of the dxf reference about 3dSolids to find out how to extract some details of objects. I couldn't find any group codes indicating the coordination of those objects. Could anybody please tell me in which part of the loaded dxf file should I find those details?


Mohammad Aref

Hi there,
Thanks for the script. There are some comments about it. In line 279, circles(:,1)=1:length(circles);
while using length function, answer will be wrong if dxf file has less than 5 circles. We have changed that line into circles(:,1)=1:size(circles,1);
so it works correctly for all numbers of circles.
One more thing, we added case('AC1012') version=('Acad R 12');
in line 109 to include Acad 12 files but we don't know about existence of any difference between DXF in Acad14 and Acad12.

Adam Chapman

MATLAB Release
MATLAB 7.5 (R2007b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video