PSR Posted February 5, 2011 Share Posted February 5, 2011 Hi Folks, I came to know that there are no converters available for XML file to DXF format FOr my project i need to write a interpreter to convert from XML to DXF format Please let me know how do i start? i got hold of some XML parsers until now? How to go about this issue? Please help me with some design specifications and code snippets OR links. Thanks PSR Quote Link to comment Share on other sites More sharing options...
opreese Posted February 14, 2011 Share Posted February 14, 2011 I am working on a project that creates dxf files from a list of lines and circles. In the dxf file there is a section called entities which is where the data of each line and circle goes. So for example, lets say you have 3 lines with points (x1,y1)-(x2,y2): (0,0)-(10,10) (0,0)-(20,20) (0,0)-(30,30) note: using a basic programming language: In order to create the dxf file, my program would look something like this dim as integer i dim as double mylines(3,4) mylines(1,1)=0 mylines(1,2)=0 mylines(1,3)=10 mylines(1,4)=10 mylines(2,1)=0 mylines(2,2)=0 mylines(2,3)=20 mylines(2,4)=20 mylines(3,1)=0 mylines(3,2)=0 mylines(3,3)=20 mylines(3,4)=20 open "my_dxf_file.dxf" for output as #1 Print #1, " 0" Print #1, "SECTION" Print #1, " 2" Print #1, "ENTITIES" for i = 1 to 3 print #1, " 0" print #1, "LINE" print #1, "10" print #1, str(mylines(i,1)) print #1, "20" print #1, str(mylines(i,2)) print #1, "11" print #1, str(mylines(i,3)) print #1, "21" print #1, str(mylines(i,4)) next Print #1, " 0" Print #1, "EOF" Close #1 end And, for circles, you would need to refer to autocads dxf reference to find out what group codes are used. The above is relatively simple and should be usable if and only if your objective is to create a dxf file containing the ENTITIES section. It becomes more complex if and when you would like to add layers and blocks and or nested blocks. The complexity involved requires one to write routines that build the header and table sections of the dxf file and in so doing adds even more complexity due to the issues of handseed and handles (ie. group code 5, 105, & 330) I am trying to create a library for all to use that creates compatible dxf files cheers, owen - author of fbcad Quote Link to comment Share on other sites More sharing options...
opreese Posted February 15, 2011 Share Posted February 15, 2011 So, I'm back to square one, trying to create a minimal dxf routine today. After messing around with this (again), it was the ELLIPSE that tripped me up 5 years ago. Autocad version 12 dxf files does not support ellipse as an entity type, instead it was using multiple vertexes as a work around. Next, I must have looked into the minimal requirement for versions 13 and up which is where I figured out the need for handseed and handles. In any case, I'm back to square one and will see if it's possible to not have to deal with handseed and handles. I'll post my results here if I find a sollution. Cheers, Owen Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.