Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

importing AutoCAD DXF or DWG

551 views
Skip to first unread message

Dig-IT

unread,
Oct 12, 2004, 3:13:30 PM10/12/04
to
Hi all,

Does anyone know how to import (plot) AutoCad DXF or DWG files in Matlab?

At the moment I'm using a workaround: converting the DXF using the
external program dxf2xyz 2.0 to an ASCII file with x,y,z values
(manually, that is).

The quality of the plots this produces is not too great (there are some
conversion errors). Also, since I'd like to be able to import DXF files
from a GUI, the external workaround is not good enough.

Does anybody know of a way to import DXF of DWG into Matlab?

Thank you,

Jos

Carlos Lopez

unread,
Oct 14, 2004, 11:49:42 AM10/14/04
to
Let me know where to send you some (partial) solution.

Miltiades Salvanos

unread,
Oct 15, 2004, 10:33:22 AM10/15/04
to
>>
>> Thank you,
>>
>> Jos
> Let me know where to send you some (partial) solution.

Have you actually managed to parse the AutoCad DWG or DFX format and
import it into Matlab?
Well, that's most impressive! I would be very interested in it also..
do you parse lines,curves etc. or just points?
it you actually import all entities then many many kudos to you!!
why don't you just post a snippet here or put it in file exchange so
we can all enjoy?
thanks
Miltiades

Dig-IT

unread,
Oct 18, 2004, 5:26:48 PM10/18/04
to
Just use this e-mail address (without everything between %%) or the
e-mail address I directly e-mailed you from.

Thank you!

Jos

J Luis

unread,
Oct 18, 2004, 7:43:58 PM10/18/04
to
Dig-IT wrote:
>
>
> Just use this e-mail address (without everything between %%) or the
>
> e-mail address I directly e-mailed you from.
>
> Thank you!
>
> Jos
>
Hi Jos,
I tried to send you an email asking for a copy of your dxf reading
functions but it was refused saying "Domain not found".
Can I have a copy of it as well?

Thanks
J. Luis

SeBy

unread,
Oct 19, 2004, 2:15:57 AM10/19/04
to

It would ba fantastic if this code could be send to Matlab Central.

Sébastien

Cecilia

unread,
Oct 27, 2004, 12:34:35 AM10/27/04
to
Hello....
Can anybody send me a copy of this code?
I need to do this and also manipulate the file from matlab, and im
learning matlab at the moment...

Manoj Ranjan

unread,
Dec 20, 2004, 10:13:48 AM12/20/04
to
Dear Miltiades Salvanos,

Please do also help me read the Dxf format.

Regards
Manoj

Carlos Lopez

unread,
Dec 21, 2004, 5:02:01 PM12/21/04
to
I have not sent the code to matlab central because it is not good
enough according to my standards. It deals only with isolated points,
LINE, POLYLINE and ARC (using the DXF notation). We did not attempt
to parse ELLIPSE, SPLINE, etc. but I guess it could be done. If you
read in the web about DXF you will soon find that many people blame
AutoDESK for the poor design and implementation of DXF. So, making
reliable code to read it into matlab is pervaded by the same virus:
you might read without problems DXF for ACAD R12, but not DXF for
ACAD R14 neither ACAD 2000.
I will be happy to share the present code with anyone which wants to
have it.
It will be a good idea to consider the new DWF format; unlike DWG and
DXF, AutoDESK provides source code in C to read and write it, so
(hopefully) anyone more or less proficient with C could serve the
matlab community creating a mex file once for all.
Regards
Carlos
PD: Hope that my e-mail will not be too difficult to decipher!

Estebal

unread,
Jan 10, 2005, 11:16:03 AM1/10/05
to
Hi,
I'm also very interested in having a look at this code. I understand
your concern ACAD and also the new opportunity we may have with DWF
source codes.
Anyway, thanks in advance

Estebal

Nash Dima

