The Design Web Format (DWF) is a popular file format from Autodesk. It allows users to share design data without requiring a full seat of the design authoring application. Developers can import DWF data into the HOOPS scene-graph, or export from the scene-graph to a DWF file. This is achieved by using DWF-specific classes provided with your HOOPS/3DF package and downloading the latest version of the DWF SDK from the Autodesk Developer Area.
To use the HOOPS/HIO component for DWF, please follow the steps below:
During start-up, when HOOPS/MVO finds the DWF HIO component in your application's path, it will perform the following steps:
Once the DWF HIO component is successfully loaded, your application will be able import DWF files without having to recompile HOOPS. To utilize the extensive services available in the DWF toolkit, you must compile against the DWF libraries directly and follow the steps described in 5.0 Integrating with the DWF Classes. If you are interested in importing DWF files into your application, please contact a Tech Soft 3D representative for more information.
DWF files can contain both 2D and 3D subfiles. The DWF HIO component provides import/export support for both formats. The 3D-DWF data is actualy heavily based on the HOOPS Stream File (HSF) format, which in turn is essentially a binary archive of the HOOPS/3DGS scene-graph. This should be kept in mind when importing/export 3D-DWF data.
The DWF HIO component was built against a specific version of DWF. If you want your application to run against another version of DWF, we recommend that you rebuild the DWF HIO component with that version of the library. To do so, simply open the hio_dwf_vc<version>.vcproj project located in the <hoops>/Dev_Tools/hoops_hio/hio_dwf/source. Be sure to set the environment variable DWF_SDK_DIR to point to the root of your DWF installation before you begin building. Once the project is built against the correct libraries, an .hio file will be created. Note that you may face some obstacles building against a different version of the DWF if interfaces are not compatible with the original libraries that the HIO component was built against.
When a DWF model is imported into HOOPS, the model units are also imported. This information can be found in the "model_information" segment under the model key as a HOOPS User_Option called "cad units". For example, if the user option value is "cad units =Inches", this means that one unit length of the imported entity is equivalent to one inch. The possible units are as follows:
The HOOPS DWF exporter relies on a number of output settings. The most important one is whether to create a 2D or 3D DWF. You can specify which output you want to export by setting the HOutputHandlerOptions::m_b3dOutput flag and passing it to the HBaseModel::WriteWithOptions method. If the output is a 2D DWF, then the page size will be 8.5" by 11.0". If you want to output a 3D DWF, you will need to determine the camera settings as well.
When you are exporting 3D DWF, the camera which is defined at export time will be saved with the model. Since camera setting are found in HBaseView, you must supply a pointer to your HBaseView object via HOutputHandlerOptions::m_pHBaseView in your call to the HBaseModel::WriteWithOptions method.
To ensure that the pre-set camera available from the DWF Viewer works as expected, you will need to orient your data according to the DWF setup. Specifically, the DWF Viewer assumes a right-handed coordinate system, where the front view is defined as looking down the z-axis in the negative direction, with the Y-axis pointing up.
In HOOPS, you can identify a specific segement as a node to the DWF Viewer's model browerser by setting that a suer option of node on that segment. When it is laster selected in the model browser, that segment and all its children will be highlighted in the 3D window. Furthermore, if you set additional "name= value" pairs as a user options on that same segment, these will be displayed in the Properties window.
DWF classes cannot be integrated directly into a HOOPS-based application which is also using HOOPS/Stream module. The reason for this is there are two stream components - one is HOOPS/Stream and other is Autodesk's copy of HOOPS stream which is part of DWF Toolkit (known as W3DTOOLKIT). These two have same class names, but slightly different implementations and they cannot coexist in one application.
In this section, we outline the steps involved in directly integrating between your HOOPS-based application and the DWF classes. Once you have downloaded and installed the DWF Toolkit, please follow the steps below:
Add HIOUtilityDwfExport.h and .cpp to your project. These files are located in the Dev_Tools/hoops_hio/hio_dwf/hoops_dwf/source directory of your HOOPS installation. Refer to hio_dwf<import/export>_vc10.vcproj in Dev_Tools/hoops_hio/hio_dwf/hoops_dwf/source directory.
Once you have completed the above steps, you do not need to rely on the DWF HIO component anymore. Please remove the associated .hio file from the hio_plugins directory in your application's working directory. Note that in a direct integration, you must register HIOUtilityDwfExport via HIOManager::RegisterOutputHandler so that the HBaseModel::Write function can recognize that the .dwf file format is supported. For more information on HOOPS/MVO file input/output architecture, please see section 4.0 File Input/Output and the I/O Manager of the HOOPS/MVO Programming Guide.
Once you have these settings you should now be able to export DWF files from your application with code similar to this:
HOutputHandlerOptions options; options.m_pHBaseView = m_pHView; options.m_b3dOutput = false; HOutputHandler * extra_handler = HDB::GetHIOManager()->GetOutputHandler("dwf"); if (extra_handler) { HFileOutputResult result = extra_handler->FileOutputByKey(L"c:/testing_dwf.dwf", m_pHView->GetModelKey(), &options); }
Our integration is supported on 32-bit and 64-bit Microsoft Visual Studio 2010.
For Release 19.16, the HIO_DWF component requires DWF 7.7.
For Release 19.00, the HIO_DWF component requires DWF 7.6.