first of all, thanks for this article the author providing .but when i debug the code with the dxf file which has the polyline ,i found the display error (Arc other than Polyline).the cause is (if(int(((PENTPOLYLINE)pEntityData)->pVertex[i].Bulge*100)==0)) in the view.cpp,
a solution is using (<0.000001) instead.
another nibs is ReadBlockHeader() with the lack of "break " relative to the "case 70".
wish helpful to yours.
I just want to say this is a great article! It is just what my little robotics project needed. What I would really love to know is how to draw all this in 3D. If you know of a similar program, one that draws in 3D, then please tell me. Otherwise I guess I will have to write one.
Hi Omid Shahabi
Nice work by the way only one major disadvantage! you've used ooold programming languge -VC++6 I believe- yes many still using it others may still use older I myself used it before but much more moved to to .NET or newer version of VC++ -MS VS 2010 hit the market-
Note it's >=90% IMpossible to use old code with modern compilers.
Also the compiled dll itself can't be refrenced in other applications
I'm a civil engineer too and I'm working on a program that draws CAD structural plans and shop drawings with servy option.
I did one before back in 2005 for irrigation and drainage works in VB6 automating Autocad 2006 which was the last version that fully supports ActiveX/COM Automation.
Now I'm using Autocad 2011 and MS VS 2008 and I can go nowhere with automation so I began to consider another approch like what you did.
Googling around I was surprised to see your open source I can say it is the only dxf open source library desides QCAD -which written in the ooooolder unix friendly C++-
Soory for the flood, and thanks for what u share with others.Yours,
I want to convert a dxf file to g-code.do you have any idea?
please help me
rahi hast ke betunam file dxf ru be file g-code tabdil konam albate be zabane c#.mamnun misham komakam konid.
Hi Omid Shahabi:
Thanks for your article and source code first. I've got a question here: Any data type of coordinate we read from DXF file is (double,double), but if we want draw all the entities to our own application on screen, all the coordinates should be convert to (int,int). thers is the question, how should we convert them?
I'ven read the source code, and get the the convert information from four macros, but just can not fully understand them, Especilly the concept of Units and PPU. Could you give me more information about how to convert them? Hope for your reply, Thanks. Here are defination of your four macros:
#define U2PX(units) pDrawing->View.WindowLeft + (int)((-pDrawing->View.ViewLeft + x+(units)*xScale) * pDrawing->View.PPU * pDrawing->View.ZoomLevel)
#define U2PY(units) pDrawing->View.WindowBottom - (int)((-pDrawing->View.ViewBottom + y+(units)*yScale) * pDrawing->View.PPU * pDrawing->View.ZoomLevel)
#define U2PXROT(xUnits,yUnits) pDrawing->View.WindowLeft + (int)((-pDrawing->View.ViewLeft + x+(xUnits*xScale*cos(Rotation*PI/180)-yUnits*yScale*sin(Rotation*PI/180))*1) * pDrawing->View.PPU pDrawing->View.ZoomLevel)
#define U2PYROT(xUnits,yUnits) pDrawing->View.WindowBottom - (int)((-pDrawing->View.ViewBottom + y+(xUnits*xScale*sin(Rotation*PI/180)+yUnits*yScale*cos(Rotation*PI/180))*1) * pDrawing->View.PPU pDrawing->View.ZoomLevel)
>>> the CadIO.lib , CadIO.dll.(If you dont have this build the CadIO.sln first)
Problem is VS2008 users will not be able to do so -build the CadIO.sln- and I couldn't find a walkaround yet may be you can help or post the shared dll file
What about unicode
Have you made the conversion??
I pass all the code using LPCTSTR and TCHAR but the dll's has to be modified...
It's has problems to open files...
in fopen function I can't convert form LPCTSTR to wchar_t
When I use the header atlbase.h the compiler give's me an error
Actually if you try to make an Unicode Release it will fail... Because the code doesn´t handle the TCHAR characters...
I think you`ll have to forget the dll´s of the project and generate a new project with all the source code as a static library....
and then convert all the char to TCHAR and make the apropiate conversions....
The main problem could be in open the files, read and write data....
So it will take some work to do this....
Not yet, but I saw the code already....
The problem has a solution... I´ll fix it soon...
Put this code as a dll, is a terrible mistake, drawing files need's speed, especially large files.
The autor should post this sample as a static library, it will be easy to fix the bugs and problems too...
i have a dxf file which have the sqrt sigle.
and the sqrt sigle is draw line on the screen.
the number under the sigle is a text .
this lib can not be fit the number and sqrt very well.
how dose i do with it?