JDelgado
JDelgado

Reputation: 99

How do I write a DXF code for a POLYLINE?

I´m trying to create a program based on C++ that calculates a function values on a given range and then the program proceeds to create a DXF file in order for it to be Graphed.

The issue that I´m having it´s with the DXF part this is the code that my C++ program generates but it seems to be unable to be read by Autocad. Any insights on the issue will be much appreciated.

0
SECTION
2
ENTITIES
0
POLYLINE
8
0
62
1
66
1
70
8
0
VERTEX
8
0
70
32
10
1
20
2
30
0
0
VERTEX
8
0
70
32
10
1.2
20
2.13688
30
0
0
VERTEX
8
0
70
32
10
1.4
20
2.28024
30
0
0
VERTEX
8
0
70
32
10
1.6
20
2.42929
30
0
0
VERTEX
8
0
70
32
10
1.8
20
2.58329
30
0
0
VERTEX
8
0
70
32
10
2
20
2.74166
30
0
0
91
0
0
SEQEND
0
ENDSEC
0
EOF


    

Upvotes: 2

Views: 3456

Answers (3)

user21918232
user21918232

Reputation: 1

0
SECTION
2
ENTITIES
0
POLYLINE
8
default
66
1
70
0
0
VERTEX
8
default
70
32
10
0.0
20
0.0
0
VERTEX
8
default
70
32
10
1.0
20
2.0
0
VERTEX
8
default
70
32
10
-2.0
20
-1.0
0
SEQEND
0
ENDSEC
0
EOF

Upvotes: 0

JDelgado
JDelgado

Reputation: 99

The Issue that I was seem to be having it´s that I was using the DXF codes for a LWPOLYLINE when I should be using the DXF regarding POLYLINE. The difference is subtle but if the person that´s reading this is having the issue backtrack one by one the GROUP CODES and make sure all of them are part of the same ENTITY. I will share the code that finally was able to create an OUTPUT on AutoCad 2018 (Keep in mind the changes on the DXF format on the versions of AutoCad depending on your case)

0
SECTION
2
ENTITIES
0
POLYLINE
8
0
62
1
66
1
70
8
0
VERTEX
8
0
70
32
10
0
20
0
30
0
0
SEQEND
0
ENDSEC
0
EOF

Upvotes: 0

mozman
mozman

Reputation: 2239

There is an error in the last VERTEX:

0
VERTEX
8
0
70
32
10
2
20
2.74166
30
0
0    <---- This 0 is too much, starts a structural group tag (0, 91)
91
0
0
SEQEND
0
ENDSEC
0
EOF

If you have any information what the group code 91 (vertex identifier) is for, let me know, I am very interested.

Upvotes: 2

Related Questions