Files
2025-12-15 23:22:33 +08:00

90 lines
2.8 KiB
C++

/***********************************************************************************************************************
*
* Copyright (c) 2010 - 2025 by Tech Soft 3D, Inc.
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
* employees of Tech Soft 3D, Inc. is granted only under a written non-disclosure agreement, expressly prescribing the
* scope and manner of such use.
*
***********************************************************************************************************************/
#include <hoops_license.h>
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#define INITIALIZE_A3D_API
#include "PRC2XML.h"
//######################################################################################################################
A3DStatus ProcessFile(
A3DSDKHOOPSExchangeLoader& sHoopsExchangeLoader,
A3DImport& sImport,
const MY_CHAR* pcPRCFile,
const MY_CHAR* pcXMLFile,
bool bDumpPictures);
//######################################################################################################################
// Main function
#ifdef _MSC_VER
int wmain(A3DInt32 iArgc, wchar_t** ppcArgv)
#else
int main(A3DInt32 iArgc, A3DUTF8Char** ppcArgv)
#endif
{
//
// ### COMMAND LINE ARGUMENTS
//
MY_CHAR acSrcFileName[_MAX_PATH * 2] = { '\0' };
MY_CHAR acDstFileName[_MAX_PATH * 2] = { '\0' };
MY_CHAR acLogFileName[_MAX_PATH * 2] = { '\0' };
unsigned uPrc2xmlFlagArgs(EMPTY);
if (!ParseArgs(iArgc, ppcArgv, acSrcFileName, acDstFileName, acLogFileName, uPrc2xmlFlagArgs))
{
ShowUsage(ppcArgv);
return A3D_ERROR;
}
GetLogFile(acLogFileName); // Initialize log file
//
// ### INITIALIZE HOOPS EXCHANGE
//
A3DSDKHOOPSExchangeLoader sHoopsExchangeLoader(_T(HOOPS_BINARY_DIRECTORY), HOOPS_LICENSE);
CHECK_RET(sHoopsExchangeLoader.m_eSDKStatus);
// Initialize callbacks
CHECK_RET(A3DDllSetCallbacksMemory(CheckMalloc, CheckFree));
CHECK_RET(A3DDllSetCallbacksReport(PrintLogMessage, PrintLogWarning, PrintLogError));
//
// ### PROCESS SAMPLE CODE
//
A3DImport sImport(acSrcFileName); // see A3DSDKInternalConvert.hxx for import and export detailed parameters
//args utilisation
bool bDumpPictures = false;
if (DUMPPICTURES & uPrc2xmlFlagArgs)
{
bDumpPictures = true;
}
if (DUMPRELATIONSHIPS & uPrc2xmlFlagArgs)
{
sImport.m_sLoadData.m_sSpecifics.m_sIFC.m_bReadRelationships = true;
}
ProcessFile(sHoopsExchangeLoader, sImport, acSrcFileName, acDstFileName, bDumpPictures);
//
// ### TERMINATE HOOPS EXCHANGE
//
// Check memory allocations
return (int)ListLeaks();
}