Click here to Skip to main content
15,896,359 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
What is the best way to add polyline fo DXF creator program.
I have problem with VERTEX.
Posted
Comments
Sandeep Mewara 19-Apr-11 4:22am    
Incomplete and unclear question.

care to edit and elaborate?
amirrazzaqi 28-Apr-11 1:06am    
Hello Sandeep Mewara
I'm trying to make an application to create DXF file to use in AutoCAD and I find a good sample program that make DXF files with no function to create PolyLine and I want to implement this function for my own program.
Thanks

1 solution

I see this question is somewhat old - perhaps this has been solved by now?

I just had a look at the DXF specification docs, as found here[^]

I downloaded the one for AutoCad 2002, since I understand that there were some changes made between 2000 and 2002[^] (though now that I think of it - there must have been changes between each version. Hmm, never-mind)

Um, there's a table in the doc that lists the various control codes used.
I just opened up A9CAD and drew a 6 point polyline. Upon searching the saved DXF file, I find that this polyline is represented (at least in part) by the following text:

VB
AcDbPolyline
 90
        6
 70
     0
 43
0.0
 10
-34.68044809800129
 20
-1.29110251450677
 10
-27.93802385557705
 20
10.47227595099936
 10
-16.82019664732431
 20
3.156028368794326
 10
-9.503949065119278
 20
12.55238555770471
 10
-12.8034332688588
 20
-5.164410058027079
 10
-32.88725016118633
 20
-4.518858800773694
  0
ENDSEC


Key
----
90 - number of vertices marker
70 - Polyline flag (0 is default)
43 - Constant width flag
10 - X value of a vertex
20 - Y value of a vertex

Sooo, we can immediately see that we
(a) have 6 vertices
(b) have a polyline
(c) it is a constant width and finally
(d) It joins the vertices below:
{-34.68,-1.29}, {-27.94, 10.47}, {-16.82,3.16},
{-9.50,12.55}, {-12.80,-5.16}, {-32.89, -4.52}


Hope it's useful. :)
 
Share this answer
 
Comments
amirrazzaqi 15-Aug-13 1:43am    
Thank you enhzflep, but I mean that how to implement this in programming field.
It,s look like better I use Vector (in C++)
enhzflep 15-Aug-13 1:52am    
You're welcome amirrazzaqi.
You are not clear to me. I showed the format of data inserted into a DXF file when a polyline is added. Just duplicate the structure, making changes to the number of points, thickness of the line and co-ords of the points. Yes, I think a vector would make a good candidate for a container to store the points in while (and after) the line is created.

I suppose a vector to store the points, a string to hold the polyLine's name(id) and a double to hold the line width would be sufficient.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900