unread,
Jun 30, 2011, 12:03:08 PM6/30/11
to
Hi all,
Is there a way to import a 2d drawing to matlab then? I ve seen quite some discussion but not sure what I need to do. Any advice is welcome
Thanks

Camilo Diaz

unread,
Apr 5, 2012, 10:52:12 AM4/5/12
to
Hi Carlos!!! I'm also interested in the code that imports DXF files into MATLAB!!!it would be great if you could send it to me!!

Thx

Camilo Diaz


-------------------------------------------------------------------------------------------------------
"Carlos Lopez" <clv...@removeThisadinet.com.uy> wrote in message <eeec...@webx.raydaftYaTP>...

Hamid

unread,
Aug 11, 2012, 12:15:07 AM8/11/12
to
Hi Carlos,
May I have a look at that piece of code you had written. I'd also be grateful to let me know of any helpful material regarding .dwg extension that you wrote your code based on that.
Best Regards,
Hamid.

"Carlos Lopez" <clv...@removeThisadinet.com.uy> wrote in message <eeec...@webx.raydaftYaTP>...

M Dinary

unread,
Feb 20, 2013, 5:56:05 PM2/20/13
to
i need to convert only lines and points ...... it will be great if we share this code ??

"Carlos Lopez" <clv...@removeThisadinet.com.uy> wrote in message <eeec...@webx.raydaftYaTP>...

Dotan Algranati

unread,
Mar 8, 2013, 1:47:07 AM3/8/13
to
Dear Carlos,

I would be also very glad to receive your code in spite of the described drawbacks.

Thank you in advance

Dotan Algranati


"M Dinary" <dina...@yahoo.com> wrote in message <kg3ka5$mh3$1...@newscl01ah.mathworks.com>...

shabnam....@googlemail.com

