0

I am trying to export CAD formats (mainly 2D Autocad drawings) to TIFF format.

All I could find on the internet is how to convert image formats to Tiff ( pixels, colors..). But I'm looking to save geometry data (mostly 2D Autocad drawings) into TIFF format using C++98 and TIFF library and I have the following questions:

  1. Does the tiff format allow such conversions?

    (I read something about possibility to include vector-based clipping path but i don't understand it very much)

  2. If so can anyone help me on how to do it?

2
  • 2
    Yes, you can render a CAD drawing into a TIFF. But also yes, that's inevitably going to lose something--the TIFF is a rendering, so it's going to be at some fixed scale, from some fixed viewpoint. As to how to do it, you typically render it into a memory buffer roughly like you were going to display it on screen, then use a TIFF library to format that buffer of pixels into the correct format. Jul 17, 2017 at 13:45
  • Let's just start with 2D...
    – J. Chomel
    Jul 19, 2017 at 12:06

1 Answer 1

0

If you have autoCAD, then you may somehow hack the "export to TIFF" button.

I found something that might help you here (searched c++ autocad export):

Add reference to "autocad/objectdbx common 16 type library"

_acadAPP = gcnew AcadApplication();
AcadDocumentClass * _acadDocument = safe_cast< AcadDocumentClass * >(
_acadAPP->Documents->Item( 0 ));
_acadAPP->Visible = true;
IAcadModelSpace ^_acadModelSpace = dynamic_cast< IAcadModelSpace *>( _acadDocument->ModelSpace);

It might be overcomplicated if you don't have it. If you read posts related to this here on SO, you'll note that since AutoCAD is not open source, it's difficult to do anything without it.

Once this huge part is done - not sure it's feasible, then follow instruction on libtiff.org, it looks like this:

#include "tiffio.h"
main()
{
    TIFF* tif = TIFFOpen("foo.tif", "r");
    ... do stuff ...
    TIFFClose(tif);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.