/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// /*************************************************************************************/ /* This console application reads BimRv file and export to DWG file in 2D mode. Also,*/ /* can create bitmap file from resulted DWG file. */ /*************************************************************************************/ // ODA SDK #include "OdaCommon.h" #include "diagnostics.h" #define STL_USING_IOSTREAM #include "OdaSTL.h" #define STD(a) std:: a #include "ExPrintConsole.h" #include "BimRv2Dwg2DExportTool.h" #include "OdString.h" static const char cUsage[] = { "BimRv2Dwg2DExportTool sample program. Copyright (C) " TD_COPYRIGHT_START_YEAR_S TD_COPYRIGHT_END_S "\n" "Usage: BimRv2Dwg2DExportTool [flag] \n" " filename - full path to supported file.\n" " view_num - number of view for export.\n" " flag - flag:\n" " 0 - do not create bitmap of resulted .dwg file,\n" " 1 - create bitmap of resulted DWG file\n" " outputDirectory - full path to output directory, where .dwg file and bitmap file well be created." "\nPress ENTER to continue...\n" }; /********************************************************************************/ /* Define Assert function to not crash Debug application if assertion is fired. */ /********************************************************************************/ static void MyAssert(const char* expression, const char* fileName, int nLineNo) { OdString message; message.format(L"\n!!! Assertion failed: \"%ls\"\n file: %ls, line %d\n", OdString(expression).c_str(), OdString(fileName).c_str(), nLineNo); odPrintConsoleString(message); } /************************************************************************/ /* Main */ /************************************************************************/ #if defined(OD_USE_WMAIN) int wmain(int argc, wchar_t* argv[]) #else int main(int argc, char* argv[]) #endif { #ifdef OD_HAVE_CCOMMAND_FUNC argc = ccommand(&argv); #endif /**********************************************************************/ /* Verify the argument count and display an error message as required */ /**********************************************************************/ if (argc < 3) { STD(cout) << cUsage; STD(cin).get(); return 1; } if (argc == 5) { OdString s(argv[3]); if (s.iCompare(OD_T("0")) != 0 && s.iCompare(OD_T("1")) != 0 && s.iCompare(OD_T("true")) != 0 && s.iCompare(OD_T("false")) != 0) { STD(cout) << cUsage; STD(cin).get(); return 1; } } OdString sFilePath(argv[1]); int viewNum = odStrToInt(OdString(argv[2])); bool bNeedBitmapFlag = false; OdString sOutputDirectory; if (argc == 5) { OdString sArg3 = argv[3]; if (sArg3 == OD_T("1") || sArg3 == OD_T("true")) bNeedBitmapFlag = true; } unsigned int iOutPath = 0; if (argc == 5) sOutputDirectory = OdString(argv[4]); else sOutputDirectory = OdString(argv[3]); /**********************************************************************/ /* Set customized assert function */ /**********************************************************************/ odSetAssertFunc(MyAssert); BimRv2Dwg2DExportTool bimRv2Dwg2DExportTool; OdTvResult rc = bimRv2Dwg2DExportTool.execute(sFilePath, viewNum, bNeedBitmapFlag, sOutputDirectory); if (rc == tvOk) odPrintConsoleString(L"BimRv2Dwg2DExportTool finished successfully.\n\nPress any key for exit..."); else { odPrintConsoleString(L"BimRv2Dwg2DExportTool failed.\n\nPress any key for exit..."); } }