The HOOPS Stream Format (HSF) is an open file format that can be used for lightweight exchanging of graphical information. HSF has the following advantages:
Drawings SDK supports exporting a .dwg or .dgn file to a HOOPS Stream Format (.hsf file).
HOOPS Export provides direct integration between member applications built with the Drawings SDK and the HOOPS high-performance graphics system from Tech Soft 3D. It requires a separate license from Tech Soft 3D.
HOOPS Export is available in dynamic and static forms for Windows only. Supported platforms are limited by the platforms supported by Tech Soft 3D HOOPS SDK. Please see http://www.techsoft3d.com for more details.
All sources are available in the release packages.
Applications enhanced with HOOPS integration can support:
The ODA HOOPS Export module provides the following functionality:
TD_HoopsExport.tx is a .tx support module for HOOPS export.
Source code location: Kernel\Exports\HoopsExport.
This module should be loaded by the user application to get access to HOOPS export functionality.
Export process consists of several stages:
There are code examples that can be used for HOOPS export below:
HoopsExportParams hoopsParams;
hoopsParams.strFileName = sInput; //sets the output HOOPS Stream File full name
hoopsParams.pDb = m_pDb; //sets the database pointer for exporting drawing
OdUInt32 errCode = exportHoops(hoopsParams);
The next example shows how layouts can be processed during export to HOOPS Stream File:
OdStaticRxObject svcs;
::odInitialize(&svcs);
try
{
OdDbDatabasePtr pDb = svcs.readFile(dwgPath); //dwgPath contains full path to the input .dwg-file
HoopsExportParams params;
params.pDb = pDb;
params.iStartKey = 0;
params.bSetCamera = false;
params.bExportCurrentLayout = true;
params.bResetSystemExport = true;
params.strFileName = "";
OdDbBaseDatabasePEPtr pDbPE(params.pDb);
OdRxIteratorPtr pLayIter = pDbPE->layouts(params.pDb);
while(!pLayIter->done())
{
OdRxObjectPtr pCurLayout = pLayIter->object();
OdDbBaseLayoutPEPtr pLayoutInfo( pCurLayout );
if( pLayoutInfo.isNull() )
{
pLayIter->next();
continue;
}
pDbPE->setCurrentLayout(params.pDb, pLayoutInfo->name(pCurLayout));
OdString strLayoutName = pLayoutInfo->name(pCurLayout);
OdUInt32 retValue = exportHoops(params);
OdAnsiString tmp;
char *pchLayoutName = new char [ strLayoutName.getLength() + 1];
char *pchDwgPath = new char [ dwgPath.getLength() + 1];
wcstombs( pchLayoutName, strLayoutName.c_str(), strLayoutName.getLength() );
wcstombs( pchDwgPath, dwgPath.c_str(), dwgPath.getLength() );
pchLayoutName[ strLayoutName.getLength() ] = '\0';
pchDwgPath[ dwgPath.getLength() ] = '\0';
if( retValue == ::exOk )
tmp.format("Success: File \"%s\" layout \"%s\" has been exported to hoops.\r\n", pchDwgPath, pchLayoutName);
else
{
tmp.format("Fail : File \"%s\" layout \"%s\" hasn't been exported to hoops.\r\n", pchDwgPath, pchLayoutName);
}
delete[] pchDwgPath;
delete[] pchLayoutName;
printf( "%s", tmp);
pLayIter->next();
}
}
catch(...)
{
::odUninitialize();
return 1;
}
::odUninitialize();
return 0;
For detailed information about export parameters, see Export parameters.
The exportHoops() function returns an error code that can be used for checking whether the export process successfully finished. Also you can use the exportHoopsErrorCode() function which returns error message text:
OdUInt32 retValue = exportHoops(params);
if (retValue != ::exOk)
{
OdString errMes = exportHoopsErrorCode(retValue);
printf("\nexportHoops error returned : 0x%x. \n%s", (unsigned) retValue, (const char*)errMes);
}
Export errors are described below.
Identifier | Error code | Error description |
---|---|---|
exOk | 0x00000000 | Export finished successfully. |
exInternalError | 0x00010000 | Export failed: Internal exception occurred. |
exFileSavingError | Export failed: Error occurred while writing to an output .hsf or .hmf file. | |
exNullDatabase | Export failed: Invalid database pointer. | |
exOdError | 0x00020000 | Export failed: ODA base class error occurred. |
exLastErrorNum | 0xFFFFFFFF | Number of the last error that occurred. |
The HOOPS export process can be managed with a set of parameters that determine how the export should be executed.
Export parameter | Parameter name | Description |
---|---|---|
Database | pDb | Pointer to drawing database that is to be exported. |
Output file name | strFileName | Full name of the exported .hsf or .hmf file. |
HOOPS creating flags | flags | A set of flags that determine options for the created HOOPS file. These options are not for writing the HOOPS Stream provided by the HOOPS API, but instead they are a set of options for the exported drawing. See Export flags for additional information. |
Background color | background | Background color of the output HOOPS file. White is the default value. |
Palette | pPalette | Palette to be used for the output HOOPS file. If not specified (NULL), one of two default palettes will be used depending on the background color. |
Setting camera option | bSetCamera | Determines whether a camera (viewpoint) is set in the output HOOPS file. |
Reset the HOOPS system option | bResetSystemExport | Used for utility testing and must be omitted in user code. |
Current layout export option | bExportCurrentLayout | Determines whether only the current layout of the input drawing will be exported (true). If it is switched off (false), all layouts are exported. |
Key for starting segment of HOOPS file | iStartKey | Determines a segment that must be opened for writing data during the export process. |
Export file type | iExportFileType | Determines what type of file must be exported: 1 (DWG_FILE_TYPE) for a .dwg file or 2 (DGN_FILE_TYPE) for a .dgn file. |
HOOPS Export functionality supports several option flags:
There are two font types that can be used for text:
Text from the original drawing can be exported to a HOOPS Stream either as geometry (when symbols are drawn as collections of primitives) or using internal facilities of the HOOPS Stream format. The TTF_TEXT_AS_GEOMETRY flag enables True Type font text to geometry conversion, and the SHX_TEXT_AS_GEOMETRY flag enables SHX font text to geometry conversion.
The ability of setting page parameters for the output PDF document depends on whether Zoom to Extents mode is switched on or off:
Drawings SDK contains sample applications which show how to use HOOPS export functionality in user applications:
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|