dxflib help

Please use this forum to post feedback and suggestions related to dxflib.

Moderator: andrew

Post Reply
hicham212
Registered Member
Posts: 2
Joined: Thu May 17, 2012 3:00 pm

dxflib help

Post by hicham212 » Thu May 17, 2012 3:42 pm

hello I want to import an image, in my application like this picturewhat is possible with dxflib, if so, can you guide me I'm working on (Windows, Qt, C++)

i am sorry it's not an image but is an DXF filen i want to import int in my application like in the image of mediafaire

thx

[Edit: Both your posts merged to show as one 'unanswered' post to ensure you receive an answer. You can in future use the Edit tool to change or add content if necessary to an existing post - clive]

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: dxflib help

Post by andrew » Thu May 17, 2012 7:13 pm

dxflib parses DXF files and hands you the information in the file in a comfortable manner. For example, for every line entity in the DXF file, a function called 'addLine(...)' of your own C++ class is called with as parameter the start point and end point of the line.

Note that dxflib does not do any rendering or other interpretation of the data in the drawing. This might seem straightforward for lines but quickly gets very complicated for dimensions, hatches, blocks, texts, etc. If you need to visualize the drawing to the user, dxflib will only do a small part of the job: parsing the DXF file.

One possible solution for rendering is available with QCAD (C++ libraries or scripting). QCAD can render drawings for example into widgets, bitmaps, SVG, PDF or to a printer and also offers interaction with the drawing (zooming, editing, etc.).

Depending on your exact specifications, something based on QCAD might be a better solution for you. If you can share more details of your project, I'll be happy to give you more information on the possibilities with dxflib, the QCAD C++ Libraries or QCAD scripting.

hicham212
Registered Member
Posts: 2
Joined: Thu May 17, 2012 3:00 pm

Re: dxflib help

Post by hicham212 » Fri May 18, 2012 10:20 am

thank you for your reply, I am doing an internship, I have to do an application that can import a DXF file, and draw on, for drawing, it consiste to put equipment, and connect them

it comes to import the plan of a building (generally a building, 2D), in the form of DXF file and view the building plan in my application, then the user can put the equipment in the building plan.

the possibility of making dxf as widgets, Bitmaps, SVG, an idea seems very adapted to my situation, because the most important for me is to show the map of building, and just the viewing, if you can help me in this direction, I will be grateful, I work with widows 7

sorry for my bad english, but i hope that you can understand my Objective, thank you

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: dxflib help

Post by andrew » Mon May 21, 2012 10:34 am

QCAD 3 RC5 comes with some command line tools such as dwg2bmp and dwg2svg which might be helpful as a starting point for your use case.

You can download free trial versions from our web site at:
http://www.ribbonsoft.com/en/qcad-downloads-trial

To generate a Bitmap from a DWG or DXF file, please save the attached zipped helper Windows batch file 'Dwg2Bmp.bat' to the QCAD installation directory (where qcad.exe is) and run it as follows:

Code: Select all

dwg2bmp.bat examples/flange.dxf examples/flange.bmp

Code: Select all

Usage: dwg2bmp.bat [OPTIONS]... <drawing-file> <bitmap-file>

Converts a DWG / DXF file to a Bitmap file.
  -x, -width=W            Set bitmap width to W (in pixels)
  -y, -height=H           Set bitmap height to H (in pixels)
  -r, -resolution=R       Set rendering resolution to R
                          (in pixels/drawing unit)
                          This overrides the width/height parameters.
  -m, -margin=M           Set auto zoom margin to M (in pixels)
  -q, -quality=Q          Set the image quality / compression
                          (0=best compression..100=best quality)
  -b, -background=C       Set the background color as color name
                          e.g. 'white' or '#ccdd00'.
  -o, -origin             Draw origin point
  -a, -antialiasing       Enable antialiasing
Attachments
dwg2bmp.zip
(269 Bytes) Downloaded 1326 times

Post Reply

Return to “dxflib Suggestions and Feedback”