DATAKIT API  V2025.1
How to use Dtk_Preview Class

A Dtk_Preview is a Thumbnail image that may exist in a CAD file. You can get a preview for a Dtk_Component and/or Dtk_Node.
Using GetPreview() method of Dtk_Component retrieves the model preview.
Using GetPreview() method of Dtk_Node retrieves the node preview (for example a drawing type node).

Dtk_PreviewPtr TmpPreview = inComponent->GetPreview();
if (TmpPreview.IsNotNULL())
{
Dtk_Int32 size = TmpPreview->GetStreamSize();
char *jpgimage = TmpPreview->GetStream();
Dtk_string Preview_name = "Preview.jpg";
FILE *jpg = Preview_name.OpenFile("wb");
if (jpg)
{
fwrite(jpgimage,sizeof(char),size,jpg);
fclose(jpg);
}
}


Dtk_SmartPtr::IsNotNULL
Dtk_bool IsNotNULL() const
Definition: util_ptr_dtk.hpp:119
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:58
Dtk_string::OpenFile
FILE * OpenFile(const Dtk_string &inRights) const
File Utility : Open a file with the given rights.
Dtk_Int32
int32_t Dtk_Int32
Definition: define.h:687
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37