unread,
Mar 18, 2014, 11:50:17 AM3/18/14
to
hi
I need to import dxf or dwg files into MATLAB for my project that I`m working on it right now
will you do me a favor and give me a clue about this
I will appreciate it if you can help me
this is my email address: shabnam...@gmail.com

thx indeed

aousoo sos

unread,
May 25, 2014, 6:51:07 PM5/25/14
to
hi
plz i need help
i want to make a program to read and convert a dxf file to drewing
i open the dxf using notepad and this is it
0
SECTION
2
HEADER
9
$EXTMIN
10
-11.323534
20
-74.502388
9
$EXTMAX
10
110.005024
20
22.126945
0
ENDSEC
0
SECTION
2
TABLES
0
TABLE
2
LTYPE
70
1
0
LTYPE
2
CONTINUOUS
70
64
3
Solid Line
72
65
73
0
40
0.0
0
ENDTAB
0
TABLE
2
LAYER
70
1
0
LAYER
2
1_0
70
0
62
7
6
CONTINUOUS
0
ENDTAB
0
ENDSEC
0
SECTION
2
BLOCKS
0
ENDSEC
0
SECTION
2
ENTITIES
0
LINE
8
1_0
62
1
10
25.649749
20
10.144055
30
0.000000
11
3.627349
21
10.144055
31
0.000000
0
LINE
8
1_0
62
1
10
1.767940
20
8.284646
30
0.000000
11
1.767940
21
-60.674201
31
0.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
50.800000
50
318.046247
51
401.953753
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
39.720081
20
-10.796846
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
57.500081
20
-10.796846
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
66.390081
20
-26.194778
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
57.500081
20
-41.592709
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
39.720081
20
-41.592709
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
30.830081
20
-26.194778
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
66.390081
20
-26.194778
30
0.000000
40
5.080000
50
293.132396
51
426.867604
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
57.500081
20
-41.592709
30
0.000000
40
5.080000
50
0.000000
51
6.867604
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
39.720081
20
-41.592709
30
0.000000
40
5.080000
50
7.383198
51
112.616802
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
30.830081
20
-26.194778
30
0.000000
40
5.080000
50
113.132396
51
246.867604
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
39.720081
20
-10.796846
30
0.000000
40
5.080000
50
247.383198
51
352.616802
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
20.320000
50
313.291177
51
346.708823
210
0.000000
220
0.000000
230
1.000000
0
LINE
8
1_0
62
1
10
29.167025
20
7.681232
30
0.000000
11
35.113260
21
-8.655912
31
0.000000
0
LINE
8
1_0
62
1
10
33.940664
20
9.418694
30
0.000000
11
39.452124
21
-5.723918
31
0.000000
0
LINE
8
1_0
62
1
10
53.009490
20
10.144055
30
0.000000
11
80.715185
21
10.144055
31
0.000000
0
ARC
8
1_0
62
1
10
66.390081
20
-26.194778
30
0.000000
40
5.080000
50
127.383198
51
232.616802
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
57.500081
20
-10.796846
30
0.000000
40
5.080000
50
353.132396
51
486.867604
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
15.240000
50
75.358886
51
104.641114
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
39.720081
20
-10.796846
30
0.000000
40
5.080000
50
155.074239
51
186.867604
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
15.240000
50
135.358886
51
164.641114
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
20.320000
50
277.180756
51
286.708823
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
57.500081
20
-41.592709
30
0.000000
40
5.080000
50
233.132396
51
360.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
20.320000
50
73.291177
51
82.819244
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
20.320000
50
133.291177
51
166.708823
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
20.320000
50
193.291177
51
226.708823
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
30.830081
20
-26.194778
30
0.000000
40
5.080000
50
0.000000
51
52.616802
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
15.240000
50
15.358886
51
44.641114
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
39.720081
20
-41.592709
30
0.000000
40
5.080000
50
173.132396
51
306.867604
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
30.830081
20
-26.194778
30
0.000000
40
5.080000
50
307.383198
51
360.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
57.500081
20
-41.592709
30
0.000000
40
5.080000
50
67.383198
51
172.616802
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
15.240000
50
315.358886
51
344.641114
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
20.320000
50
13.291177
51
46.708823
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
57.500081
20
-10.796846
30
0.000000
40
5.080000
50
187.383198
51
292.616802
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
15.240000
50
195.358886
51
224.641114
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
39.720081
20
-10.796846
30
0.000000
40
5.080000
50
53.132396
51
93.023610
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
20.320000
50
253.291177
51
262.819244
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
20.320000
50
97.180756
51
106.708823
210
0.000000
220
0.000000
230
1.000000
0
LINE
8
1_0
62
1
10
51.150081
20
-6.034153
30
0.000000
11
51.150081
21
8.284646
31
0.000000
0
LINE
8
1_0
62
1
10
46.070081
20
-46.355403
30
0.000000
11
46.070081
21
-60.674201
31
0.000000
0
LINE
8
1_0
62
1
10
51.150081
20
-46.355403
30
0.000000
11
51.150081
21
-60.674201
31
0.000000
0
LINE
8
1_0
62
1
10
34.448567
20
15.224055
30
0.000000
11
44.210672
21
15.224055
31
0.000000
0
LINE
8
1_0
62
1
10
25.649749
20
15.224055
30
0.000000
11
3.627349
21
15.224055
31
0.000000
0
LINE
8
1_0
62
1
10
-3.312060
20
8.284646
30
0.000000
11
-3.312060
21
-60.674201
31
0.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
55.880000
50
317.808890
51
402.191110
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
85.114594
20
-65.073610
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
-0.772060
20
-65.073610
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
-0.772060
20
12.684055
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
85.114594
20
12.684055
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
LINE
8
1_0
62
1
10
44.210672
20
-67.613610
30
0.000000
11
3.627349
21
-67.613610
31
0.000000
0
LINE
8
1_0
62
1
10
53.009490
20
-67.613610
30
0.000000
11
80.715185
21
-67.613610
31
0.000000
0
LINE
8
1_0
62
1
10
44.210672
20
10.144055
30
0.000000
11
34.448567
21
10.144055
31
0.000000
0
LINE
8
1_0
62
1
10
53.009490
20
15.224055
30
0.000000
11
80.715185
21
15.224055
31
0.000000
0
CIRCLE
8
1_0
62
1
10
48.610081
20
-65.073610
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
48.610081
20
12.684055
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
CIRCLE
8
1_0
62
1
10
30.049158
20
12.684055
30
0.000000
40
2.540000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
-0.772060
20
12.684055
30
0.000000
40
5.080000
50
300.000000
51
330.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
12.684055
30
0.000000
40
5.080000
50
300.000000
51
330.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
-0.772060
20
-65.073610
30
0.000000
40
5.080000
50
120.000000
51
330.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
85.114594
20
12.684055
30
0.000000
40
5.080000
50
344.594329
51
510.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
85.114594
20
12.684055
30
0.000000
40
5.080000
50
210.000000
51
284.531902
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
12.684055
30
0.000000
40
5.080000
50
30.000000
51
150.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
-0.772060
20
12.684055
30
0.000000
40
5.080000
50
30.000000
51
240.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
30.049158
20
12.684055
30
0.000000
40
5.080000
50
30.000000
51
150.000001
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
-0.772060
20
-65.073610
30
0.000000
40
5.080000
50
30.000000
51
60.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-65.073610
30
0.000000
40
5.080000
50
210.000000
51
330.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
85.114594
20
-65.073610
30
0.000000
40
5.080000
50
210.000000
51
330.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
85.114594
20
-65.073610
30
0.000000
40
5.080000
50
0.000000
51
15.405671
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-65.073610
30
0.000000
40
5.080000
50
30.000000
51
60.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-65.073610
30
0.000000
40
5.080000
50
120.000000
51
150.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
85.114594
20
-65.073610
30
0.000000
40
5.080000
50
330.000000
51
360.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
85.114594
20
-65.073610
30
0.000000
40
5.080000
50
75.468098
51
150.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
12.684055
30
0.000000
40
5.080000
50
210.000000
51
240.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
30.049158
20
12.684055
30
0.000000
40
5.080000
50
320.000000
51
330.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
30.049158
20
12.684055
30
0.000000
40
5.080000
50
210.000000
51
260.000000
210
0.000000
220
0.000000
230
1.000000
0
LINE
8
1_0
62
1
10
53.009490
20
-62.533610
30
0.000000
11
66.862338
21
-62.533610
31
0.000000
0
LINE
8
1_0
62
1
10
66.862338
20
-62.533610
30
0.000000
11
80.715185
21
-62.533610
31
0.000000
0
LINE
8
1_0
62
1
10
3.627349
20
-62.533610
30
0.000000
11
23.919011
21
-62.533610
31
0.000000
0
LINE
8
1_0
62
1
10
23.919011
20
-62.533610
30
0.000000
11
44.210672
21
-62.533610
31
0.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
15.240000
50
255.358886
51
270.000000
210
0.000000
220
0.000000
230
1.000000
0
ARC
8
1_0
62
1
10
48.610081
20
-26.194778
30
0.000000
40
15.240000
50
270.000000
51
284.641114
210
0.000000
220
0.000000
230
1.000000
0
LINE
8
1_0
62
1
10
46.070081
20
8.284646
30
0.000000
11
46.070081
21
1.125247
31
0.000000
0
LINE
8
1_0
62
1
10
46.070081
20
1.125247
30
0.000000
11
46.070081
21
-6.034153
31
0.000000
0
ENDSEC
0
EOF
so ...anyone knew what i should to do

Nurhafizah Ahmad

unread,
Feb 19, 2017, 8:33:08 PM2/19/17
to
"Carlos Lopez" <clv...@adinet.com.uy> wrote in message <eeec...@webx.raydaftYaTP>...
Hello, can you send to my email? nurhafizah...@yahoo.com
0 new messages