2

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


    
desertnaut
  • 57,590
  • 26
  • 140
  • 166
JDelgado
  • 99
  • 1
  • 6

3 Answers3

2

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.

mozman
  • 2,001
  • 8
  • 23
  • The Group Code 91 it´s a Vertex Identifier code but it´s used for the ENTITY LWPOLYLINE and not with POLYLINE. That coupled with the added "0" were the reasons for my problems so I thank you for your answer. – JDelgado Mar 04 '19 at 02:48
0

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
JDelgado
  • 99
  • 1
  • 6
0
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
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 18 '23 at 12:05
  • 1
    Welcome to Stack Overflow! While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Yunnosch May 19 '23 at 07:53