Init
This commit is contained in:
46
exchange/exchangesource/PRC2XML/ExchangeManagement.cpp
Normal file
46
exchange/exchangesource/PRC2XML/ExchangeManagement.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Created by mathis on 27/05/2016.
|
||||
//
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include "TargetConditionals.h"
|
||||
# if TARGET_OS_IPHONE == 1 || TARGET_IPHONE_SIMULATOR == 1
|
||||
# define INITIALIZE_A3D_API_STATIC
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "ExchangeManagement.h"
|
||||
|
||||
#include <A3DSDKIncludes.h>
|
||||
|
||||
#include "PRC2XML.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include "TargetConditionals.h"
|
||||
# if TARGET_OS_IPHONE == 1 || TARGET_IPHONE_SIMULATOR == 1
|
||||
# include <A3DSDKInternalConvert.hxx>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
ExchangeManagement::ExchangeManagement() {
|
||||
m_libraryLoadingStatus = A3D_SUCCESS;
|
||||
|
||||
m_sHoopsExchangeLoader = new A3DSDKHOOPSExchangeLoader(NULL);
|
||||
m_libraryLoadingStatus = m_sHoopsExchangeLoader->m_eSDKStatus;
|
||||
}
|
||||
|
||||
A3DInt32 ExchangeManagement::convert(const std::string& filename, const std::string& outputPath) {
|
||||
|
||||
A3DInt32 iRet = A3D_ERROR;
|
||||
if (m_libraryLoadingStatus == A3D_SUCCESS) {
|
||||
A3DImport sImport(filename.c_str());
|
||||
|
||||
iRet = ProcessFile(*m_sHoopsExchangeLoader, sImport, filename.c_str(), outputPath.c_str());
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
ExchangeManagement::~ExchangeManagement() {
|
||||
delete m_sHoopsExchangeLoader;
|
||||
}
|
||||
|
||||
23
exchange/exchangesource/PRC2XML/ExchangeManagement.h
Normal file
23
exchange/exchangesource/PRC2XML/ExchangeManagement.h
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Created by mathis on 27/05/2016.
|
||||
//
|
||||
|
||||
#ifndef PRC2XML_EXCHANGEMANAGEMENT_H
|
||||
#define PRC2XML_EXCHANGEMANAGEMENT_H
|
||||
|
||||
#include <string>
|
||||
#include <A3DSDKIncludes.h>
|
||||
|
||||
class ExchangeManagement {
|
||||
public:
|
||||
ExchangeManagement();
|
||||
~ExchangeManagement();
|
||||
|
||||
A3DInt32 convert(const std::string& filename, const std::string& outputPath);
|
||||
|
||||
protected:
|
||||
A3DInt32 m_libraryLoadingStatus;
|
||||
A3DSDKHOOPSExchangeLoader* m_sHoopsExchangeLoader;
|
||||
};
|
||||
|
||||
#endif //PRC2XML_EXCHANGEMANAGEMENT_H
|
||||
212
exchange/exchangesource/PRC2XML/PRC2XML.cpp
Normal file
212
exchange/exchangesource/PRC2XML/PRC2XML.cpp
Normal file
@@ -0,0 +1,212 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <memory>
|
||||
#include <new> // for exception-throwing new
|
||||
|
||||
#ifdef __ANDROID__
|
||||
# include <android/log.h>
|
||||
# include <dlfcn.h>
|
||||
|
||||
# define INITIALIZE_A3D_API
|
||||
# include <A3DSDKIncludes.h>
|
||||
# undef INITIALIZE_A3D_API
|
||||
|
||||
# define JNI_LOG_TAG "SAMPLE PRC 2 XML"
|
||||
# define LOGI(...) __android_log_print(ANDROID_LOG_INFO, JNI_LOG_TAG, __VA_ARGS__)
|
||||
# define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, JNI_LOG_TAG, __VA_ARGS__)
|
||||
#endif // __ANDROID__
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include "TargetConditionals.h"
|
||||
# if TARGET_OS_IPHONE == 1 || TARGET_IPHONE_SIMULATOR == 1
|
||||
# define APPLE_IOS
|
||||
# include <A3DSDKIncludes.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "PRC2XML.h"
|
||||
|
||||
#ifndef _MAX_PATH
|
||||
# ifdef _MSC_VER
|
||||
# define _MAX_PATH 260
|
||||
# else
|
||||
# define _MAX_PATH 4096
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//######################################################################################################################
|
||||
// reads the PRC file and dumps information into XML format
|
||||
A3DStatus ReadFile(A3DSDKHOOPSExchangeLoader& sHoopsExchangeLoader, A3DImport& sImport, _TiXmlElement* treatment)
|
||||
{
|
||||
const A3DStatus iRet = sHoopsExchangeLoader.Import(sImport);
|
||||
if(iRet != A3D_SUCCESS && iRet != A3D_LOAD_MULTI_MODELS_CADFILE && iRet != A3D_LOAD_MISSING_COMPONENTS)
|
||||
return iRet;
|
||||
|
||||
A3DAsmModelFile* pModelFile = sHoopsExchangeLoader.m_psModelFile;
|
||||
|
||||
// Retrieve physical properties
|
||||
A3DPhysicalPropertiesData sPhysPropsData;
|
||||
A3D_INITIALIZE_DATA(A3DPhysicalPropertiesData, sPhysPropsData);
|
||||
A3DStatus iRetP = A3DComputeModelFilePhysicalProperties(pModelFile, &sPhysPropsData);
|
||||
|
||||
|
||||
std::unique_ptr<_TiXmlElement> physicalprops(new _TiXmlElement("ComputePhysicalProps"));
|
||||
|
||||
if (iRetP == A3D_SUCCESS)
|
||||
{
|
||||
physicalprops->SetDoubleAttribute("m_sGravityCenter.m_dX", sPhysPropsData.m_sGravityCenter.m_dX);
|
||||
physicalprops->SetDoubleAttribute("m_sGravityCenter.m_dY", sPhysPropsData.m_sGravityCenter.m_dY);
|
||||
physicalprops->SetDoubleAttribute("m_sGravityCenter.m_dZ", sPhysPropsData.m_sGravityCenter.m_dZ);
|
||||
physicalprops->SetDoubleAttribute("m_dSurface", sPhysPropsData.m_dSurface);
|
||||
physicalprops->SetDoubleAttribute("m_bVolumeComputed", sPhysPropsData.m_bVolumeComputed);
|
||||
physicalprops->SetDoubleAttribute("m_dVolume", sPhysPropsData.m_dVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
physicalprops->SetAttribute("error", iRetP);
|
||||
}
|
||||
|
||||
treatment->LinkEndChild(physicalprops.release());
|
||||
|
||||
#ifndef APPLE_IOS // the following code triggers a SIGSTOP on iOS
|
||||
// Retrieve files path from model files
|
||||
A3DUns32 nbFiles = 0, nbAssemblyFiles = 0, nbMissingFiles = 0;
|
||||
A3DUTF8Char** ppPaths = NULL, ** ppAssemblyPaths = NULL, ** ppMissingPaths = NULL;
|
||||
|
||||
struct ModelFileGuard
|
||||
{
|
||||
A3DAsmModelFile*& m_psModelFile;
|
||||
explicit ModelFileGuard(A3DAsmModelFile*& pModelFile): m_psModelFile(pModelFile) {}
|
||||
~ModelFileGuard()
|
||||
{
|
||||
A3DAsmModelFileDelete(m_psModelFile);
|
||||
m_psModelFile = NULL;
|
||||
}
|
||||
} const sGuard(sHoopsExchangeLoader.m_psModelFile);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
try {
|
||||
#endif
|
||||
CHECK_RET(A3DAsmGetFilesPathFromModelFile(
|
||||
sHoopsExchangeLoader.m_psModelFile,
|
||||
&nbFiles,
|
||||
&ppPaths,
|
||||
&nbAssemblyFiles,
|
||||
&ppAssemblyPaths,
|
||||
&nbMissingFiles,
|
||||
&ppMissingPaths));
|
||||
#ifdef __ANDROID__
|
||||
} catch(std::exception const& e) {
|
||||
LOGE("%s\n", e.what());
|
||||
return iRet;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::unique_ptr<_TiXmlElement> allFilesPaths(new _TiXmlElement("A3DAsmFilesPathFromModelFile"));
|
||||
allFilesPaths->SetAttribute("nbFiles" , (int)nbFiles);
|
||||
allFilesPaths->SetAttribute("nbAssemblyFiles", (int)nbAssemblyFiles);
|
||||
allFilesPaths->SetAttribute("nbMissingFiles" , (int)nbMissingFiles);
|
||||
|
||||
for (A3DUns32 ui = 0; ui < nbFiles; ui++)
|
||||
{
|
||||
std::unique_ptr<_TiXmlElement> filePaths(new _TiXmlElement("Filepaths"));
|
||||
filePaths->SetAttribute("m_FilePaths", ppPaths[ui]);
|
||||
allFilesPaths->LinkEndChild(filePaths.release());
|
||||
}
|
||||
|
||||
for (A3DUns32 uj = 0; uj < nbAssemblyFiles; uj++)
|
||||
{
|
||||
std::unique_ptr<_TiXmlElement> assemblyFilePaths(new _TiXmlElement("AssemblyFilePaths"));
|
||||
assemblyFilePaths->SetAttribute("m_AssemblyFilePaths", ppAssemblyPaths[uj]);
|
||||
allFilesPaths->LinkEndChild(assemblyFilePaths.release());
|
||||
}
|
||||
|
||||
for (A3DUns32 uk = 0; uk < nbMissingFiles; uk++)
|
||||
{
|
||||
std::unique_ptr<_TiXmlElement> missingFilePaths(new _TiXmlElement("MissingFilePaths"));
|
||||
missingFilePaths->SetAttribute("m_nbMissingFiles", ppMissingPaths[uk]);
|
||||
allFilesPaths->LinkEndChild(missingFilePaths.release());
|
||||
}
|
||||
|
||||
treatment->LinkEndChild(allFilesPaths.release());
|
||||
|
||||
CHECK_RET(A3DAsmGetFilesPathFromModelFile(NULL, &nbFiles, &ppPaths, &nbAssemblyFiles, &ppAssemblyPaths, &nbMissingFiles, &ppMissingPaths));
|
||||
#endif // !defined(APPLE_IOS)
|
||||
|
||||
A3DGlobal* pGlobal = NULL;
|
||||
CHECK_RET(A3DGlobalGetPointer(&pGlobal));
|
||||
|
||||
traverseGlobal(pGlobal, treatment);
|
||||
traverseModel(pModelFile, treatment);
|
||||
traverseFonts(treatment);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
A3DVoid _InitializeFontsArray();
|
||||
|
||||
//######################################################################################################################
|
||||
A3DVoid _TerminateFontsArray();
|
||||
|
||||
//######################################################################################################################
|
||||
A3DStatus ProcessFile(
|
||||
A3DSDKHOOPSExchangeLoader& sHoopsExchangeLoader,
|
||||
A3DImport& sImport,
|
||||
const MY_CHAR* pcPRCFile,
|
||||
const MY_CHAR* pcXMLFile)
|
||||
{
|
||||
A3DUTF8Char sPRCFileUTF8[_MAX_PATH];
|
||||
A3DUTF8Char sXMLFileUTF8[_MAX_PATH];
|
||||
#ifdef _MSC_VER
|
||||
A3DMiscUTF16ToUTF8(pcPRCFile, sPRCFileUTF8);
|
||||
A3DMiscUTF16ToUTF8(pcXMLFile, sXMLFileUTF8);
|
||||
#else
|
||||
MY_STRCPY(sPRCFileUTF8, pcPRCFile);
|
||||
MY_STRCPY(sXMLFileUTF8, pcXMLFile);
|
||||
#endif
|
||||
|
||||
std::unique_ptr<_TiXmlDocument> doc;
|
||||
try
|
||||
{
|
||||
doc.reset(new _TiXmlDocument);
|
||||
doc->SetCondenseWhiteSpace(false);
|
||||
|
||||
std::unique_ptr<_TiXmlComment> comment(new _TiXmlComment("XML dump from PRC file"));
|
||||
doc->LinkEndChild(comment.release());
|
||||
|
||||
A3DInt32 iMajorVersion = 0, iMinorVersion = 0;
|
||||
CHECK_RET(A3DDllGetVersion(&iMajorVersion, &iMinorVersion));
|
||||
|
||||
std::unique_ptr<_TiXmlElement> treatment(new _TiXmlElement("TREATMENT"));
|
||||
treatment->SetAttribute("MajorVersion", iMajorVersion);
|
||||
treatment->SetAttribute("MinorVersion", iMinorVersion);
|
||||
treatment->SetAttribute("PRCFile" , sPRCFileUTF8);
|
||||
|
||||
_InitializeFontsArray();
|
||||
|
||||
TEST_RET(ReadFile(sHoopsExchangeLoader, sImport, treatment.get()))
|
||||
|
||||
doc->LinkEndChild(treatment.release());
|
||||
doc->SaveFile(sXMLFileUTF8);
|
||||
|
||||
_TerminateFontsArray();
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
catch(const std::bad_alloc&)
|
||||
{
|
||||
PrintLogError(NULL, "std::bad_alloc exception caught\n");
|
||||
if (doc.get())
|
||||
// try to save what has already been generated
|
||||
doc->SaveFile(sXMLFileUTF8);
|
||||
return A3D_ERROR;
|
||||
}
|
||||
}
|
||||
219
exchange/exchangesource/PRC2XML/PRC2XML.h
Normal file
219
exchange/exchangesource/PRC2XML/PRC2XML.h
Normal file
@@ -0,0 +1,219 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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.
|
||||
*
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#ifndef __A3DTESTERREAD_H__
|
||||
#define __A3DTESTERREAD_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
# pragma warning (disable:4090)
|
||||
# define _CRT_SECURE_NO_DEPRECATE 1
|
||||
# ifdef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
|
||||
# undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
|
||||
# define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
|
||||
# endif
|
||||
#else
|
||||
#define sprintf_s(buf, buf_size, ...) sprintf((buf), __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include "TargetConditionals.h"
|
||||
# if TARGET_OS_IPHONE == 1 || TARGET_IPHONE_SIMULATOR == 1
|
||||
# include "tinyxml.h"
|
||||
# include "common.hpp"
|
||||
# else
|
||||
# include <tinyxml.h>
|
||||
# include <A3DSDKIncludes.h>
|
||||
# include "../common.hpp"
|
||||
# endif
|
||||
#elif defined(__ANDROID__)
|
||||
# include <tinyxml.h>
|
||||
# include "common.hpp"
|
||||
#else
|
||||
# include <tinyxml.h>
|
||||
# include <A3DSDKIncludes.h>
|
||||
# include "../common.hpp"
|
||||
#endif
|
||||
|
||||
//######################################################################################################################
|
||||
A3DStatus ProcessFile(
|
||||
A3DSDKHOOPSExchangeLoader& sHoopsExchangeLoader,
|
||||
A3DImport& sImport,
|
||||
const MY_CHAR* pcPRCFile,
|
||||
const MY_CHAR* pcXMLFile);
|
||||
|
||||
//######################################################################################################################
|
||||
void _SetAttributePtr(_TiXmlElement* psElement, const A3DUTF8Char* pcAttribName, void* pValue);
|
||||
|
||||
//######################################################################################################################
|
||||
void _SetDoubleAttribute(_TiXmlElement* psElement, const char* name, double val);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDoubles(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DDouble* pd, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseUInts(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DUns32* pui, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseUChars(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DUns8* pui, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseBools(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DBool* pb, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseVoids(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DVoid** pp, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traversePoint2d(const A3DUTF8Char* name, const A3DVector2dData& sData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traversePoint(const A3DUTF8Char* name, const A3DVector3dData& sData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traversePoints(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DVector3dData* pv, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseInterval(const A3DIntervalData* pData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDomain(const A3DDomainData* pData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseBoundingBox(const A3DBoundingBoxData* pData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseParam(const A3DParameterizationData* pData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseUVParam(const A3DUVParameterizationData* pData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
A3DStatus traverseTransformation(const A3DMiscTransformation* pTrsf, _TiXmlElement *setting);
|
||||
|
||||
//######################################################################################################################
|
||||
A3DStatus traverseCartesianTransformationData(const A3DMiscCartesianTransformationData& oTrsf, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
A3DStatus traverseCartesianTransformation(const A3DMiscCartesianTransformation* pTransfo3d, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseSource(const A3DEntity* pEntity, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseGlobal(const A3DGlobal* pGlobal, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseModel(const A3DAsmModelFile* pModelFile, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int dumpRelationships(const A3DBIMData* pBimData, _TiXmlElement* model);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseFonts(_TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseCurve(const A3DCrvBase* pCrv, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseSurface(const A3DSurfBase* pSrf, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseSrfPlane(const A3DSurfPlane* pSrf, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseAnnotation(const A3DMkpAnnotationEntity* pAnnot, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkup(const A3DMkpMarkup* pMarkup, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseLeader(const A3DMkpLeader* pLeader, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseLinkedItem(const A3DMiscMarkupLinkedItem* pMkpLinkedItem, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseEntityReference(const A3DMiscEntityReference* pEntityReference, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseSingleWireBody(const A3DTopoSingleWireBody* pSingleWireBody, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseTopoContext(const A3DTopoContext* pContext, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseBodyContent(const A3DTopoBody* pBody, _TiXmlElement* setting,unsigned char &ucBehav);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseBrepData(const A3DTopoBrepData* pBrepData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseTessBase(const A3DTessBase* pTess, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseView(const A3DMkpView* pView, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseRepItem(const A3DRiRepresentationItem* pRepItem, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseCSys(const A3DRiCoordinateSystem* pCSys, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseTextureApplication(const A3DGraphTextureApplicationData& sData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseTextureDefinition(const A3DGraphTextureDefinitionData& sData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupTess(const A3DTessMarkup* pMarkupTess, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupDefinition(const A3DMkpMarkup* pMarkup, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupText(const A3DMarkupText* pA3DMarkup, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupRichText(const A3DMarkupRichText* pA3DMarkup, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupDatum(const A3DMarkupDatum* pA3DMarkup, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupTextProperties(const A3DMDTextProperties* pA3DTextProperties, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupGDT(const A3DMarkupGDT* psMarkup, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupDimension(const A3DMarkupDimension* pMarkup, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDrawing(const A3DDrawingModel * pDrawing, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMaterial(const A3DGraphMaterialData& sData, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMaterialProperties(const A3DEntity* pEntity, _TiXmlElement* xmlfather);
|
||||
|
||||
//######################################################################################################################
|
||||
A3DVoid traverseFeatureTree(const A3DFRMTree* pFeatFeatureTree, _TiXmlElement* xmlfather);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseToleranceSizeValue(const A3DMDToleranceSizeValue* pToleranceSizeValue, _TiXmlElement* setting);
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseConstraint(const A3DAsmConstraint* pAsmConstraint, _TiXmlElement* xmlfather);
|
||||
|
||||
#endif /* __A3DTESTERREAD_H__ */
|
||||
199
exchange/exchangesource/PRC2XML/PRC2XML.vcxproj
Normal file
199
exchange/exchangesource/PRC2XML/PRC2XML.vcxproj
Normal file
@@ -0,0 +1,199 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C3C57200-3B1F-465F-8631-E948A935D645}</ProjectGuid>
|
||||
<RootNamespace>PRC2XML</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v145</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v145</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v145</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v145</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(SolutionDir)\HOOPSExchangePublishSample.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(SolutionDir)\HOOPSExchangePublishSample.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(SolutionDir)\HOOPSExchangePublishSample.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(SolutionDir)\HOOPSExchangePublishSample.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.\TinyXML;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>..\..\bin\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalDependencies>legacy_stdio_float_rounding.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.\TinyXML;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>..\..\bin\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalDependencies>legacy_stdio_float_rounding.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\TinyXML;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>..\..\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalDependencies>legacy_stdio_float_rounding.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\TinyXML;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>..\..\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalDependencies>legacy_stdio_float_rounding.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="PRC2XML.cpp" />
|
||||
<ClCompile Include="PRC2XMLConstraint.cpp" />
|
||||
<ClCompile Include="PRC2XMLFeature.cpp" />
|
||||
<ClCompile Include="PRC2XMLGeometryCrv.cpp" />
|
||||
<ClCompile Include="PRC2XMLGeometrySrf.cpp" />
|
||||
<ClCompile Include="PRC2XMLGlobal.cpp" />
|
||||
<ClCompile Include="PRC2XMLIfcRelationships.cpp" />
|
||||
<ClCompile Include="PRC2XMLMarkup.cpp" />
|
||||
<ClCompile Include="PRC2XMLMarkupDefinition.cpp" />
|
||||
<ClCompile Include="PRC2XMLMarkupDimension.cpp" />
|
||||
<ClCompile Include="PRC2XMLMarkupGDT.cpp" />
|
||||
<ClCompile Include="PRC2XMLMarkupText.cpp" />
|
||||
<ClCompile Include="PRC2XMLRepItems.cpp" />
|
||||
<ClCompile Include="PRC2XMLRootEntities.cpp" />
|
||||
<ClCompile Include="PRC2XMLStructure.cpp" />
|
||||
<ClCompile Include="PRC2XMLTessellation.cpp" />
|
||||
<ClCompile Include="PRC2XMLTexture.cpp" />
|
||||
<ClCompile Include="PRC2XMLTools.cpp" />
|
||||
<ClCompile Include="PRC2XMLTopology.cpp" />
|
||||
<ClCompile Include="TinyXML\tinystr.cpp" />
|
||||
<ClCompile Include="TinyXML\tinyxml.cpp" />
|
||||
<ClCompile Include="TinyXML\tinyxmlerror.cpp" />
|
||||
<ClCompile Include="TinyXML\tinyxmlparser.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="PRC2XML.h" />
|
||||
<ClInclude Include="TinyXML\tinystr.h" />
|
||||
<ClInclude Include="TinyXML\tinyxml.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
111
exchange/exchangesource/PRC2XML/PRC2XML.vcxproj.filters
Normal file
111
exchange/exchangesource/PRC2XML/PRC2XML.vcxproj.filters
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\TinyXML">
|
||||
<UniqueIdentifier>{634f85a6-9600-4a43-8d89-3c2302e081bd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\pmi">
|
||||
<UniqueIdentifier>{a36c30af-97fd-42f2-bc06-58067f37adf5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\TinyXML">
|
||||
<UniqueIdentifier>{87964168-4c28-4b2d-9caa-a9d6ef35afc7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="PRC2XML.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLGeometryCrv.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLGeometrySrf.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLGlobal.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLMarkup.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLRepItems.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLRootEntities.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLStructure.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLTessellation.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLTexture.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLTools.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLTopology.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TinyXML\tinystr.cpp">
|
||||
<Filter>Source Files\TinyXML</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TinyXML\tinyxml.cpp">
|
||||
<Filter>Source Files\TinyXML</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TinyXML\tinyxmlerror.cpp">
|
||||
<Filter>Source Files\TinyXML</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TinyXML\tinyxmlparser.cpp">
|
||||
<Filter>Source Files\TinyXML</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLMarkupDefinition.cpp">
|
||||
<Filter>Source Files\pmi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLMarkupDimension.cpp">
|
||||
<Filter>Source Files\pmi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLMarkupGDT.cpp">
|
||||
<Filter>Source Files\pmi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLMarkupText.cpp">
|
||||
<Filter>Source Files\pmi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLFeature.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLConstraint.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PRC2XMLIfcRelationships.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="PRC2XML.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TinyXML\tinystr.h">
|
||||
<Filter>Header Files\TinyXML</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TinyXML\tinyxml.h">
|
||||
<Filter>Header Files\TinyXML</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
172
exchange/exchangesource/PRC2XML/PRC2XMLConstraint.cpp
Normal file
172
exchange/exchangesource/PRC2XML/PRC2XMLConstraint.cpp
Normal file
@@ -0,0 +1,172 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseConstraintType(EA3DConstraintType eType, _TiXmlElement* xml)
|
||||
{
|
||||
switch (eType)
|
||||
{
|
||||
default:
|
||||
case kA3DConstraintType_None: xml->SetAttribute("m_eType", "None"); break;
|
||||
case kA3DConstraintType_Set: xml->SetAttribute("m_eType", "Set"); break;
|
||||
case kA3DConstraintType_Fix: xml->SetAttribute("m_eType", "Fix"); break;
|
||||
case kA3DConstraintType_FixTogether: xml->SetAttribute("m_eType", "FixTogether"); break;
|
||||
case kA3DConstraintType_Contact: xml->SetAttribute("m_eType", "Contact"); break;
|
||||
case kA3DConstraintType_Distance: xml->SetAttribute("m_eType", "Distance"); break;
|
||||
case kA3DConstraintType_Angle: xml->SetAttribute("m_eType", "Angle"); break;
|
||||
case kA3DConstraintType_Perpendicular: xml->SetAttribute("m_eType", "Perpendicular"); break;
|
||||
case kA3DConstraintType_Parallel: xml->SetAttribute("m_eType", "Parallel"); break;
|
||||
};
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseConstraintLinkedItemType(EA3DConstraintLinkType eLinkType, _TiXmlElement* xml)
|
||||
{
|
||||
switch (eLinkType)
|
||||
{
|
||||
default:
|
||||
case kA3DConstraintLink_None: xml->SetAttribute("m_eType", "None"); break;
|
||||
case kA3DConstraintLink_Axis: xml->SetAttribute("m_eType", "Axis"); break;
|
||||
case kA3DConstraintLink_Center: xml->SetAttribute("m_eType", "Center"); break;
|
||||
};
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseConstraintStatus(EA3DConstraintStatus eStatus, _TiXmlElement* xml)
|
||||
{
|
||||
switch (eStatus)
|
||||
{
|
||||
case kA3DConstraintStatus_OK: xml->SetAttribute("m_eStatus", "OK"); break;
|
||||
case kA3DConstraintStatus_Disabled: xml->SetAttribute("m_eStatus", "Disable"); break;
|
||||
default:
|
||||
case kA3DConstraintStatus_Error: xml->SetAttribute("m_eStatus", "Error"); break;
|
||||
};
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static A3DVoid sttraverseSetNameAttribute(const A3DEntity* entity, _TiXmlElement* xmlnode)
|
||||
{
|
||||
A3DRootBaseData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseData, sData);
|
||||
if (A3DRootBaseGet(entity, &sData) == A3D_SUCCESS)
|
||||
{
|
||||
if (sData.m_pcName && sData.m_pcName[0] != '\0')
|
||||
xmlnode->SetAttribute("Name", sData.m_pcName);
|
||||
if (sData.m_uiPersistentId)
|
||||
xmlnode->SetAttribute("PersistentId", sData.m_uiPersistentId);
|
||||
A3DRootBaseGet(NULL, &sData);
|
||||
}
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static A3DVoid sttraverseMiscConstraintLinkedItem(const A3DMiscConstraintLinkedItem* pConstraintLinkedItem, _TiXmlElement* xmlfather)
|
||||
{
|
||||
|
||||
_TiXmlElement* xml = new _TiXmlElement("A3DMiscConstraintLinkedItem");
|
||||
A3DMiscConstraintLinkedItemData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMiscConstraintLinkedItemData, sData);
|
||||
|
||||
traverseSource(pConstraintLinkedItem, xml);
|
||||
|
||||
A3DInt32 iRet = A3DMiscConstraintLinkedItemGet(pConstraintLinkedItem, &sData);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseEntityReference((A3DMiscEntityReference*)pConstraintLinkedItem, xml);
|
||||
sttraverseConstraintLinkedItemType(sData.m_eType, xml);
|
||||
if (sData.m_pTargetProductOccurrence != NULL)
|
||||
_SetAttributePtr(xml, "m_pTargetProductOccurrence", (void*)sData.m_pTargetProductOccurrence);
|
||||
A3DMiscConstraintLinkedItemGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
xml->SetAttribute("error", iRet);
|
||||
|
||||
xmlfather->LinkEndChild(xml);
|
||||
}
|
||||
|
||||
const char* GetContactTypeEnumString(A3DUns32 uiContactType)
|
||||
{
|
||||
switch (uiContactType)
|
||||
{
|
||||
case 0: return "UNDEFINED";
|
||||
case 1: return "SURFACE";
|
||||
case 2: return "ANNULAR";
|
||||
case 3: return "LINE";
|
||||
case 4: return "POINT";
|
||||
};
|
||||
return "UNDEFINED";
|
||||
}
|
||||
|
||||
const char* GetOrientationEnumString(A3DUns32 uiOrientation)
|
||||
{
|
||||
switch (uiOrientation)
|
||||
{
|
||||
case 0: return "UNDEFINED";
|
||||
case 1: return "SAME";
|
||||
case 2: return "OPPOSITE";
|
||||
}
|
||||
return "UNDEFINED";
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseAdditionalData(A3DGenericTypeFieldData & sFielData, _TiXmlElement* a_pElement)
|
||||
{
|
||||
if (!sFielData.m_pacFieldName)
|
||||
a_pElement->SetAttribute("FieldName", "Missing");
|
||||
else
|
||||
{
|
||||
switch (sFielData.m_sData.m_eType)
|
||||
{
|
||||
case kA3DGenericTypeUns32:
|
||||
if (!strcmp(sFielData.m_pacFieldName, "ContactType"))
|
||||
a_pElement->SetAttribute(sFielData.m_pacFieldName, GetContactTypeEnumString(sFielData.m_sData.m_sValue.m_uiUns32));
|
||||
else if (!strcmp(sFielData.m_pacFieldName, "Orientation"))
|
||||
a_pElement->SetAttribute(sFielData.m_pacFieldName, GetOrientationEnumString(sFielData.m_sData.m_sValue.m_uiUns32));
|
||||
else
|
||||
a_pElement->SetAttribute(sFielData.m_pacFieldName, sFielData.m_sData.m_sValue.m_uiUns32);
|
||||
break;
|
||||
|
||||
default: a_pElement->SetAttribute(sFielData.m_pacFieldName, "NotImplementedType"); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseConstraint(const A3DAsmConstraint* pAsmConstraint, _TiXmlElement* xmlfather)
|
||||
{
|
||||
_TiXmlElement* xml = new _TiXmlElement("A3DAsmConstraint");
|
||||
sttraverseSetNameAttribute(pAsmConstraint, xml);
|
||||
|
||||
A3DAsmConstraintData sData;
|
||||
A3D_INITIALIZE_DATA(A3DAsmConstraintData, sData);
|
||||
if (A3DAsmConstraintGet(pAsmConstraint, &sData) == A3D_SUCCESS)
|
||||
{
|
||||
sttraverseConstraintType(sData.m_eType, xml);
|
||||
sttraverseConstraintStatus(sData.m_eStatus, xml);
|
||||
|
||||
A3DUns32 ui;
|
||||
for (ui = 0; ui < sData.m_uiAdditionalDataArraySize; ++ui)
|
||||
sttraverseAdditionalData(sData.m_pAdditionalDataArray[ui], xml);
|
||||
|
||||
for (ui = 0; ui < sData.m_uiSubConstraintsSize; ++ui)
|
||||
traverseConstraint(sData.m_ppSubConstraints[ui], xml);
|
||||
|
||||
for (ui = 0; ui < sData.m_uiConstrainedElementsSize; ++ui)
|
||||
sttraverseMiscConstraintLinkedItem(sData.m_ppConstrainedElements[ui], xml);
|
||||
|
||||
A3DAsmConstraintGet(NULL, &sData);
|
||||
}
|
||||
xmlfather->LinkEndChild(xml);
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
256
exchange/exchangesource/PRC2XML/PRC2XMLFeature.cpp
Normal file
256
exchange/exchangesource/PRC2XML/PRC2XMLFeature.cpp
Normal file
@@ -0,0 +1,256 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
static A3DVoid sttraverseSetNameAttribute(const A3DEntity* entity,
|
||||
_TiXmlElement* xmlnode)
|
||||
{
|
||||
{
|
||||
A3DRootBaseData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseData, sData);
|
||||
if (A3DRootBaseGet(entity, &sData) == A3D_SUCCESS)
|
||||
{
|
||||
if (sData.m_pcName && sData.m_pcName[0] != '\0')
|
||||
xmlnode->SetAttribute("Name", sData.m_pcName);
|
||||
if (sData.m_uiPersistentId)
|
||||
xmlnode->SetAttribute("PersistentId", sData.m_uiPersistentId);
|
||||
A3DRootBaseGet(NULL, &sData);
|
||||
}
|
||||
}
|
||||
{
|
||||
A3DRootBaseWithGraphicsData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseWithGraphicsData, sData);
|
||||
if (A3DRootBaseWithGraphicsGet(entity, &sData) == A3D_SUCCESS)
|
||||
{
|
||||
if (sData.m_pGraphics)
|
||||
{
|
||||
A3DGraphicsData sGraphicsData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphicsData, sGraphicsData);
|
||||
if (A3DGraphicsGet(sData.m_pGraphics, &sGraphicsData) == A3D_SUCCESS)
|
||||
{
|
||||
xmlnode->SetAttribute("Layer", sGraphicsData.m_uiLayerIndex);
|
||||
xmlnode->SetAttribute("Style", sGraphicsData.m_uiStyleIndex);
|
||||
xmlnode->SetAttribute("Behaviour", sGraphicsData.m_usBehaviour);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static A3DVoid sttraverseXmlText(const char* ac,
|
||||
_TiXmlElement* xmlfather)
|
||||
{
|
||||
if (ac[0] != '\0') {
|
||||
char acUTF8[2048];
|
||||
sprintf(acUTF8, "%s ", ac);
|
||||
_TiXmlText* xml = new _TiXmlText(acUTF8);
|
||||
xmlfather->LinkEndChild(xml);
|
||||
}
|
||||
}
|
||||
|
||||
static A3DVoid sttraverseXmlText(double d,
|
||||
_TiXmlElement* xmlfather)
|
||||
{
|
||||
char acUTF8[2048];
|
||||
sprintf(acUTF8, "%g", d);
|
||||
sttraverseXmlText(acUTF8, xmlfather);
|
||||
}
|
||||
|
||||
|
||||
static A3DVoid sttraverseFRMFeatureLinkedItem(const A3DFRMLinkedItem* pFeatureLinkedItem, _TiXmlElement* xmlfather)
|
||||
{
|
||||
|
||||
_TiXmlElement* xml = new _TiXmlElement("A3DFRMLinkedItem");
|
||||
A3DFRMLinkedItemData sData;
|
||||
A3D_INITIALIZE_DATA(A3DFRMLinkedItemData, sData);
|
||||
|
||||
traverseSource(pFeatureLinkedItem, xml);
|
||||
|
||||
A3DInt32 iRet = A3DFRMLinkedItemGet(pFeatureLinkedItem, &sData);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseEntityReference((A3DMiscEntityReference*)pFeatureLinkedItem, xml);
|
||||
xml->SetAttribute("m_eType", sData.m_eType);
|
||||
if (sData.m_pTargetProductOccurrence != NULL)
|
||||
_SetAttributePtr(xml, "m_pTargetProductOccurrence", (void*)sData.m_pTargetProductOccurrence);
|
||||
A3DFRMLinkedItemGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
xml->SetAttribute("error", iRet);
|
||||
|
||||
xmlfather->LinkEndChild(xml);
|
||||
}
|
||||
|
||||
static A3DVoid sttraverseFRMParameter(const A3DFRMParameter* pFeatParameter, _TiXmlElement* xmlfather);
|
||||
|
||||
static A3DVoid sttraverseFRMFeature(const A3DFRMFeature* pFeature, _TiXmlElement* xmlfather)
|
||||
|
||||
{
|
||||
_TiXmlElement* xml = new _TiXmlElement("A3DFRMFeature");
|
||||
sttraverseSetNameAttribute(pFeature, xml);
|
||||
xmlfather->LinkEndChild(xml);
|
||||
|
||||
A3DUTF8Char* pcFeatureType = NULL;
|
||||
A3DFRMFeatureGetTypeAsString(pFeature, &pcFeatureType);
|
||||
if(pcFeatureType)
|
||||
xml->SetAttribute("Type", pcFeatureType);
|
||||
|
||||
A3DFRMFeatureGetTypeAsString(nullptr, &pcFeatureType);
|
||||
|
||||
A3DFRMFeatureData sData;
|
||||
A3D_INITIALIZE_DATA(A3DFRMFeatureData, sData);
|
||||
A3DStatus iErr = A3DFRMFeatureGet(pFeature, &sData);
|
||||
if (iErr != A3D_SUCCESS)
|
||||
return ;
|
||||
char acName[30];
|
||||
|
||||
switch (sData.m_eDataType)
|
||||
{
|
||||
case kA3DFRMDataInteger:
|
||||
A3DFRMIntegerData sIntegerData;
|
||||
A3D_INITIALIZE_DATA(A3DFRMIntegerData, sIntegerData);
|
||||
A3DFRMIntegerDataGet(pFeature, &sIntegerData);
|
||||
for (A3DUns32 i = 0; i < sIntegerData.m_uiValuesSize; ++i)
|
||||
{
|
||||
sprintf_s(acName,sizeof(acName)-1, "value_%d", i);
|
||||
xml->SetAttribute(acName, sIntegerData.m_piValues[i]);
|
||||
}
|
||||
A3DFRMIntegerDataGet(NULL, &sIntegerData);
|
||||
break;
|
||||
case kA3DFRMDataDouble:
|
||||
A3DFRMDoubleData sDoubleData;
|
||||
A3D_INITIALIZE_DATA(A3DFRMDoubleData, sDoubleData);
|
||||
A3DFRMDoubleDataGet(pFeature, &sDoubleData);
|
||||
for (A3DUns32 i = 0; i < sDoubleData.m_uiValuesSize; ++i)
|
||||
{
|
||||
sprintf_s(acName, sizeof(acName) - 1, "value_%d", i);
|
||||
xml->SetDoubleAttribute(acName, sDoubleData.m_pdValues[i]);
|
||||
}
|
||||
A3DFRMDoubleDataGet(NULL, &sDoubleData);
|
||||
break;
|
||||
case kA3DFRMDataString:
|
||||
A3DFRMStringData sStringData;
|
||||
A3D_INITIALIZE_DATA(A3DFRMStringData, sStringData);
|
||||
A3DFRMStringDataGet(pFeature, &sStringData);
|
||||
for (A3DUns32 i = 0; i < sStringData.m_uiValuesSize; ++i)
|
||||
{
|
||||
sprintf(acName, "value_%d", i);
|
||||
if (sStringData.m_ppcValues[i] != NULL)
|
||||
xml->SetAttribute(acName, sStringData.m_ppcValues[i]);
|
||||
else
|
||||
xml->SetAttribute(acName, "");
|
||||
}
|
||||
A3DFRMStringDataGet(NULL, &sStringData);
|
||||
break;
|
||||
case kA3DFRMDataEnum:
|
||||
{
|
||||
A3DInt32 iEnumValue;
|
||||
A3DUTF8Char* pcValueAsString = NULL;
|
||||
A3DFRMEnumDataGet(pFeature, &iEnumValue, &pcValueAsString);
|
||||
if (pcValueAsString)
|
||||
xml->SetAttribute("Value", pcValueAsString);
|
||||
else
|
||||
xml->SetAttribute("Value", iEnumValue);
|
||||
A3DFRMEnumDataGet(NULL, &iEnumValue, &pcValueAsString);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (A3DUns32 ui = 0; ui<sData.m_uiConnectionSize; ui++)
|
||||
sttraverseFRMFeatureLinkedItem(sData.m_ppConnections[ui], xml);
|
||||
|
||||
for (A3DUns32 ui = 0; ui<sData.m_uiParametersSize; ui++)
|
||||
sttraverseFRMParameter(sData.m_ppParameters[ui], xml);
|
||||
|
||||
A3DFRMFeatureGet(NULL, &sData);
|
||||
|
||||
}
|
||||
|
||||
static A3DVoid sttraverseFRMParameter(const A3DFRMParameter* pParameter, _TiXmlElement* xmlfather)
|
||||
{
|
||||
_TiXmlElement* xml = new _TiXmlElement("A3DFRMParameter");
|
||||
sttraverseSetNameAttribute(pParameter, xml);
|
||||
xmlfather->LinkEndChild(xml);
|
||||
|
||||
A3DFRMParameterData sData;
|
||||
A3D_INITIALIZE_DATA(A3DFRMParameterData, sData);
|
||||
A3DStatus iErr = A3DFRMParameterGet(pParameter, &sData);
|
||||
if (iErr != A3D_SUCCESS)
|
||||
return;
|
||||
switch (sData.m_eType)
|
||||
{
|
||||
case kA3DParameterType_Information:
|
||||
{
|
||||
xml->SetAttribute("Type", "INFORMATION");
|
||||
break;
|
||||
}
|
||||
case kA3DParameterType_Type:
|
||||
{
|
||||
xml->SetAttribute("Type", "TYPE");
|
||||
break;
|
||||
}
|
||||
case kA3DParameterType_Specification:
|
||||
{
|
||||
xml->SetAttribute("Type", "SPECIFICATION");
|
||||
break;
|
||||
}
|
||||
case kA3DParameterType_FeatureDefinition:
|
||||
{
|
||||
xml->SetAttribute("Type", "FEATURE DEFINITION");
|
||||
break;
|
||||
}
|
||||
case kA3DParameterType_Definition:
|
||||
{
|
||||
xml->SetAttribute("Type", "DEFINITION");
|
||||
break;
|
||||
}
|
||||
case kA3DParameterType_Container:
|
||||
{
|
||||
xml->SetAttribute("Type", "CONTAINER");
|
||||
break;
|
||||
}
|
||||
case kA3DParameterType_ContainerInternal:
|
||||
{
|
||||
xml->SetAttribute("Type", "INTERNAL CONTAINER");
|
||||
break;
|
||||
}
|
||||
case kA3DParameterType_Data:
|
||||
{
|
||||
xml->SetAttribute("Type", "DATA");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
for (A3DUns32 ui = 0; ui<sData.m_uiFeatureSize; ui++)
|
||||
sttraverseFRMFeature(sData.m_ppFeatures[ui], xml);
|
||||
A3DFRMParameterGet(NULL, &sData);
|
||||
|
||||
}
|
||||
A3DVoid traverseFeatureTree(const A3DFRMTree* pFeatFeatureTree, _TiXmlElement* xmlfather)
|
||||
{
|
||||
_TiXmlElement* xml = new _TiXmlElement("A3DFRMTree");
|
||||
sttraverseSetNameAttribute(pFeatFeatureTree, xml);
|
||||
|
||||
A3DFRMTreeData sData;
|
||||
A3D_INITIALIZE_DATA(A3DFRMTreeData, sData);
|
||||
if (A3DFRMTreeGet(pFeatFeatureTree, &sData) == A3D_SUCCESS)
|
||||
{
|
||||
for (A3DUns32 ui = 0; ui<sData.m_uiParametersSize; ui++)
|
||||
sttraverseFRMParameter(sData.m_ppsParameters[ui], xml);
|
||||
A3DFRMTreeGet(NULL, &sData);
|
||||
}
|
||||
xmlfather->LinkEndChild(xml);
|
||||
}
|
||||
353
exchange/exchangesource/PRC2XML/PRC2XMLGeometryCrv.cpp
Normal file
353
exchange/exchangesource/PRC2XML/PRC2XMLGeometryCrv.cpp
Normal file
@@ -0,0 +1,353 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvLine(const A3DCrvLine* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DCrvLineData sData;
|
||||
A3D_INITIALIZE_DATA(A3DCrvLineData, sData);
|
||||
|
||||
_TiXmlElement* crv = new _TiXmlElement("A3DCrvLineData");
|
||||
traverseSource(pCrv, crv);
|
||||
|
||||
A3DInt32 iRet = A3DCrvLineGet(pCrv, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("m_bIs2D", (int)sData.m_bIs2D);
|
||||
traverseCartesianTransformationData(sData.m_sTrsf, crv);
|
||||
traverseParam(&sData.m_sParam, crv);
|
||||
A3DCrvLineGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
crv->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(crv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvCircle(const A3DCrvCircle* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DCrvCircleData sData;
|
||||
A3D_INITIALIZE_DATA(A3DCrvCircleData, sData);
|
||||
|
||||
_TiXmlElement* crv = new _TiXmlElement("A3DCrvCircleData");
|
||||
traverseSource(pCrv, crv);
|
||||
|
||||
A3DInt32 iRet = A3DCrvCircleGet(pCrv, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("m_bIs2D", (int)sData.m_bIs2D);
|
||||
traverseCartesianTransformationData(sData.m_sTrsf, crv);
|
||||
traverseParam(&sData.m_sParam, crv);
|
||||
_SetDoubleAttribute(crv,"m_dRadius", sData.m_dRadius);
|
||||
A3DCrvCircleGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
crv->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(crv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvEllipse(const A3DCrvEllipse* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DCrvEllipseData sData;
|
||||
A3D_INITIALIZE_DATA(A3DCrvEllipseData, sData);
|
||||
|
||||
_TiXmlElement* crv = new _TiXmlElement("A3DCrvEllipseData");
|
||||
traverseSource(pCrv, crv);
|
||||
|
||||
A3DInt32 iRet = A3DCrvEllipseGet(pCrv, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("m_bIs2D", (int)sData.m_bIs2D);
|
||||
traverseCartesianTransformationData(sData.m_sTrsf, crv);
|
||||
traverseParam(&sData.m_sParam, crv);
|
||||
_SetDoubleAttribute(crv,"m_dXRadius", sData.m_dXRadius);
|
||||
_SetDoubleAttribute(crv,"m_dYRadius", sData.m_dYRadius);
|
||||
A3DCrvEllipseGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
crv->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(crv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvParabola(const A3DCrvParabola* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DCrvParabolaData sData;
|
||||
A3D_INITIALIZE_DATA(A3DCrvParabolaData, sData);
|
||||
|
||||
_TiXmlElement* crv = new _TiXmlElement("A3DCrvParabolaData");
|
||||
traverseSource(pCrv, crv);
|
||||
|
||||
A3DInt32 iRet = A3DCrvParabolaGet(pCrv, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("m_bIs2D", (int)sData.m_bIs2D);
|
||||
traverseCartesianTransformationData(sData.m_sTrsf, crv);
|
||||
traverseParam(&sData.m_sParam, crv);
|
||||
_SetDoubleAttribute(crv,"m_dFocal", sData.m_dFocal);
|
||||
crv->SetAttribute("m_cParamType", (int) sData.m_cParamType);
|
||||
A3DCrvParabolaGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
crv->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(crv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvHyperbola(const A3DCrvHyperbola* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DCrvHyperbolaData sData;
|
||||
A3D_INITIALIZE_DATA(A3DCrvHyperbolaData, sData);
|
||||
|
||||
_TiXmlElement* crv = new _TiXmlElement("A3DCrvHyperbolaData");
|
||||
traverseSource(pCrv, crv);
|
||||
|
||||
A3DInt32 iRet = A3DCrvHyperbolaGet(pCrv, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("m_bIs2D", (int)sData.m_bIs2D);
|
||||
traverseCartesianTransformationData(sData.m_sTrsf, crv);
|
||||
traverseParam(&sData.m_sParam, crv);
|
||||
_SetDoubleAttribute(crv,"m_dSemiAxis", sData.m_dSemiAxis);
|
||||
_SetDoubleAttribute(crv,"m_dSemiImageAxis", sData.m_dSemiImageAxis);
|
||||
crv->SetAttribute("m_cParamType", (int) sData.m_cParamType);
|
||||
A3DCrvHyperbolaGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
crv->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(crv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvHelix(const A3DCrvHelix* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DCrvHelixData sData;
|
||||
A3D_INITIALIZE_DATA(A3DCrvHelixData, sData);
|
||||
|
||||
_TiXmlElement* crv = new _TiXmlElement("A3DCrvHelixData");
|
||||
traverseSource(pCrv, crv);
|
||||
|
||||
A3DInt32 iRet = A3DCrvHelixGet(pCrv, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("m_bIs2D", (int)sData.m_bIs2D);
|
||||
A3DCrvHelixGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
crv->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(crv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvPolyLine(const A3DCrvPolyLine* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DCrvPolyLineData sData;
|
||||
A3D_INITIALIZE_DATA(A3DCrvPolyLineData, sData);
|
||||
|
||||
_TiXmlElement* crv = new _TiXmlElement("A3DCrvPolyLineData");
|
||||
traverseSource(pCrv, crv);
|
||||
|
||||
A3DInt32 iRet = A3DCrvPolyLineGet(pCrv, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("m_bIs2D", (int)sData.m_bIs2D);
|
||||
traverseCartesianTransformationData(sData.m_sTrsf, crv);
|
||||
traverseParam(&sData.m_sParam, crv);
|
||||
traversePoints("m_pPts", sData.m_uiSize, sData.m_pPts, crv);
|
||||
|
||||
A3DCrvPolyLineGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
crv->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(crv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvComposite(const A3DCrvComposite* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DCrvCompositeData sData;
|
||||
A3D_INITIALIZE_DATA(A3DCrvCompositeData, sData);
|
||||
|
||||
_TiXmlElement* crv = new _TiXmlElement("A3DCrvCompositeData");
|
||||
traverseSource(pCrv, crv);
|
||||
|
||||
A3DInt32 iRet = A3DCrvCompositeGet(pCrv, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("m_bIs2D", (int)sData.m_bIs2D);
|
||||
traverseCartesianTransformationData(sData.m_sTrsf, crv);
|
||||
traverseParam(&sData.m_sParam, crv);
|
||||
crv->SetAttribute("m_bClosed", (int) sData.m_bClosed);
|
||||
traverseBools("m_pbSenses", sData.m_uiSize, sData.m_pbSenses, crv);
|
||||
|
||||
A3DUns32 ui, uiSize = sData.m_uiSize;
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
traverseCurve(sData.m_ppCurves[ui], crv);
|
||||
|
||||
A3DCrvCompositeGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
crv->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(crv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvNurbsData(const A3DCrvNurbsData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
setting->SetAttribute("m_bIs2D", (int) sData.m_bIs2D);
|
||||
setting->SetAttribute("m_bRational", (int) sData.m_bRational);
|
||||
setting->SetAttribute("m_eKnotType", (int) sData.m_eKnotType);
|
||||
setting->SetAttribute("m_eCurveForm", (int) sData.m_eCurveForm);
|
||||
setting->SetAttribute("m_uiDegree", (int) sData.m_uiDegree);
|
||||
traverseDoubles("m_pdKnots",sData.m_uiKnotSize, sData.m_pdKnots, setting);
|
||||
traversePoints("m_pCtrlPts",sData.m_uiCtrlSize, sData.m_pCtrlPts, setting);
|
||||
|
||||
if(sData.m_bRational)
|
||||
traverseDoubles("m_pdWeights", sData.m_uiWeightSize, sData.m_pdWeights, setting);
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvNurbs(const A3DCrvNurbs* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DCrvNurbsData sData;
|
||||
A3D_INITIALIZE_DATA(A3DCrvNurbsData, sData);
|
||||
|
||||
_TiXmlElement* crv = new _TiXmlElement("A3DCrvNurbsData");
|
||||
traverseSource(pCrv, crv);
|
||||
|
||||
A3DInt32 iRet = A3DCrvNurbsGet(pCrv, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
sttraverseCrvNurbsData(sData, crv);
|
||||
CHECK_RET(A3DCrvNurbsGet(NULL, &sData));
|
||||
}
|
||||
else
|
||||
{
|
||||
crv->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(crv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCrvAsNurbs(const A3DCrvBase* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DCrvNurbsData sData;
|
||||
A3D_INITIALIZE_DATA(A3DCrvNurbsData, sData);
|
||||
|
||||
A3DDouble dTolerance=1e-3;
|
||||
A3DInt32 iRet = A3DCrvBaseGetAsNurbs(pCrv, dTolerance, true, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
sttraverseCrvNurbsData(sData, setting);
|
||||
CHECK_RET(A3DCrvNurbsGet(NULL, &sData));
|
||||
}
|
||||
else
|
||||
{
|
||||
setting->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseCurve(const A3DCrvBase* pCrv, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* crv = new _TiXmlElement("A3DCrvBase");
|
||||
traverseSource(pCrv, crv);
|
||||
|
||||
A3DEEntityType eType;
|
||||
A3DInt32 iRet = A3DEntityGetType(pCrv,&eType);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
switch(eType)
|
||||
{
|
||||
case kA3DTypeCrvNurbs:
|
||||
iRet = sttraverseCrvNurbs(pCrv, crv);
|
||||
break;
|
||||
case kA3DTypeCrvLine:
|
||||
iRet = sttraverseCrvLine(pCrv, crv);
|
||||
break;
|
||||
case kA3DTypeCrvCircle:
|
||||
iRet = sttraverseCrvCircle(pCrv, crv);
|
||||
break;
|
||||
case kA3DTypeCrvEllipse:
|
||||
iRet = sttraverseCrvEllipse(pCrv, crv);
|
||||
break;
|
||||
case kA3DTypeCrvParabola:
|
||||
iRet = sttraverseCrvParabola(pCrv, crv);
|
||||
break;
|
||||
case kA3DTypeCrvHyperbola:
|
||||
iRet = sttraverseCrvHyperbola(pCrv, crv);
|
||||
break;
|
||||
case kA3DTypeCrvHelix:
|
||||
iRet = sttraverseCrvHelix(pCrv, crv);
|
||||
break;
|
||||
case kA3DTypeCrvPolyLine:
|
||||
iRet = sttraverseCrvPolyLine(pCrv, crv);
|
||||
break;
|
||||
case kA3DTypeCrvComposite:
|
||||
iRet = sttraverseCrvComposite(pCrv, crv);
|
||||
break;
|
||||
default:
|
||||
iRet = sttraverseCrvAsNurbs(pCrv, crv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
A3DIntervalData oInterval;
|
||||
A3D_INITIALIZE_DATA(A3DIntervalData, oInterval);
|
||||
A3DCrvGetInterval(pCrv, &oInterval);
|
||||
_SetDoubleAttribute(crv, "m_dMin", oInterval.m_dMin);
|
||||
_SetDoubleAttribute(crv, "m_dMax", oInterval.m_dMax);
|
||||
|
||||
setting->LinkEndChild(crv);
|
||||
return iRet;
|
||||
}
|
||||
142
exchange/exchangesource/PRC2XML/PRC2XMLGeometrySrf.cpp
Normal file
142
exchange/exchangesource/PRC2XML/PRC2XMLGeometrySrf.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseSrfNurbsData(const A3DSurfNurbsData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
setting->SetAttribute("m_eKnotType", (int) sData.m_eKnotType);
|
||||
setting->SetAttribute("m_eSurfaceForm", (int) sData.m_eSurfaceForm);
|
||||
setting->SetAttribute("m_uiUDegree", (int) sData.m_uiUDegree);
|
||||
setting->SetAttribute("m_uiVDegree", (int) sData.m_uiVDegree);
|
||||
|
||||
traverseDoubles("m_pdUKnots", sData.m_uiUKnotSize, sData.m_pdUKnots, setting);
|
||||
traverseDoubles("m_pdVKnots", sData.m_uiVKnotSize, sData.m_pdVKnots, setting);
|
||||
traversePoints("m_pCtrlPts", sData.m_uiUCtrlSize*sData.m_uiVCtrlSize, sData.m_pCtrlPts, setting);
|
||||
|
||||
if(sData.m_pdWeights)
|
||||
traverseDoubles("m_pdWeights", sData.m_uiUCtrlSize*sData.m_uiVCtrlSize, sData.m_pdWeights, setting);
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseSrfNurbs(const A3DSurfNurbs* pSrf, _TiXmlElement* setting)
|
||||
{
|
||||
A3DSurfNurbsData sData;
|
||||
A3D_INITIALIZE_DATA(A3DSurfNurbsData, sData);
|
||||
|
||||
_TiXmlElement* srf = new _TiXmlElement("A3DSurfNurbsData");
|
||||
traverseSource(pSrf, srf);
|
||||
|
||||
A3DInt32 iRet = A3DSurfNurbsGet(pSrf, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
sttraverseSrfNurbsData(sData, srf);
|
||||
CHECK_RET(A3DSurfNurbsGet(NULL, &sData));
|
||||
}
|
||||
else
|
||||
{
|
||||
srf->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(srf);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseSrfAsNurbs(const A3DSurfBase* pSrf, _TiXmlElement* setting)
|
||||
{
|
||||
A3DSurfNurbsData sData;
|
||||
A3D_INITIALIZE_DATA(A3DSurfNurbsData, sData);
|
||||
|
||||
A3DDouble dTolerance = 1e-3;
|
||||
A3DInt32 iRet = A3DSurfBaseGetAsNurbs(pSrf,dTolerance, false, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
sttraverseSrfNurbsData(sData, setting);
|
||||
CHECK_RET(A3DSurfNurbsGet(NULL, &sData));
|
||||
}
|
||||
else
|
||||
{
|
||||
setting->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseSrfPlane(const A3DSurfPlane* pSrf, _TiXmlElement* setting)
|
||||
{
|
||||
A3DSurfPlaneData sData;
|
||||
A3D_INITIALIZE_DATA(A3DSurfPlaneData, sData);
|
||||
|
||||
_TiXmlElement* srf = new _TiXmlElement("A3DSurfPlaneData");
|
||||
traverseSource(pSrf, srf);
|
||||
|
||||
A3DInt32 iRet = A3DSurfPlaneGet(pSrf, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseCartesianTransformationData(sData.m_sTrsf, srf);
|
||||
traverseUVParam(&sData.m_sParam, srf);
|
||||
|
||||
CHECK_RET(A3DSurfPlaneGet(NULL, &sData));
|
||||
}
|
||||
else
|
||||
{
|
||||
srf->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(srf);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseSurface(const A3DSurfBase* pSrf, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* srf = new _TiXmlElement("A3DSurfBase");
|
||||
traverseSource(pSrf, srf);
|
||||
|
||||
A3DEEntityType eType;
|
||||
A3DInt32 iRet = A3DEntityGetType(pSrf, &eType);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
switch(eType)
|
||||
{
|
||||
case kA3DTypeSurfNurbs:
|
||||
iRet = sttraverseSrfNurbs(pSrf, srf);
|
||||
break;
|
||||
case kA3DTypeSurfPlane:
|
||||
iRet = traverseSrfPlane(pSrf, srf);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(iRet == A3D_NOT_IMPLEMENTED)
|
||||
iRet = sttraverseSrfAsNurbs(pSrf, srf);
|
||||
|
||||
A3DDomainData oDomain;
|
||||
A3D_INITIALIZE_DATA(A3DDomainData, oDomain);
|
||||
CHECK_RET(A3DSurfGetDomain(pSrf, &oDomain));
|
||||
_SetDoubleAttribute(srf, "m_sMin.m_dX", oDomain.m_sMin.m_dX);
|
||||
_SetDoubleAttribute(srf, "m_sMin.m_dY", oDomain.m_sMin.m_dY);
|
||||
_SetDoubleAttribute(srf, "m_sMax.m_dX", oDomain.m_sMax.m_dX);
|
||||
_SetDoubleAttribute(srf, "m_sMax.m_dY", oDomain.m_sMax.m_dY);
|
||||
|
||||
setting->LinkEndChild(srf);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
407
exchange/exchangesource/PRC2XML/PRC2XMLGlobal.cpp
Normal file
407
exchange/exchangesource/PRC2XML/PRC2XMLGlobal.cpp
Normal file
@@ -0,0 +1,407 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
int traverseUnit(A3DMiscAttributeUnit* const pUnit, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DMiscAttributeUnitData sDataUnit;
|
||||
A3D_INITIALIZE_DATA(A3DMiscAttributeUnitData, sDataUnit);
|
||||
|
||||
_TiXmlElement* unit = new _TiXmlElement("A3DMiscAttributeUnit");
|
||||
|
||||
CHECK_RET(A3DGlobalGetUnitData(pUnit, &sDataUnit));
|
||||
|
||||
if (sDataUnit.m_pcName && sDataUnit.m_pcName[0] != '\0')
|
||||
unit->SetAttribute("m_pcName", sDataUnit.m_pcName);
|
||||
|
||||
for (auto uj = 0u; uj < sDataUnit.m_uiBasicUnitSize; uj++)
|
||||
{
|
||||
_TiXmlElement* basicunit = new _TiXmlElement("A3DMiscAttributeBasicUnit");
|
||||
basicunit->SetAttribute("m_eUnit", (int)sDataUnit.m_ppBasicUnits[uj]->m_eUnit);
|
||||
basicunit->SetAttribute("m_iExponent", (int)sDataUnit.m_ppBasicUnits[uj]->m_iExponent);
|
||||
basicunit->SetAttribute("m_dFactor", (int)sDataUnit.m_ppBasicUnits[uj]->m_dFactor);
|
||||
unit->LinkEndChild(basicunit);
|
||||
}
|
||||
A3DGlobalGetUnitData(NULL, &sDataUnit);
|
||||
|
||||
setting->LinkEndChild(unit);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDottingPattern(const A3DGraphDottingPatternData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
_TiXmlElement* pattern = new _TiXmlElement("A3DGraphDottingPatternData");
|
||||
|
||||
_SetDoubleAttribute(pattern, "m_dPitch", (double) sData.m_dPitch);
|
||||
pattern->SetAttribute("m_bZigZag", (int) sData.m_bZigZag);
|
||||
pattern->SetAttribute("m_uiColorIndex", (int) sData.m_uiColorIndex);
|
||||
pattern->SetAttribute("m_uiNextPatternIndex", (int) sData.m_uiNextPatternIndex);
|
||||
|
||||
setting->LinkEndChild(pattern);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseHatchingPattern(const A3DGraphHatchingPatternData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
_TiXmlElement *pattern= new _TiXmlElement("A3DGraphHatchingPatternData");
|
||||
|
||||
A3DUns32 ui, uiSize = sData.m_uiSize;
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
_TiXmlElement* hatchline = new _TiXmlElement("A3DGraphHatchingPatternLineData");
|
||||
_SetDoubleAttribute(hatchline, "m_dAngle", (double) sData.m_psHatchLines[ui].m_dAngle);
|
||||
hatchline->SetAttribute("m_uiStyleIndex", (int) sData.m_psHatchLines[ui].m_uiStyleIndex);
|
||||
traversePoint2d("m_sStart" , sData.m_psHatchLines[ui].m_sStart, hatchline);
|
||||
traversePoint2d("m_sOffset", sData.m_psHatchLines[ui].m_sOffset, hatchline);
|
||||
pattern->LinkEndChild(hatchline);
|
||||
}
|
||||
pattern->SetAttribute("m_uiNextPatternIndex", (int) sData.m_uiNextPatternIndex);
|
||||
|
||||
setting->LinkEndChild(pattern);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseSolidPattern(const A3DGraphSolidPatternData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
_TiXmlElement* pattern = new _TiXmlElement("A3DGraphSolidPatternData");
|
||||
|
||||
pattern->SetAttribute("m_bMaterial", (int) sData.m_bMaterial);
|
||||
pattern->SetAttribute("m_uiRgbColorIndex", (int) sData.m_uiRgbColorIndex);
|
||||
pattern->SetAttribute("m_uiNextPatternIndex", (int) sData.m_uiNextPatternIndex);
|
||||
|
||||
setting->LinkEndChild(pattern);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseVPicturePattern(const A3DGraphVPicturePatternData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
_TiXmlElement* pattern = new _TiXmlElement("A3DGraphVPicturePatternData");
|
||||
pattern->SetAttribute("m_uiNextPatternIndex", (int) sData.m_uiNextPatternIndex);
|
||||
|
||||
traverseMarkupTess(sData.m_pMarkupTess, pattern);
|
||||
|
||||
setting->LinkEndChild(pattern);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
//static bool stMakeFileWithBinarydata(A3DUns32 uiSize, A3DUns8* const pucBinaryData, const A3DUTF8Char* psFileName)
|
||||
//{
|
||||
// FILE* psFile = fopen(psFileName, "wb");
|
||||
// if(psFile != NULL)
|
||||
// {
|
||||
// int iFileSize = uiSize;
|
||||
// fwrite(pucBinaryData, sizeof(char), size_t(iFileSize), psFile);
|
||||
// fclose(psFile);
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//######################################################################################################################
|
||||
int traversePicture(const A3DGraphPictureData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
_TiXmlElement* picture = new _TiXmlElement("A3DGraphPictureData");
|
||||
|
||||
picture->SetAttribute("m_eFormat", (int) sData.m_eFormat);
|
||||
picture->SetAttribute("m_uiPixelWidth", (int) sData.m_uiPixelWidth);
|
||||
picture->SetAttribute("m_uiPixelHeight", (int) sData.m_uiPixelHeight);
|
||||
//stMakeFileWithBinarydata(sData.m_uiSize,sData.m_pucBinaryData,"myfilename");
|
||||
|
||||
setting->LinkEndChild(picture);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMaterial(const A3DGraphMaterialData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
_TiXmlElement* material = new _TiXmlElement("A3DGraphMaterialData");
|
||||
|
||||
_SetDoubleAttribute(material, "m_dAmbientAlpha", sData.m_dAmbientAlpha);
|
||||
_SetDoubleAttribute(material, "m_dDiffuseAlpha", sData.m_dDiffuseAlpha);
|
||||
_SetDoubleAttribute(material, "m_dEmissiveAlpha", sData.m_dEmissiveAlpha);
|
||||
_SetDoubleAttribute(material, "m_dSpecularAlpha", sData.m_dSpecularAlpha);
|
||||
_SetDoubleAttribute(material, "m_dShininess", sData.m_dShininess);
|
||||
|
||||
material->SetAttribute("m_uiAmbient", (int) sData.m_uiAmbient);
|
||||
material->SetAttribute("m_uiDiffuse", (int) sData.m_uiDiffuse);
|
||||
material->SetAttribute("m_uiEmissive", (int) sData.m_uiEmissive);
|
||||
material->SetAttribute("m_uiSpecular", (int) sData.m_uiSpecular);
|
||||
|
||||
setting->LinkEndChild(material);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseLinePattern(const A3DGraphLinePatternData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
_TiXmlElement* linepattern = new _TiXmlElement("A3DGraphLinePatternData");
|
||||
traverseDoubles("m_pdLengths", sData.m_uiNumberOfLengths, sData.m_pdLengths, linepattern);
|
||||
_SetDoubleAttribute(linepattern, "m_dPhase", sData.m_dPhase);
|
||||
linepattern->SetAttribute("m_bRealLength", (int) sData.m_bRealLength);
|
||||
|
||||
setting->LinkEndChild(linepattern);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseStyle(const A3DGraphStyleData& sStyleData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
_TiXmlElement* style = new _TiXmlElement("A3DGraphStyleData");
|
||||
|
||||
style->SetAttribute("m_bMaterial", (int) sStyleData.m_bMaterial);
|
||||
style->SetAttribute("m_uiRgbColorIndex", (int) sStyleData.m_uiRgbColorIndex);
|
||||
style->SetAttribute("m_bVPicture", (int) sStyleData.m_bVPicture);
|
||||
style->SetAttribute("m_uiLinePatternIndex", (int) sStyleData.m_uiLinePatternIndex);
|
||||
|
||||
if(sStyleData.m_bIsTransparencyDefined)
|
||||
style->SetAttribute("m_ucTransparency", (int) sStyleData.m_ucTransparency);
|
||||
|
||||
_SetDoubleAttribute(style, "m_dWidth", sStyleData.m_dWidth);
|
||||
|
||||
style->SetAttribute("m_bSpecialCulling", (int)sStyleData.m_bSpecialCulling);
|
||||
style->SetAttribute("m_bFrontCulling", (int)sStyleData.m_bFrontCulling);
|
||||
style->SetAttribute("m_bBackCulling", (int)sStyleData.m_bBackCulling);
|
||||
style->SetAttribute("m_bNoLight", (int)sStyleData.m_bNoLight);
|
||||
style->SetAttribute("m_eRenderingMode", (int)sStyleData.m_eRenderingMode);
|
||||
|
||||
setting->LinkEndChild(style);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseGlobal(const A3DGlobal* pGlobal, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DGlobalData sData;
|
||||
A3D_INITIALIZE_DATA(A3DGlobalData, sData);
|
||||
|
||||
_TiXmlElement* global = new _TiXmlElement("A3DGlobalData");
|
||||
|
||||
iRet = A3DGlobalGet(pGlobal, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
int traverseBase(const A3DEntity* pEntity, _TiXmlElement* setting);
|
||||
A3DUns32 ui, uiSize = sData.m_uiColorsSize;
|
||||
if(uiSize)
|
||||
{
|
||||
A3DGraphRgbColorData sColorData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphRgbColorData, sColorData);
|
||||
A3DDouble* pdAllColors = (A3DDouble*) malloc(size_t(uiSize) * 3 * sizeof(A3DDouble));
|
||||
if (pdAllColors)
|
||||
{
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
CHECK_RET(A3DGlobalGetGraphRgbColorData(ui*3, &sColorData));
|
||||
pdAllColors[3*ui] = sColorData.m_dRed;
|
||||
pdAllColors[3*ui+1] = sColorData.m_dGreen;
|
||||
pdAllColors[3*ui+2] = sColorData.m_dBlue;
|
||||
}
|
||||
traverseDoubles("Colors", uiSize*3, pdAllColors, global);
|
||||
free(pdAllColors);
|
||||
}
|
||||
}
|
||||
|
||||
if(sData.m_uiStylesSize)
|
||||
{
|
||||
uiSize = sData.m_uiStylesSize;
|
||||
A3DGraphStyleData sStyleData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphStyleData, sStyleData);
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
CHECK_RET(A3DGlobalGetGraphStyleData(ui, &sStyleData));
|
||||
traverseStyle(sStyleData, global);
|
||||
A3DGlobalGetGraphStyleData(A3D_DEFAULT_STYLE_INDEX, &sStyleData);
|
||||
}
|
||||
}
|
||||
|
||||
if(sData.m_uiLinePatternsSize)
|
||||
{
|
||||
uiSize = sData.m_uiLinePatternsSize;
|
||||
A3DGraphLinePatternData sLinePatternData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphLinePatternData, sLinePatternData);
|
||||
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
CHECK_RET(A3DGlobalGetGraphLinePatternData(ui, &sLinePatternData));
|
||||
traverseLinePattern(sLinePatternData, global);
|
||||
A3DGlobalGetGraphLinePatternData(A3D_DEFAULT_LINEPATTERN_INDEX, &sLinePatternData);
|
||||
}
|
||||
}
|
||||
|
||||
if(sData.m_uiMaterialsSize)
|
||||
{
|
||||
uiSize= sData.m_uiMaterialsSize;
|
||||
|
||||
A3DBool bIsTexture;
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
CHECK_RET(A3DGlobalIsMaterialTexture(ui, &bIsTexture));
|
||||
|
||||
if(bIsTexture)
|
||||
{
|
||||
A3DGraphTextureApplicationData sTextureApplicationData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphTextureApplicationData, sTextureApplicationData);
|
||||
CHECK_RET(A3DGlobalGetGraphTextureApplicationData(ui, &sTextureApplicationData));
|
||||
traverseTextureApplication(sTextureApplicationData, global);
|
||||
A3DGlobalGetGraphTextureApplicationData(A3D_DEFAULT_MATERIAL_INDEX, &sTextureApplicationData);
|
||||
}
|
||||
else
|
||||
{
|
||||
_TiXmlElement* material = new _TiXmlElement("A3DGraphMaterial");
|
||||
material->SetAttribute("index", ui);
|
||||
|
||||
A3DEntity* pMaterial = NULL;
|
||||
CHECK_RET(A3DMiscPointerFromIndexGet(ui, kA3DTypeGraphMaterial, &pMaterial))
|
||||
if (pMaterial)
|
||||
traverseBase(pMaterial, material);
|
||||
|
||||
A3DGraphMaterialData sMaterialData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphMaterialData, sMaterialData);
|
||||
CHECK_RET(A3DGlobalGetGraphMaterialData(ui, &sMaterialData));
|
||||
traverseMaterial(sMaterialData, material);
|
||||
A3DGlobalGetGraphMaterialData(A3D_DEFAULT_MATERIAL_INDEX, &sMaterialData);
|
||||
|
||||
global->LinkEndChild(material);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(sData.m_uiTextureDefinitionsSize)
|
||||
{
|
||||
uiSize = sData.m_uiTextureDefinitionsSize;
|
||||
A3DGraphTextureDefinitionData sTextureDefinitionData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphTextureDefinitionData, sTextureDefinitionData);
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
CHECK_RET(A3DGlobalGetGraphTextureDefinitionData(ui, &sTextureDefinitionData));
|
||||
traverseTextureDefinition(sTextureDefinitionData, global);
|
||||
A3DGlobalGetGraphTextureDefinitionData(A3D_DEFAULT_TEXTURE_DEFINITION_INDEX, &sTextureDefinitionData);
|
||||
}
|
||||
}
|
||||
|
||||
if(sData.m_uiPicturesSize)
|
||||
{
|
||||
uiSize = sData.m_uiPicturesSize;
|
||||
A3DGraphPictureData sPictureData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphPictureData, sPictureData);
|
||||
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
_TiXmlElement* picture = new _TiXmlElement("A3DGraphPicture");
|
||||
picture->SetAttribute("index", ui);
|
||||
|
||||
A3DEntity* pPicture = NULL;
|
||||
CHECK_RET(A3DMiscPointerFromIndexGet(ui, kA3DTypeGraphPicture, &pPicture))
|
||||
if (pPicture)
|
||||
traverseBase(pPicture, picture);
|
||||
|
||||
CHECK_RET(A3DGlobalGetGraphPictureData(ui, &sPictureData));
|
||||
traversePicture(sPictureData, picture);
|
||||
A3DGlobalGetGraphPictureData(A3D_DEFAULT_MATERIAL_INDEX, &sPictureData);
|
||||
|
||||
global->LinkEndChild(picture);
|
||||
}
|
||||
}
|
||||
|
||||
if(sData.m_uiFillPatternsSize)
|
||||
{
|
||||
uiSize = sData.m_uiFillPatternsSize;
|
||||
A3DEEntityType ePatternType;
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
CHECK_RET(A3DGlobalGetFillPatternType(ui, &ePatternType));
|
||||
|
||||
switch(ePatternType)
|
||||
{
|
||||
case kA3DTypeGraphHatchingPattern:
|
||||
A3DGraphHatchingPatternData sHatchingPatternData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphHatchingPatternData, sHatchingPatternData);
|
||||
CHECK_RET(A3DGlobalGetGraphHatchingPatternData(ui, &sHatchingPatternData));
|
||||
iRet = traverseHatchingPattern(sHatchingPatternData, global);
|
||||
A3DGlobalGetGraphHatchingPatternData(A3D_DEFAULT_PATTERN_INDEX, &sHatchingPatternData);
|
||||
break;
|
||||
|
||||
case kA3DTypeGraphSolidPattern:
|
||||
A3DGraphSolidPatternData sSolidPatternData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphSolidPatternData, sSolidPatternData);
|
||||
CHECK_RET(A3DGlobalGetGraphSolidPatternData(ui, &sSolidPatternData));
|
||||
iRet = traverseSolidPattern(sSolidPatternData, global);
|
||||
A3DGlobalGetGraphSolidPatternData(A3D_DEFAULT_PATTERN_INDEX, &sSolidPatternData);
|
||||
break;
|
||||
|
||||
case kA3DTypeGraphDottingPattern:
|
||||
A3DGraphDottingPatternData sDottingPatternData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphDottingPatternData, sDottingPatternData);
|
||||
CHECK_RET(A3DGlobalGetGraphDottingPatternData(ui, &sDottingPatternData));
|
||||
iRet = traverseDottingPattern(sDottingPatternData, global);
|
||||
A3DGlobalGetGraphDottingPatternData(A3D_DEFAULT_PATTERN_INDEX, &sDottingPatternData);
|
||||
break;
|
||||
|
||||
case kA3DTypeGraphVPicturePattern:
|
||||
A3DGraphVPicturePatternData sVPicturePatternData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphVPicturePatternData, sVPicturePatternData);
|
||||
CHECK_RET(A3DGlobalGetGraphVPicturePatternData(ui, &sVPicturePatternData));
|
||||
iRet = traverseVPicturePattern(sVPicturePatternData, global);
|
||||
A3DGlobalGetGraphVPicturePatternData(A3D_DEFAULT_PATTERN_INDEX, &sVPicturePatternData);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sData.m_uiUnitsSize)
|
||||
{
|
||||
uiSize = sData.m_uiUnitsSize;
|
||||
|
||||
for (ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
A3DMiscAttributeUnit *pUnit = nullptr;
|
||||
CHECK_RET(A3DGlobalGetUnit(ui, &pUnit));
|
||||
|
||||
traverseUnit(pUnit, global);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
global->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(global);
|
||||
return iRet;
|
||||
}
|
||||
215
exchange/exchangesource/PRC2XML/PRC2XMLIfcRelationships.cpp
Normal file
215
exchange/exchangesource/PRC2XML/PRC2XMLIfcRelationships.cpp
Normal file
@@ -0,0 +1,215 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
void sttraverseIFCRootEntity(A3DBIMRoot* pRoot, _TiXmlElement* element)
|
||||
{
|
||||
A3DBIMRootData sData;
|
||||
A3D_INITIALIZE_DATA(A3DBIMRootData, sData);
|
||||
A3DInt32 iRet = A3DBIMRootGet(pRoot, &sData);
|
||||
_TiXmlElement* root = new _TiXmlElement(sData.m_pcIfcClassName ? sData.m_pcIfcClassName : "Element");
|
||||
element->LinkEndChild(root);
|
||||
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
if (sData.m_pcGUID)
|
||||
root->SetAttribute("global_id", sData.m_pcGUID);
|
||||
else
|
||||
root->SetAttribute("global_id", "error");
|
||||
if (sData.m_pcName)
|
||||
root->SetAttribute("name", sData.m_pcName);
|
||||
if (sData.m_pcDescription)
|
||||
root->SetAttribute("description", sData.m_pcDescription);
|
||||
if (sData.m_pEntityReference)
|
||||
{
|
||||
_TiXmlElement* entity = new _TiXmlElement("Corresponding_A3D");
|
||||
root->LinkEndChild(entity);
|
||||
traverseEntityReference(sData.m_pEntityReference, entity);
|
||||
}
|
||||
else
|
||||
root->SetAttribute("Corresponding_A3D", "error");
|
||||
iRet = A3DBIMRootGet(nullptr, &sData);
|
||||
}
|
||||
}
|
||||
|
||||
//**********************************************************************************************************************
|
||||
|
||||
void dumpRelationship(A3DBIMRoot* pRelating, A3DUns32 uiRelatedElementSize, A3DBIMRoot** ppRelatedElements, _TiXmlElement* rel)
|
||||
{
|
||||
if (rel == nullptr)
|
||||
return;
|
||||
_TiXmlElement* relating = new _TiXmlElement("Relating");
|
||||
rel->LinkEndChild(relating);
|
||||
if (pRelating)
|
||||
sttraverseIFCRootEntity(pRelating, relating);
|
||||
else
|
||||
relating->SetAttribute("relating", "error");
|
||||
_TiXmlElement* related = new _TiXmlElement("Related");
|
||||
rel->LinkEndChild(related);
|
||||
char attribName[2048];
|
||||
if (uiRelatedElementSize > 0)
|
||||
{
|
||||
for (A3DUns32 uj = 0; uj < uiRelatedElementSize; ++uj)
|
||||
{
|
||||
if (ppRelatedElements[uj] == nullptr)
|
||||
{
|
||||
sprintf(attribName, "related_%d", uj);
|
||||
related->SetAttribute(attribName, "error");
|
||||
continue;
|
||||
}
|
||||
sttraverseIFCRootEntity(ppRelatedElements[uj], related);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
related->SetAttribute("related", "error");
|
||||
}
|
||||
}
|
||||
//######################################################################################################################
|
||||
int dumpRelationships(const A3DBIMData* pBimData, _TiXmlElement* model)
|
||||
{
|
||||
if (pBimData == nullptr || model == nullptr)
|
||||
return A3D_SUCCESS;
|
||||
|
||||
char attribName[2048];
|
||||
A3DUns32 ui;
|
||||
A3DBIMDataData sBIMData;
|
||||
A3D_INITIALIZE_DATA(A3DBIMDataData, sBIMData);
|
||||
CHECK_RET(A3DBIMDataGet(pBimData, &sBIMData));
|
||||
_TiXmlElement* bim = new _TiXmlElement("BIM");
|
||||
model->LinkEndChild(bim);
|
||||
for (ui = 0; ui < sBIMData.m_uiRelationshipSize; ++ui)
|
||||
{
|
||||
|
||||
A3DEEntityType eType = kA3DTypeUnknown;
|
||||
if( A3DEntityGetType(sBIMData.m_ppRelationships[ui], &eType) != A3D_SUCCESS)
|
||||
{
|
||||
bim->SetAttribute("Ifc_relationship", "error: unknown type");
|
||||
continue;
|
||||
}
|
||||
if (eType == kA3DTypeBIMRelContainedInSpatialStructure)
|
||||
{
|
||||
A3DBIMRelContainedInSpatialStructureData sRelData;
|
||||
A3D_INITIALIZE_DATA(A3DBIMRelContainedInSpatialStructureData, sRelData);
|
||||
if (A3DBIMRelContainedInSpatialStructureGet(sBIMData.m_ppRelationships[ui], &sRelData) == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* rel = new _TiXmlElement("A3DBIMRelContainedInSpatialStructure");
|
||||
bim->LinkEndChild(rel);
|
||||
dumpRelationship(sRelData.m_pRelating, sRelData.m_uiRelatedElementSize, sRelData.m_ppRelatedElements, rel);
|
||||
A3DBIMRelContainedInSpatialStructureGet(nullptr, &sRelData);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(attribName, "kA3DTypeBIMRelContainedInSpatialStructure_%d", ui);
|
||||
bim->SetAttribute(attribName, "error");
|
||||
}
|
||||
|
||||
}
|
||||
else if (eType == kA3DTypeBIMRelAggregates)
|
||||
{
|
||||
A3DBIMRelAggregatesData sRelData;
|
||||
A3D_INITIALIZE_DATA(A3DBIMRelAggregatesData, sRelData);
|
||||
if (A3DBIMRelAggregatesGet(sBIMData.m_ppRelationships[ui], &sRelData) == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* rel = new _TiXmlElement("A3DBIMRelAggregates");
|
||||
bim->LinkEndChild(rel);
|
||||
dumpRelationship(sRelData.m_pRelating, sRelData.m_uiRelatedElementSize, sRelData.m_ppRelatedElements, rel);
|
||||
A3DBIMRelAggregatesGet(nullptr, &sRelData);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(attribName, "kA3DTypeBIMRelAggregates_%d", ui);
|
||||
bim->SetAttribute(attribName, "error");
|
||||
}
|
||||
}
|
||||
else if (eType == kA3DTypeBIMRelFillsElement)
|
||||
{
|
||||
A3DBIMRelFillsElementData sRelData;
|
||||
A3D_INITIALIZE_DATA(A3DBIMRelFillsElementData, sRelData);
|
||||
if (A3DBIMRelFillsElementGet(sBIMData.m_ppRelationships[ui], &sRelData) == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* rel = new _TiXmlElement("A3DBIMRelFillsElement");
|
||||
bim->LinkEndChild(rel);
|
||||
dumpRelationship(sRelData.m_pRelating, sRelData.m_uiRelatedElementSize, sRelData.m_ppRelatedElements, rel);
|
||||
A3DBIMRelFillsElementGet(nullptr, &sRelData);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(attribName, "kA3DTypeBIMRelFillsElement_%d", ui);
|
||||
bim->SetAttribute(attribName, "error");
|
||||
}
|
||||
}
|
||||
else if (eType == kA3DTypeBIMRelVoidsElement)
|
||||
{
|
||||
A3DBIMRelVoidsElementData sRelData;
|
||||
A3D_INITIALIZE_DATA(A3DBIMRelVoidsElementData, sRelData);
|
||||
if (A3DBIMRelVoidsElementGet(sBIMData.m_ppRelationships[ui], &sRelData) == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* rel = new _TiXmlElement("A3DBIMRelVoidsElement");
|
||||
bim->LinkEndChild(rel);
|
||||
dumpRelationship(sRelData.m_pRelating, sRelData.m_uiRelatedElementSize, sRelData.m_ppRelatedElements, rel);
|
||||
A3DBIMRelVoidsElementGet(nullptr, &sRelData);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(attribName, "kA3DTypeBIMRelVoidsElement_%d", ui);
|
||||
bim->SetAttribute(attribName, "error");
|
||||
}
|
||||
}
|
||||
else if (eType == kA3DTypeBIMRelSpaceBoundary)
|
||||
{
|
||||
A3DBIMRelSpaceBoundaryData sRelData;
|
||||
A3D_INITIALIZE_DATA(A3DBIMRelSpaceBoundaryData, sRelData);
|
||||
if (A3DBIMRelSpaceBoundaryGet(sBIMData.m_ppRelationships[ui], &sRelData) == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* rel = new _TiXmlElement("A3DBIMRelSpaceBoundary");
|
||||
bim->LinkEndChild(rel);
|
||||
dumpRelationship(sRelData.m_pRelating, sRelData.m_uiRelatedElementSize, sRelData.m_ppRelatedElements, rel);
|
||||
A3DBIMRelSpaceBoundaryGet(nullptr, &sRelData);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(attribName, "kA3DTypeBIMRelSpaceBoundary_%d", ui);
|
||||
bim->SetAttribute(attribName, "error");
|
||||
}
|
||||
}
|
||||
else if (eType == kA3DTypeBIMRelConnectsPathElements)
|
||||
{
|
||||
A3DBIMRelConnectsPathElementsData sRelData;
|
||||
A3D_INITIALIZE_DATA(A3DBIMRelConnectsPathElementsData, sRelData);
|
||||
if (A3DBIMRelConnectsPathElementsGet(sBIMData.m_ppRelationships[ui], &sRelData) == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* rel = new _TiXmlElement("A3DBIMRelConnectsPathElementsData");
|
||||
bim->LinkEndChild(rel);
|
||||
dumpRelationship(sRelData.m_pRelating, sRelData.m_uiRelatedElementSize, sRelData.m_ppRelatedElements, rel);
|
||||
A3DBIMRelConnectsPathElementsGet(nullptr, &sRelData);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(attribName, "kA3DTypeBIMRelConnectsPathElements_%d", ui);
|
||||
bim->SetAttribute(attribName, "error");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bim->SetAttribute("Ifc_relationship", "error: new type");
|
||||
bim->SetAttribute(attribName, "error");
|
||||
}
|
||||
|
||||
}
|
||||
CHECK_RET(A3DBIMDataGet(nullptr, &sBIMData));
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
928
exchange/exchangesource/PRC2XML/PRC2XMLMarkup.cpp
Normal file
928
exchange/exchangesource/PRC2XML/PRC2XMLMarkup.cpp
Normal file
@@ -0,0 +1,928 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include <sstream>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
//######################################################################################################################
|
||||
static int stTraverseAnnotationSet(const A3DMkpAnnotationSet* pAnnot, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMkpAnnotationSetData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMkpAnnotationSetData, sData);
|
||||
|
||||
_TiXmlElement* annotset = new _TiXmlElement("A3DMkpAnnotationSetData");
|
||||
traverseSource(pAnnot, annotset);
|
||||
|
||||
A3DInt32 iRet = A3DMkpAnnotationSetGet(pAnnot, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiAnnotationsSize; ++ui)
|
||||
traverseAnnotation(sData.m_ppAnnotations[ui], annotset);
|
||||
|
||||
A3DMkpAnnotationSetGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
annotset->SetAttribute("error", iRet);
|
||||
}
|
||||
setting->LinkEndChild(annotset);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int stTraverseAnnotationReference(const A3DMkpAnnotationReference* pAnnot, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMkpAnnotationReferenceData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMkpAnnotationReferenceData, sData);
|
||||
|
||||
_TiXmlElement* ref = new _TiXmlElement("A3DMkpAnnotationReferenceData");
|
||||
traverseSource(pAnnot, ref);
|
||||
|
||||
A3DInt32 iRet = A3DMkpAnnotationReferenceGet(pAnnot, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiLinkedItemsSize; ++ui)
|
||||
traverseLinkedItem(sData.m_ppLinkedItems[ui], ref); // => very very useful
|
||||
|
||||
A3DMkpAnnotationReferenceGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
ref->SetAttribute("error", iRet);
|
||||
}
|
||||
setting->LinkEndChild(ref);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int stTraverseAnnotationItem(const A3DMkpAnnotationItem* pAnnot, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMkpAnnotationItemData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMkpAnnotationItemData, sData);
|
||||
|
||||
_TiXmlElement* annotitem = new _TiXmlElement("A3DMkpAnnotationItemData");
|
||||
traverseSource(pAnnot, annotitem);
|
||||
|
||||
A3DInt32 iRet = A3DMkpAnnotationItemGet(pAnnot, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseMarkup(sData.m_pMarkup, annotitem);
|
||||
A3DMkpAnnotationItemGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
annotitem->SetAttribute("error", iRet);
|
||||
}
|
||||
setting->LinkEndChild(annotitem);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseAnnotation(const A3DMkpAnnotationEntity* pAnnot, _TiXmlElement* setting)
|
||||
{
|
||||
A3DEEntityType eType;
|
||||
A3DInt32 iRet = A3DEntityGetType(pAnnot, &eType);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
switch(eType)
|
||||
{
|
||||
case kA3DTypeMkpAnnotationSet:
|
||||
return stTraverseAnnotationSet(pAnnot,setting);
|
||||
case kA3DTypeMkpAnnotationReference:
|
||||
return stTraverseAnnotationReference(pAnnot,setting);
|
||||
case kA3DTypeMkpAnnotationItem:
|
||||
return stTraverseAnnotationItem(pAnnot,setting);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return A3D_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseAmbientLight(const A3DGraphAmbientLight *pLight, _TiXmlElement* setting)
|
||||
{
|
||||
if (!pLight)
|
||||
{
|
||||
setting->SetAttribute("Light", "Bad cast");
|
||||
return -1;
|
||||
}
|
||||
_TiXmlElement* light = new _TiXmlElement("A3DGraphAmbientLightData");
|
||||
A3DStatus iRet;
|
||||
A3DGraphAmbientLightData oLight;
|
||||
A3D_INITIALIZE_DATA(A3DGraphAmbientLightData, oLight);
|
||||
if ((iRet = A3DGraphAmbientLightGet(pLight, &oLight)) == A3D_SUCCESS)
|
||||
{
|
||||
|
||||
light->SetAttribute("m_uiAmbientColorIndex", oLight.m_uiAmbientColorIndex); /*!< Ambient color index. */
|
||||
light->SetAttribute("m_uiDiffuseColorIndex", oLight.m_uiDiffuseColorIndex); /*!< Diffuse color index. */
|
||||
light->SetAttribute("m_uiSpecularColorIndex", oLight.m_uiSpecularColorIndex); /*!< Specular color index. */
|
||||
A3DGraphAmbientLightGet(NULL, &oLight);
|
||||
}
|
||||
else
|
||||
{
|
||||
light->SetAttribute("Error", iRet);
|
||||
}
|
||||
setting->LinkEndChild(light);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traversePointLight(const A3DGraphPointLight* pLight, _TiXmlElement* setting)
|
||||
{
|
||||
if (!pLight)
|
||||
{
|
||||
setting->SetAttribute("Light", "Bad cast");
|
||||
return -1;
|
||||
}
|
||||
|
||||
_TiXmlElement* light = new _TiXmlElement("A3DGraphPointLightData");
|
||||
A3DStatus iRet;
|
||||
A3DGraphPointLightData oLight;
|
||||
A3D_INITIALIZE_DATA(A3DGraphPointLightData, oLight);
|
||||
if ((iRet = A3DGraphPointLightGet(pLight, &oLight)) == A3D_SUCCESS)
|
||||
{
|
||||
light->SetAttribute("m_uiAmbientColorIndex", oLight.m_uiAmbientColorIndex); /*!< Ambient color index. */
|
||||
light->SetAttribute("m_uiDiffuseColorIndex", oLight.m_uiDiffuseColorIndex); /*!< Diffuse color index. */
|
||||
light->SetAttribute("m_uiSpecularColorIndex", oLight.m_uiSpecularColorIndex); /*!< Specular color index. */
|
||||
traversePoint("m_sLocation", oLight.m_sLocation, light); /*!< Location. \version 2.1 */
|
||||
light->SetDoubleAttribute("m_dConstantAttenuation", oLight.m_dConstantAttenuation); /*!< Constant attenuation. \version 2.1 */
|
||||
light->SetDoubleAttribute("m_dLinearAttenuation", oLight.m_dLinearAttenuation); /*!< Linear attenuation. \version 2.1 */
|
||||
light->SetDoubleAttribute("m_dQuadraticAttenuation", oLight.m_dQuadraticAttenuation); /*!< Quadratic attenuation. \version 2.1 */
|
||||
A3DGraphPointLightGet(NULL, &oLight);
|
||||
}
|
||||
else
|
||||
{
|
||||
light->SetAttribute("Error", iRet);
|
||||
}
|
||||
setting->LinkEndChild(light);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseSpotLight(const A3DGraphSpotLight* pLight, _TiXmlElement* setting)
|
||||
{
|
||||
if (!pLight)
|
||||
{
|
||||
setting->SetAttribute("Light", "Bad cast");
|
||||
return -1;
|
||||
}
|
||||
|
||||
_TiXmlElement* light = new _TiXmlElement("A3DGraphSpotLightData");
|
||||
A3DStatus iRet;
|
||||
A3DGraphSpotLightData oLight;
|
||||
A3D_INITIALIZE_DATA(A3DGraphSpotLightData, oLight);
|
||||
if ((iRet = A3DGraphSpotLightGet(pLight, &oLight)) == A3D_SUCCESS)
|
||||
{
|
||||
light->SetAttribute("m_uiAmbientColorIndex", oLight.m_uiAmbientColorIndex); /*!< Ambient color index. */
|
||||
light->SetAttribute("m_uiDiffuseColorIndex", oLight.m_uiDiffuseColorIndex); /*!< Diffuse color index. */
|
||||
light->SetAttribute("m_uiSpecularColorIndex", oLight.m_uiSpecularColorIndex); /*!< Specular color index. */
|
||||
traversePoint("m_sDirection", oLight.m_sDirection, light); /*!< Direction. */
|
||||
light->SetDoubleAttribute("m_dFallOffAngle", oLight.m_dFallOffAngle); /*!< Fall-off angle.*/
|
||||
light->SetDoubleAttribute("m_dFallOffExponent", oLight.m_dFallOffExponent); /*!< Fall-off exponent. */
|
||||
traversePoint("m_sLocation", oLight.m_sLocation, light); /*!< Location. \version 2.1 */
|
||||
light->SetDoubleAttribute("m_dConstantAttenuation", oLight.m_dConstantAttenuation); /*!< Constant attenuation. \version 2.1 */
|
||||
light->SetDoubleAttribute("m_dLinearAttenuation", oLight.m_dLinearAttenuation); /*!< Linear attenuation. \version 2.1 */
|
||||
light->SetDoubleAttribute("m_dQuadraticAttenuation", oLight.m_dQuadraticAttenuation); /*!< Quadratic attenuation. \version 2.1 */
|
||||
A3DGraphSpotLightGet(NULL, &oLight);
|
||||
}
|
||||
else
|
||||
{
|
||||
light->SetAttribute("Error", iRet);
|
||||
}
|
||||
setting->LinkEndChild(light);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDirectionalLight(const A3DGraphDirectionalLight* pLight, _TiXmlElement* setting)
|
||||
{
|
||||
if (!pLight)
|
||||
{
|
||||
setting->SetAttribute("Light", "Bad cast");
|
||||
return -1;
|
||||
}
|
||||
|
||||
_TiXmlElement* light = new _TiXmlElement("A3DGraphDirectionalLightData");
|
||||
A3DStatus iRet;
|
||||
A3DGraphDirectionalLightData oLight;
|
||||
A3D_INITIALIZE_DATA(A3DGraphDirectionalLightData, oLight);
|
||||
if ((iRet = A3DGraphDirectionalLightGet(pLight, &oLight)) == A3D_SUCCESS)
|
||||
{
|
||||
light->SetAttribute("m_uiAmbientColorIndex", oLight.m_uiAmbientColorIndex); /*!< Ambient color index. */
|
||||
light->SetAttribute("m_uiDiffuseColorIndex", oLight.m_uiDiffuseColorIndex); /*!< Diffuse color index. */
|
||||
light->SetAttribute("m_uiSpecularColorIndex", oLight.m_uiSpecularColorIndex); /*!< Specular color index. */
|
||||
light->SetDoubleAttribute("m_dIntensity", oLight.m_dIntensity); /*!< Density. */
|
||||
traversePoint("m_sDirection", oLight.m_sDirection, light); /*!< Direction. */
|
||||
A3DGraphDirectionalLightGet(NULL, &oLight);
|
||||
}
|
||||
else
|
||||
{
|
||||
light->SetAttribute("Error", iRet);
|
||||
}
|
||||
setting->LinkEndChild(light);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseLight(const A3DGraphLight* pLight, _TiXmlElement* setting)
|
||||
{
|
||||
|
||||
if (!pLight)
|
||||
{
|
||||
setting->SetAttribute("Light", "empty");
|
||||
return -1;
|
||||
}
|
||||
|
||||
A3DEEntityType eType = kA3DTypeUnknown;
|
||||
A3DEntityGetType(pLight, &eType);
|
||||
switch (eType)
|
||||
{
|
||||
case kA3DTypeGraphAmbientLight:
|
||||
traverseAmbientLight(pLight, setting);
|
||||
break;
|
||||
case kA3DTypeGraphPointLight:
|
||||
traversePointLight(pLight, setting);
|
||||
break;
|
||||
case kA3DTypeGraphSpotLight:
|
||||
traverseSpotLight(pLight, setting);
|
||||
break;
|
||||
case kA3DTypeGraphDirectionalLight:
|
||||
traverseDirectionalLight(pLight, setting);
|
||||
break;
|
||||
default:
|
||||
setting->SetAttribute("Light", "Unknown Type");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseCamera(const A3DGraphCamera* pCamera, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* camera = new _TiXmlElement("A3DGraphCameraData");
|
||||
if (pCamera)
|
||||
{
|
||||
traverseSource(pCamera, camera);
|
||||
A3DGraphCameraData oData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphCameraData, oData);
|
||||
A3DStatus iRet = A3DGraphCameraGet(pCamera, &oData);
|
||||
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
camera->SetAttribute("m_bOrthographic", oData.m_bOrthographic ? "true" : "false");
|
||||
traversePoint("m_sLocation", oData.m_sLocation, camera);
|
||||
traversePoint("m_sLookAt", oData.m_sLookAt, camera);
|
||||
traversePoint("m_sUp", oData.m_sUp, camera);
|
||||
camera->SetDoubleAttribute("m_dXFovy", oData.m_dXFovy);
|
||||
camera->SetDoubleAttribute("m_dYFovy", oData.m_dYFovy);
|
||||
camera->SetDoubleAttribute("m_dAspectRatio", oData.m_dAspectRatio);
|
||||
camera->SetDoubleAttribute("m_dZNear", oData.m_dZNear);
|
||||
camera->SetDoubleAttribute("m_dZFar", oData.m_dZFar);
|
||||
camera->SetDoubleAttribute("m_dZoomFactor", oData.m_dZoomFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
camera->SetAttribute("Error", iRet);
|
||||
}
|
||||
A3DGraphCameraGet(NULL, &oData);
|
||||
}
|
||||
setting->LinkEndChild(camera);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseGraphScene(const A3DGraphSceneDisplayParametersData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
_TiXmlElement* graphscene = new _TiXmlElement("A3DGraphSceneDisplayParametersData");
|
||||
graphscene->SetAttribute("NumberOfPlanes", sData.m_uiPlaneSize);
|
||||
|
||||
for (A3DUns32 ui = 0; ui < sData.m_uiPlaneSize; ui++)
|
||||
traverseSrfPlane(sData.m_ppClippingPlanes[ui], graphscene);
|
||||
|
||||
graphscene->SetAttribute("m_bActive", sData.m_bIsActive);
|
||||
traverseCamera(sData.m_pCamera, graphscene);
|
||||
|
||||
graphscene->SetAttribute("NumberOfLights", sData.m_uiLightSize);
|
||||
for (A3DUns32 ui = 0; ui < sData.m_uiLightSize; ui++)
|
||||
traverseLight(sData.m_ppLights[ui], graphscene);
|
||||
|
||||
graphscene->SetAttribute("m_bHasRotationCenter", sData.m_bHasRotationCenter ? "true" : "false");
|
||||
if (sData.m_bHasRotationCenter)
|
||||
traversePoint("m_sRotationCenter", sData.m_sRotationCenter, graphscene);
|
||||
|
||||
graphscene->SetAttribute("m_uiBackgroundStyleIndex", sData.m_uiBackgroundStyleIndex);
|
||||
graphscene->SetAttribute("m_uiDefaultStyleIndex", sData.m_uiDefaultStyleIndex);
|
||||
|
||||
A3DUns32 i, iMax = sData.m_uiDefaultPerTypeIndexSize;
|
||||
graphscene->SetAttribute("NumberOfDefaultStyleIndexesPerType", iMax);
|
||||
for (i = 0; i < iMax; i++)
|
||||
{
|
||||
graphscene->SetAttribute("TypesOfDefaultStyleIndexes", sData.m_puiTypesOfDefaultStyleIndexes[i]);
|
||||
graphscene->SetAttribute("DefaultStyleIndexesPerType", sData.m_puiDefaultStyleIndexesPerType[i]);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(graphscene);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseGraphScene(const A3DGraphSceneDisplayParameters * pGraphSceneParam, _TiXmlElement* setting)
|
||||
{
|
||||
A3DGraphSceneDisplayParametersData sData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphSceneDisplayParametersData, sData);
|
||||
A3DInt32 iRet = A3DGraphSceneDisplayParametersGet(pGraphSceneParam, &sData);
|
||||
|
||||
traverseGraphScene(sData, setting);
|
||||
|
||||
A3DGraphSceneDisplayParametersGet(NULL, &sData);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDisplayFilter(A3DAsmFilter* pFilter, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
_TiXmlElement* filter = new _TiXmlElement("A3DAsmFilterData");
|
||||
|
||||
traverseSource(pFilter, filter);
|
||||
setting->LinkEndChild(filter);
|
||||
if (!pFilter)
|
||||
{
|
||||
filter->SetAttribute("Filter", "empty");
|
||||
return -1;
|
||||
}
|
||||
|
||||
A3DAsmFilterData oData;
|
||||
A3D_INITIALIZE_DATA(A3DAsmFilterData, oData);
|
||||
CHECK_RET(A3DAsmFilterGet(pFilter, &oData));
|
||||
|
||||
filter->SetAttribute("m_bIsActive", oData.m_bIsActive);
|
||||
|
||||
A3DUns32 i, iMax = oData.m_sLayerFilterItem.m_uiSize;
|
||||
if (iMax > 0)
|
||||
{
|
||||
_TiXmlElement* layerFilter = new _TiXmlElement("LayerFilters");
|
||||
layerFilter->SetAttribute("m_sLayerFilterItem.m_bIsInclusive", oData.m_sLayerFilterItem.m_bIsInclusive);
|
||||
|
||||
std::ostringstream indexes;
|
||||
|
||||
indexes << '[' << oData.m_sLayerFilterItem.m_puiLayerIndexes[0];
|
||||
A3DUns32 first = oData.m_sLayerFilterItem.m_puiLayerIndexes[0];
|
||||
A3DUns32 last = oData.m_sLayerFilterItem.m_puiLayerIndexes[0];
|
||||
for (i = 1; i < iMax; i++)
|
||||
{
|
||||
if (oData.m_sLayerFilterItem.m_puiLayerIndexes[i] == last + 1)
|
||||
{
|
||||
last ++;
|
||||
continue;
|
||||
}
|
||||
if (first != last)
|
||||
{
|
||||
indexes << " - "<< last;
|
||||
}
|
||||
indexes << ", " << oData.m_sLayerFilterItem.m_puiLayerIndexes[i];
|
||||
first = oData.m_sLayerFilterItem.m_puiLayerIndexes[i];
|
||||
last = oData.m_sLayerFilterItem.m_puiLayerIndexes[i];
|
||||
}
|
||||
if (first != last)
|
||||
{
|
||||
indexes << " - " << last;
|
||||
}
|
||||
indexes << ']';
|
||||
layerFilter->SetAttribute("m_sLayerFilterItem.m_puiLayerIndexes", indexes.str().c_str());
|
||||
|
||||
filter->LinkEndChild(layerFilter);
|
||||
}
|
||||
|
||||
iMax = oData.m_sEntityFilterItem.m_uiSize;
|
||||
if (iMax > 0)
|
||||
{
|
||||
_TiXmlElement* entityFilter = new _TiXmlElement("EntityFilters");
|
||||
entityFilter->SetAttribute("m_sEntityFilterItem.m_bIsInclusive", oData.m_sEntityFilterItem.m_bIsInclusive);
|
||||
for (i = 0; i < iMax; i++)
|
||||
{
|
||||
|
||||
std::ostringstream title; title << "sEntityFilterItem" << "_" << i;
|
||||
_TiXmlElement* entityFilterItem = new _TiXmlElement(title.str().c_str());
|
||||
traverseEntityReference(oData.m_sEntityFilterItem.m_ppEntities[i], entityFilterItem);
|
||||
entityFilter->LinkEndChild(entityFilterItem);
|
||||
}
|
||||
filter->LinkEndChild(entityFilter);
|
||||
}
|
||||
|
||||
A3DAsmFilterGet(NULL, &oData);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDisplayFilters(A3DUns32 uiSize,A3DAsmFilter** ppFilters , _TiXmlElement* setting)
|
||||
{
|
||||
for (A3DUns32 uk = 0; uk < uiSize; ++uk)
|
||||
traverseDisplayFilter(ppFilters[uk], setting);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseView(const A3DMkpView* pView, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMkpViewData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMkpViewData, sData);
|
||||
|
||||
_TiXmlElement* view = new _TiXmlElement("A3DMkpViewData");
|
||||
traverseSource(pView, view);
|
||||
|
||||
A3DInt32 iRet = A3DMkpViewGet(pView, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
view->SetAttribute("m_bIsAnnotationView", sData.m_bIsAnnotationView);
|
||||
view->SetAttribute("m_bIsDefaultView", sData.m_bIsDefaultView);
|
||||
traverseVoids("m_ppAnnotations", sData.m_uiAnnotationsSize, (const A3DVoid**)sData.m_ppAnnotations, view);
|
||||
traverseSrfPlane(sData.m_pPlane, view);
|
||||
traverseGraphScene(sData.m_pSceneDisplayParameters, view);
|
||||
|
||||
_TiXmlElement* displayfilters = new _TiXmlElement("DisplayFilters");
|
||||
traverseDisplayFilters(sData.m_uiDisplayFilterSize, sData.m_ppDisplayFilters, displayfilters);
|
||||
view->LinkEndChild(displayfilters);
|
||||
|
||||
_TiXmlElement* markupref = new _TiXmlElement("LinkedItems");
|
||||
for (A3DUns32 uk = 0; uk < sData.m_uiLinkedItemsSize; ++uk)
|
||||
traverseLinkedItem(sData.m_ppLinkedItems[uk], markupref);
|
||||
view->LinkEndChild(markupref);
|
||||
|
||||
A3DMkpViewGet(NULL, &sData);
|
||||
}
|
||||
setting->LinkEndChild(view);
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
#define EnumValueToXmlAttribute(ENUM_VAL, ATT_TYPE, ATT_VALUE) \
|
||||
case ENUM_VAL: \
|
||||
setting->SetAttribute(ATT_TYPE, ATT_VALUE); \
|
||||
break;
|
||||
|
||||
//######################################################################################################################
|
||||
static void stTraverseMarkupTypeAndSubType(const A3DEMarkupType& eType, const A3DEMarkupSubType& eSubType, _TiXmlElement* setting)
|
||||
{
|
||||
switch(eType)
|
||||
{
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeUnknown, "m_eType", "Unknown");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeText, "m_eType", "Plain text");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeDimension, "m_eType", "Dimension");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeArrow, "m_eType", "Arrow");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeBalloon, "m_eType", "Balloon");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeCircleCenter, "m_eType", "Center of circle");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeCoordinate, "m_eType", "Coordinate");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeDatum, "m_eType", "Datum");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeFastener, "m_eType", "Fastener");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeGdt, "m_eType", "GDT");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeLocator, "m_eType", "Locator");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeMeasurementPoint, "m_eType", "Point");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeRoughness, "m_eType", "Roughness");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeWelding, "m_eType", "Welding");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeTable, "m_eType", "Table");
|
||||
EnumValueToXmlAttribute(kA3DMarkupTypeOther, "m_eType", "Other");
|
||||
default:
|
||||
setting->SetAttribute("m_eType", "Unexpected");
|
||||
break;
|
||||
}
|
||||
|
||||
if(eType == kA3DMarkupTypeDatum)
|
||||
{
|
||||
switch(eSubType)
|
||||
{
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDatumIdent, "m_eSubType", "Datum ident");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDatumTarget, "m_eSubType", "Datum target");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDatumEnumMax, "m_eSubType", "Datum max value. \version 2.2");
|
||||
default:
|
||||
setting->SetAttribute("Datum_m_eSubType", "Unexpected");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(eType == kA3DMarkupTypeDimension)
|
||||
{
|
||||
switch(eSubType)
|
||||
{
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionDistance, "m_eSubType", "Dimension distance");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionDistanceOffset, "m_eSubType", "Dimension distance offset");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionDistanceCumulate, "m_eSubType", "Dimension distance cumulate");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionChamfer, "m_eSubType", "Dimension chamfer");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionSlope, "m_eSubType", "Dimension slope");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionOrdinate, "m_eSubType", "Dimension ordinate");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionRadius, "m_eSubType", "Dimension radius");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionRadiusTangent, "m_eSubType", "Dimension radius tangent");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionRadiusCylinder, "m_eSubType", "Dimension radius cylinder");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionRadiusEdge, "m_eSubType", "Dimension radius edge");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionDiameter, "m_eSubType", "Dimension diameter");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionDiameterTangent, "m_eSubType", "Dimension diameter tangent");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionDiameterCylinder, "m_eSubType", "Dimension diameter cylinder");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionDiameterEdge, "m_eSubType", "Dimension diameter edge");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionDiameterCone, "m_eSubType", "Dimension diameter cone");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionLength, "m_eSubType", "Dimension length");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionLengthCurvilinear, "m_eSubType", "Dimension length curvilinear");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionLengthCircular, "m_eSubType", "Dimension length circular");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionAngle, "m_eSubType", "Dimension angle");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeDimensionEnumMax, "m_eSubType", "Dimension max value. \version 2.2");
|
||||
default:
|
||||
setting->SetAttribute("Dimension_m_eSubType", "Unexpected");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(eType == kA3DMarkupTypeGdt)
|
||||
{
|
||||
switch(eSubType)
|
||||
{
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeGdtFcf, "m_eSubType", "GDT feature control frame subtype");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeGdtEnumMax, "m_eSubType", "GDT max value. \version 2.2");
|
||||
default:
|
||||
setting->SetAttribute("Gdt_m_eSubType", "Unexpected");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(eType == kA3DMarkupTypeWelding)
|
||||
{
|
||||
switch(eSubType)
|
||||
{
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeWeldingLine, "m_eSubType", "Line welding subtype");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeWeldingSpot, "m_eSubType", "Spot welding subtype");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeWeldingEnumMax, "m_eSubType", "welding max value. \version 2.2");
|
||||
default:
|
||||
setting->SetAttribute("welding_m_eSubType", "Unexpected");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(eType == kA3DMarkupTypeOther)
|
||||
{
|
||||
switch(eSubType)
|
||||
{
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeOtherSymbolUser, "m_eSubType", "SymbolUser other subtype");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeOtherSymbolUtility, "m_eSubType", "SymbolUtility other subtype");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeOtherSymbolCustom, "m_eSubType", "SymbolCustom other subtype");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeOtherGeometricReference, "m_eSubType", "GeometricReference other subtype");
|
||||
EnumValueToXmlAttribute(kA3DMarkupSubTypeOtherRegion, "m_eSubType", "Region");
|
||||
default:
|
||||
setting->SetAttribute("other_symbol_m_eSubType", "Unexpected");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkup(const A3DMkpMarkup* pMarkup, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMkpMarkupData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMkpMarkupData, sData);
|
||||
|
||||
_TiXmlElement* markup = new _TiXmlElement("A3DMkpMarkupData");
|
||||
traverseSource(pMarkup, markup);
|
||||
|
||||
A3DInt32 iRet = A3DMkpMarkupGet(pMarkup, &sData);
|
||||
A3DRootBaseData sBaseData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseData, sBaseData);
|
||||
iRet = A3DRootBaseGet(pMarkup, &sBaseData);
|
||||
iRet = A3DRootBaseGet(NULL, &sBaseData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
stTraverseMarkupTypeAndSubType(sData.m_eType, sData.m_eSubType, markup);
|
||||
traverseMarkupDefinition(pMarkup, markup);
|
||||
|
||||
_TiXmlElement* leaders = new _TiXmlElement("Leaders");
|
||||
leaders->SetAttribute("size", (int)sData.m_uiLeadersSize);
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiLeadersSize; ++ui)
|
||||
traverseLeader(sData.m_ppLeaders[ui], leaders);
|
||||
markup->LinkEndChild(leaders);
|
||||
|
||||
_TiXmlElement* linkedItems = new _TiXmlElement("LinkedItems");
|
||||
linkedItems->SetAttribute("size", (int)sData.m_uiLinkedItemsSize);
|
||||
for(A3DUns32 uj = 0; uj < sData.m_uiLinkedItemsSize; ++uj)
|
||||
traverseLinkedItem(sData.m_ppLinkedItems[uj], linkedItems);
|
||||
markup->LinkEndChild(linkedItems);
|
||||
|
||||
// parse the references
|
||||
A3DUns32 uiLinkedItemsSize = 0;
|
||||
A3DMiscMarkupLinkedItem** ppLinkedItems = NULL;
|
||||
iRet = A3DMkpLinkForMarkupReferenceGet(pMarkup, &uiLinkedItemsSize, &ppLinkedItems);
|
||||
if (iRet == A3D_SUCCESS && ppLinkedItems)
|
||||
{
|
||||
_TiXmlElement* markupref = new _TiXmlElement("LinksForMarkupReference");
|
||||
markupref->SetAttribute("size", (int) uiLinkedItemsSize);
|
||||
for (A3DUns32 uk = 0; uk < uiLinkedItemsSize; ++uk)
|
||||
traverseLinkedItem(ppLinkedItems[uk], markupref);
|
||||
markup->LinkEndChild(markupref);
|
||||
A3DMkpLinkForMarkupReferenceGet(NULL, &uiLinkedItemsSize, &ppLinkedItems);
|
||||
}
|
||||
|
||||
// parse the additional references
|
||||
A3DUns32 uiAdditionalLinkedItemsSize = 0;
|
||||
A3DMiscMarkupLinkedItem** ppAdditionnalLinkedItems = NULL;
|
||||
iRet = A3DMkpLinkForAdditionalMarkupReferenceGet(pMarkup, &uiAdditionalLinkedItemsSize, &ppAdditionnalLinkedItems);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
if (ppAdditionnalLinkedItems)
|
||||
{
|
||||
_TiXmlElement* additionalMarkupref = new _TiXmlElement("LinksForAdditionalMarkupReference");
|
||||
linkedItems->SetAttribute("size", (int)uiAdditionalLinkedItemsSize);
|
||||
for (A3DUns32 uk = 0; uk < uiAdditionalLinkedItemsSize; ++uk)
|
||||
traverseLinkedItem(ppAdditionnalLinkedItems[uk], additionalMarkupref);
|
||||
markup->LinkEndChild(additionalMarkupref);
|
||||
}
|
||||
A3DMkpLinkForAdditionalMarkupReferenceGet(NULL, &uiAdditionalLinkedItemsSize, &ppAdditionnalLinkedItems);
|
||||
}
|
||||
|
||||
traverseTessBase(sData.m_pTessellation, markup);
|
||||
|
||||
A3DMkpMarkupGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
markup->SetAttribute("error", iRet);
|
||||
|
||||
setting->LinkEndChild(markup);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
void setLeaderSymbolType(_TiXmlElement* setting, const char* name, const A3DMDLeaderSymbolType value)
|
||||
{
|
||||
switch(value)
|
||||
{
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolNotUsed, name, "Not used");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolCross, name, "Cross");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolPlus, name, "Plus");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolConcentric, name, "Concentric");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolCoincident, name, "Coincident");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolFullCircle, name, "FullCircle");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolFullSquare, name, "FullSquare");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolStar, name, "Star");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolDot, name, "Dot");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolSmallDot, name, "SmallDot");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolMisc1, name, "Misc1");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolMisc2, name, "Misc2");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolFullCircle2, name, "FullCircle2");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolFullSquare2, name, "FullSquare2");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolOpenArrow, name, "OpenArrow");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolUnfilledArrow, name, "UnfilledArrow");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolBlankedArrow, name, "BlankedArrow");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolFilledArrow, name, "FilledArrow");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolUnfilledCircle, name, "UnfilledCircle");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolBlankedCircle, name, "BlankedCircle");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolFilledCircle, name, "FilledCircle");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolCrossedCircle, name, "CrossedCircle");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolBlankedSquare, name, "BlankedSquare");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolFilledSquare, name, "FilledSquare");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolBlankedTriangle, name, "BlankedTriangle");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolFilledTriangle, name, "FilledTriangle");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolManipulatorSquare, name, "ManipulatorSquare");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolMamipulatorDiamond, name, "MamipulatorDiamond");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolManipulatorCircle, name, "ManipulatorCircle");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolManipulatorTriangle, name, "ManipulatorTriangle");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolDoubleOpenArrow, name, "DoubleOpenArrow");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolWave, name, "Wave");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolSegment, name, "Segment");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolDoubleFilledArrow, name, "DoubleFilledArrow");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolDoubleClosedArrow, name, "DoubleClosedArrow");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolHalfOpenArrowUp, name, "HalfOpenArrowUp");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolHalfOpenArrowDown, name, "HalfOpenArrowDown");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolHalfFilledArrowUp, name, "HalfFilledArrowUp");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolHalfFilledArrowDown, name, "HalfFilledArrowDown");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolSlash, name, "Slash");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolDoubleBlankedArrow, name, "DoubleBlankedArrow");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolIntegral, name, "Integral");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolZoneGlobalAllAround, name, "ZoneGlobalAllAround");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolZonePartialAllAround, name, "ZonePartialAllAround");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolZoneGlobalAllAboutWithHorizontalAxisIndicator, name, "ZoneGlobalAllAboutWithHorizontalAxisIndicator");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolZoneGlobalAllAboutWithVerticalAxisIndicator, name, "ZoneGlobalAllAboutWithVerticalAxisIndicator");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolZonePartialAllAboutWithHorizontalAxisIndicator, name, "ZonePartialAllAboutWithHorizontalAxisIndicator");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolZonePartialAllAboutWithVerticalAxisIndicator, name, "ZonePartialAllAboutWithVerticalAxisIndicator");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolZoneGlobalAllOver, name, "ZoneGlobalAllOver");
|
||||
EnumValueToXmlAttribute(KA3DMDLeaderSymbolZonePartialAllOver, name, "ZonePartialAllOver");
|
||||
default:
|
||||
setting->SetAttribute(name, "Unexpected");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int stTraverseLeaderSymbol(const A3DMDLeaderSymbol* pSymbol, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDLeaderSymbolData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDLeaderSymbolData, sData);
|
||||
|
||||
_TiXmlElement* symbol = new _TiXmlElement("A3DMDLeaderSymbolData");
|
||||
|
||||
A3DInt32 iRet = A3DMDLeaderSymbolGet(pSymbol, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
symbol->SetDoubleAttribute("m_dAdditionalParameter", sData.m_dAdditionalParameter);
|
||||
symbol->SetDoubleAttribute("m_dLength" , sData.m_dLength);
|
||||
setLeaderSymbolType(symbol, "m_eHeadSymbol", sData.m_eHeadSymbol);
|
||||
A3DMDLeaderSymbolGet(NULL, &sData);
|
||||
}
|
||||
setting->LinkEndChild(symbol);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int stTraverseLeaderStub(const A3DMDMarkupLeaderStub* pStub, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDMarkupLeaderStubData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDMarkupLeaderStubData, sData);
|
||||
|
||||
_TiXmlElement* stub = new _TiXmlElement("A3DMDMarkupLeaderStubData");
|
||||
|
||||
A3DInt32 iRet = A3DMDMarkupLeaderStubGet(pStub, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseDoubles("m_pdValues" , sData.m_uiValuesAndAnchorTypesSize, sData.m_pdValues , stub);
|
||||
traverseUInts ("m_piAnchorTypes", sData.m_uiValuesAndAnchorTypesSize, sData.m_piAnchorTypes, stub);
|
||||
A3DMDMarkupLeaderStubGet(NULL, &sData);
|
||||
}
|
||||
setting->LinkEndChild(stub);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int stTraverseMDPosition2D(const A3DMDPosition2D* pPos, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDPosition2DData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDPosition2DData, sData);
|
||||
|
||||
_TiXmlElement* pos = new _TiXmlElement("A3DMDPosition2DData");
|
||||
|
||||
A3DInt32 iRet = A3DMDPosition2DGet(pPos, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
pos->SetDoubleAttribute("m_dOffset", sData.m_dOffset);
|
||||
traverseSrfPlane(sData.m_pPlane, pos);
|
||||
traversePoint2d("m_sPosition", sData.m_sPosition, pos);
|
||||
A3DMDPosition2DGet(NULL, &sData);
|
||||
}
|
||||
setting->LinkEndChild(pos);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int stTraverseMDPosition3D(const A3DMDPosition3D* pPos, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDPosition3DData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDPosition3DData, sData);
|
||||
|
||||
_TiXmlElement* pos = new _TiXmlElement("A3DMDPosition3DData");
|
||||
|
||||
A3DInt32 iRet = A3DMDPosition3DGet(pPos, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traversePoint("m_sPosition", sData.m_sPosition, pos);
|
||||
A3DMDPosition3DGet(NULL, &sData);
|
||||
}
|
||||
setting->LinkEndChild(pos);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int stTraverseMDPositionReference(const A3DMDPositionReference* pPos, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDPositionReferenceData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDPositionReferenceData, sData);
|
||||
|
||||
_TiXmlElement* pos = new _TiXmlElement("A3DMDPositionReferenceData");
|
||||
|
||||
A3DInt32 iRet = A3DMDPositionReferenceGet(pPos, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
// traverseLinkedItem(sData.m_psLinkedItem, pos); // avoid recursive visitation...
|
||||
pos->SetAttribute("m_eAttachType", sData.m_eAttachType);
|
||||
traversePoint2d("m_sOffsetToReference", sData.m_sOffsetToReference, pos);
|
||||
A3DMDPositionReferenceGet(NULL, &sData);
|
||||
}
|
||||
setting->LinkEndChild(pos);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int stTraverseMDPosition(const A3DMDPosition* pPos, _TiXmlElement* setting)
|
||||
{
|
||||
A3DEEntityType eType = kA3DTypeUnknown;
|
||||
A3DInt32 iRet = A3DEntityGetType(pPos, &eType);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
switch(eType)
|
||||
{
|
||||
case kA3DTypeMDPosition2D:
|
||||
iRet = stTraverseMDPosition2D(pPos, setting);
|
||||
break;
|
||||
case kA3DTypeMDPosition3D:
|
||||
iRet = stTraverseMDPosition3D(pPos, setting);
|
||||
break;
|
||||
case kA3DTypeMDPositionReference:
|
||||
iRet = stTraverseMDPositionReference(pPos, setting);
|
||||
break;
|
||||
default:
|
||||
iRet = A3D_INVALID_ENTITY_TYPE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int stTraverseLeaderDefinition(const A3DMDLeaderDefinition* pLeaderDef, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDLeaderDefinitionData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDLeaderDefinitionData, sData);
|
||||
|
||||
_TiXmlElement* definition = new _TiXmlElement("A3DMDLeaderDefinitionData");
|
||||
|
||||
A3DInt32 iRet = A3DMDLeaderDefinitionGet(pLeaderDef, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
setLeaderSymbolType(definition, "m_eTailSymbol", sData.m_eTailSymbol);
|
||||
traverseDoubles("m_pdGapList", sData.m_uiNbGapsElements, sData.m_pdGapList, definition);
|
||||
|
||||
if(sData.m_pHeadSymbol != NULL)
|
||||
stTraverseLeaderSymbol(sData.m_pHeadSymbol, definition);
|
||||
|
||||
_TiXmlElement* positions = new _TiXmlElement("PathLeaderPositions");
|
||||
positions->SetAttribute("size", (int)sData.m_uiNumberOfPathLeaderPositions);
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiNumberOfPathLeaderPositions; ++ui)
|
||||
stTraverseMDPosition(sData.m_ppsPathLeaderPositions[ui], positions);
|
||||
definition->LinkEndChild(positions);
|
||||
|
||||
if(sData.m_pStub != NULL)
|
||||
stTraverseLeaderStub(sData.m_pStub, definition);
|
||||
|
||||
definition->SetAttribute("m_uAnchorFrame", sData.m_uAnchorFrame);
|
||||
definition->SetAttribute("m_uAnchorPoint", sData.m_uAnchorPoint);
|
||||
|
||||
if(sData.m_pNextLeader != NULL)
|
||||
stTraverseLeaderDefinition(sData.m_pNextLeader, definition);
|
||||
|
||||
A3DMDLeaderDefinitionGet(NULL, &sData);
|
||||
}
|
||||
setting->LinkEndChild(definition);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseLeader(const A3DMkpLeader* pLeader, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMkpLeaderData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMkpLeaderData, sData);
|
||||
|
||||
_TiXmlElement* leader = new _TiXmlElement("A3DMkpLeaderData");
|
||||
traverseSource(pLeader, leader);
|
||||
|
||||
A3DInt32 iRet = A3DMkpLeaderGet(pLeader, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseLinkedItem(sData.m_pLinkedItem, leader);
|
||||
traverseTessBase(sData.m_pTessellation, leader);
|
||||
stTraverseLeaderDefinition(pLeader, leader);
|
||||
A3DMkpLeaderGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
leader->SetAttribute("error", iRet);
|
||||
|
||||
setting->LinkEndChild(leader);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseLinkedItem(const A3DMiscMarkupLinkedItem* pMkpLinkedItem, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMiscMarkupLinkedItemData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMiscMarkupLinkedItemData, sData);
|
||||
|
||||
_TiXmlElement* mkplinkeditem = new _TiXmlElement("A3DMiscMarkupLinkedItemData");
|
||||
traverseSource(pMkpLinkedItem, mkplinkeditem);
|
||||
|
||||
A3DInt32 iRet = A3DMiscMarkupLinkedItemGet(pMkpLinkedItem, &sData);
|
||||
if(pMkpLinkedItem && iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseEntityReference((A3DMiscEntityReference*)pMkpLinkedItem, mkplinkeditem);
|
||||
mkplinkeditem->SetAttribute("m_bMarkupShowControl", sData.m_bMarkupShowControl);
|
||||
mkplinkeditem->SetAttribute("m_bMarkupDeleteControl", sData.m_bMarkupDeleteControl);
|
||||
mkplinkeditem->SetAttribute("m_bLeaderShowControl", sData.m_bLeaderShowControl);
|
||||
mkplinkeditem->SetAttribute("m_bLeaderDeleteControl", sData.m_bLeaderDeleteControl);
|
||||
if(sData.m_pTargetProductOccurrence != NULL)
|
||||
_SetAttributePtr(mkplinkeditem, "m_pTargetProductOccurrence", (void*) sData.m_pTargetProductOccurrence);
|
||||
A3DMiscMarkupLinkedItemGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
mkplinkeditem->SetAttribute("error", pMkpLinkedItem ? iRet : A3D_INVALID_ENTITY_NULL);
|
||||
|
||||
setting->LinkEndChild(mkplinkeditem);
|
||||
return iRet;
|
||||
}
|
||||
93
exchange/exchangesource/PRC2XML/PRC2XMLMarkupDefinition.cpp
Normal file
93
exchange/exchangesource/PRC2XML/PRC2XMLMarkupDefinition.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupDefinition(const A3DMkpMarkup* pMarkup, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMarkupDefinitionData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMarkupDefinitionData, sData);
|
||||
|
||||
A3DEEntityType eType = kA3DTypeUnknown;
|
||||
A3DStatus iRet = A3DEntityGetType(pMarkup, &eType);
|
||||
|
||||
|
||||
_TiXmlElement* markup = NULL;
|
||||
iRet = A3DMarkupDefinitionGet((A3DMarkupDefinition*)pMarkup, &sData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
A3DMDPosition2DData sPosition;
|
||||
A3DVector2dData sOffsetAnchorPoint;
|
||||
A3DBool bIsScreenLocation=FALSE;
|
||||
A3D_INITIALIZE_DATA(A3DMDPosition2DData, sPosition);
|
||||
A3D_INITIALIZE_DATA(A3DVector2dData, sOffsetAnchorPoint);
|
||||
A3DMarkupPositionIsScreenLocation((A3DMarkupDefinition*)pMarkup,
|
||||
&bIsScreenLocation,
|
||||
&sPosition,
|
||||
&sOffsetAnchorPoint);
|
||||
if(bIsScreenLocation)
|
||||
{
|
||||
markup = new _TiXmlElement("A3DMkpMarkupDefinitionData");
|
||||
setting->LinkEndChild(markup);
|
||||
markup->SetAttribute("PositionIsScreenLocation", bIsScreenLocation);
|
||||
markup->SetDoubleAttribute("position2Dx ", sPosition.m_sPosition.m_dX);
|
||||
markup->SetDoubleAttribute("position2Dy ", sPosition.m_sPosition.m_dY);
|
||||
markup->SetDoubleAttribute("offsetAnchorPoint2Dx ", sOffsetAnchorPoint.m_dX);
|
||||
markup->SetDoubleAttribute("offsetAnchorPoint2Dy ", sOffsetAnchorPoint.m_dY);
|
||||
}
|
||||
A3DMarkupDefinitionGet(NULL, &sData);
|
||||
|
||||
if(eType == kA3DTypeMkpMarkup)
|
||||
{
|
||||
setting->SetAttribute("data", "no definition");
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
if(!bIsScreenLocation)
|
||||
{
|
||||
markup = new _TiXmlElement("A3DMkpMarkupDefinitionData");
|
||||
setting->LinkEndChild(markup);
|
||||
}
|
||||
|
||||
if(eType == kA3DTypeMarkupText)
|
||||
{
|
||||
return traverseMarkupText(pMarkup, markup);
|
||||
}
|
||||
else if(eType == kA3DTypeMarkupRichText)
|
||||
{
|
||||
return traverseMarkupRichText(pMarkup, markup);
|
||||
}
|
||||
else if(eType == kA3DTypeMarkupDatum)
|
||||
{
|
||||
return traverseMarkupDatum(pMarkup, markup);
|
||||
}
|
||||
else if(eType == kA3DTypeMarkupGDT)
|
||||
{
|
||||
return traverseMarkupGDT(pMarkup, markup);
|
||||
}
|
||||
else if(eType == kA3DTypeMarkupDimension)
|
||||
{
|
||||
return traverseMarkupDimension(pMarkup, markup);
|
||||
}
|
||||
else
|
||||
{
|
||||
markup->SetAttribute("specific_data", "not yet implemented");
|
||||
return A3D_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
593
exchange/exchangesource/PRC2XML/PRC2XMLMarkupDimension.cpp
Normal file
593
exchange/exchangesource/PRC2XML/PRC2XMLMarkupDimension.cpp
Normal file
@@ -0,0 +1,593 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseDimensionType(int iDimensionType, _TiXmlElement* setting)
|
||||
{
|
||||
switch(iDimensionType)
|
||||
{
|
||||
case KEA3DMDDimensionTypeDistance: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeDistance"); break;
|
||||
case KEA3DMDDimensionTypeDistanceOffset: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeDistanceOffset"); break;
|
||||
case KEA3DMDDimensionTypeLength: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeLength"); break;
|
||||
case KEA3DMDDimensionTypeLengthCurvilinear: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeLengthCurvilinear"); break;
|
||||
case KEA3DMDDimensionTypeAngle: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeAngle"); break;
|
||||
case KEA3DMDDimensionTypeRadius: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeRadius"); break;
|
||||
case KEA3DMDDimensionTypeRadiusTangent: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeRadiusTangent"); break;
|
||||
case KEA3DMDDimensionTypeRadiusCylinder: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeRadiusCylinder"); break;
|
||||
case KEA3DMDDimensionTypeRadiusEdge: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeRadiusEdge"); break;
|
||||
case KEA3DMDDimensionTypeDiameter: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeDiameter"); break;
|
||||
case KEA3DMDDimensionTypeDiameterTangent: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeDiameterTangent"); break;
|
||||
case KEA3DMDDimensionTypeDiameterCylinder: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeDiameterCylinder"); break;
|
||||
case KEA3DMDDimensionTypeDiameterEdge: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeDiameterEdge"); break;
|
||||
case KEA3DMDDimensionTypeDiameterCone: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeDiameterCone"); break;
|
||||
case KEA3DMDDimensionTypeChamfer: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeChamfer"); break;
|
||||
case KEA3DMDDimensionTypeSlope: setting->SetAttribute("m_eType", "KEA3DMDDimensionTypeSlope"); break;
|
||||
default: setting->SetAttribute("m_eType", "unexpected"); break;
|
||||
}
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
|
||||
static void sttraverseDimensionValueFormat(const A3DMDDimensionValueFormat* psValueFormat, _TiXmlElement* setting)
|
||||
{
|
||||
if(psValueFormat == NULL)
|
||||
{
|
||||
setting->SetAttribute("psValueFormat", "NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
A3DMDDimensionValueFormatData sValueFormatData;
|
||||
A3D_INITIALIZE_DATA(A3DMDDimensionValueFormatData, sValueFormatData);
|
||||
|
||||
_TiXmlElement* markup_dimvalueformat = new _TiXmlElement("A3DMDDimensionValueFormatData");
|
||||
setting->LinkEndChild(markup_dimvalueformat);
|
||||
|
||||
A3DStatus iRet = A3DMDDimensionValueFormatGet(psValueFormat, &sValueFormatData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_dimvalueformat->SetAttribute("error", iRet);
|
||||
return;
|
||||
}
|
||||
|
||||
markup_dimvalueformat->SetAttribute("m_pcName", sValueFormatData.m_pcName?sValueFormatData.m_pcName:"dimension");
|
||||
markup_dimvalueformat->SetAttribute("m_iType", sValueFormatData.m_iType);
|
||||
markup_dimvalueformat->SetAttribute("m_iUnit", sValueFormatData.m_iUnit);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dGlobFact", sValueFormatData.m_dGlobFact);
|
||||
markup_dimvalueformat->SetAttribute("m_iNulFac_1", sValueFormatData.m_iNulFac_1);
|
||||
markup_dimvalueformat->SetAttribute("m_iNulFac_2", sValueFormatData.m_iNulFac_2);
|
||||
markup_dimvalueformat->SetAttribute("m_iExise", sValueFormatData.m_iExise);
|
||||
markup_dimvalueformat->SetAttribute("m_iSep1000", sValueFormatData.m_iSep1000);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dFact_1", sValueFormatData.m_dFact_1);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dFact_2", sValueFormatData.m_dFact_2);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dFact_3", sValueFormatData.m_dFact_3);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dValPos_1", sValueFormatData.m_dValPos_1);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dValPos_2", sValueFormatData.m_dValPos_2);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dValPos_3", sValueFormatData.m_dValPos_3);
|
||||
markup_dimvalueformat->SetAttribute("m_pcSepar_1",
|
||||
sValueFormatData.m_pcSepar_1 ? sValueFormatData.m_pcSepar_1 : "null");
|
||||
markup_dimvalueformat->SetAttribute("m_pcSepar_1",
|
||||
sValueFormatData.m_pcSepar_2 ? sValueFormatData.m_pcSepar_2 : "null");
|
||||
markup_dimvalueformat->SetAttribute("m_pcSepar_1",
|
||||
sValueFormatData.m_pcSepar_3 ? sValueFormatData.m_pcSepar_3 : "null");
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dSepScl_1", sValueFormatData.m_dSepScl_1);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dSepScl_2", sValueFormatData.m_dSepScl_2);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dSepScl_3", sValueFormatData.m_dSepScl_3);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dSepPos_1", sValueFormatData.m_dSepPos_1);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dSepPos_2", sValueFormatData.m_dSepPos_2);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dSepPos_3", sValueFormatData.m_dSepPos_3);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dRestY", sValueFormatData.m_dRestY);
|
||||
markup_dimvalueformat->SetAttribute("m_iFinZer", sValueFormatData.m_iFinZer);
|
||||
markup_dimvalueformat->SetAttribute("m_iSepNum", sValueFormatData.m_iSepNum);
|
||||
markup_dimvalueformat->SetAttribute("m_iTypFrac", sValueFormatData.m_iTypFrac);
|
||||
markup_dimvalueformat->SetAttribute("m_iSepDen", sValueFormatData.m_iSepDen);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dOperY", sValueFormatData.m_dOperY);
|
||||
markup_dimvalueformat->SetAttribute("m_iNulOther", sValueFormatData.m_iNulOther);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dResScl", sValueFormatData.m_dResScl);
|
||||
markup_dimvalueformat->SetAttribute("m_iFact", sValueFormatData.m_iFact);
|
||||
markup_dimvalueformat->SetDoubleAttribute("m_dRestX", sValueFormatData.m_dRestX);
|
||||
|
||||
A3DMDDimensionValueFormatGet(NULL, &sValueFormatData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseDimensionToleranceSimpleFormat(const A3DMDDimensionSimpleToleranceFormat* psToleranceFormat,
|
||||
_TiXmlElement* setting)
|
||||
{
|
||||
if(psToleranceFormat == NULL)
|
||||
{
|
||||
setting->SetAttribute("psToleranceFormat", "NULL");
|
||||
return;
|
||||
}
|
||||
A3DMDDimensionSimpleToleranceFormatData sFormatData;
|
||||
A3D_INITIALIZE_DATA(A3DMDDimensionSimpleToleranceFormatData, sFormatData);
|
||||
|
||||
_TiXmlElement* markup_dimtolformat = new _TiXmlElement("A3DMDDimensionSimpleToleranceFormat");
|
||||
setting->LinkEndChild(markup_dimtolformat);
|
||||
|
||||
A3DStatus iRet = A3DMDDimensionSimpleToleranceFormatGet(psToleranceFormat, &sFormatData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_dimtolformat->SetAttribute("error", iRet);
|
||||
return;
|
||||
}
|
||||
|
||||
markup_dimtolformat->SetAttribute("m_pcName", (sFormatData.m_pcName && sFormatData.m_pcName[0]!=0)?sFormatData.m_pcName:"no name");
|
||||
markup_dimtolformat->SetAttribute("m_iType", sFormatData.m_iType);
|
||||
markup_dimtolformat->SetAttribute("m_iSepar_1", sFormatData.m_iSepar_1);
|
||||
markup_dimtolformat->SetAttribute("m_iSepar_2", sFormatData.m_iSepar_2);
|
||||
markup_dimtolformat->SetDoubleAttribute("m_dSymbolH", sFormatData.m_dSymbolH);
|
||||
markup_dimtolformat->SetAttribute("m_iSepTo_1", sFormatData.m_iSepTo_1);
|
||||
markup_dimtolformat->SetAttribute("m_iSepTo_2", sFormatData.m_iSepTo_2);
|
||||
markup_dimtolformat->SetAttribute("m_iSepTo_3", sFormatData.m_iSepTo_3);
|
||||
markup_dimtolformat->SetAttribute("m_iTrailing", sFormatData.m_iTrailing);
|
||||
markup_dimtolformat->SetAttribute("m_iFractLine", sFormatData.m_iFractLine);
|
||||
markup_dimtolformat->SetAttribute("m_iPtOnValue", sFormatData.m_iPtOnValue);
|
||||
markup_dimtolformat->SetAttribute("m_iAnchorPt", sFormatData.m_iAnchorPt);
|
||||
markup_dimtolformat->SetDoubleAttribute("m_dIntX", sFormatData.m_dIntX);
|
||||
markup_dimtolformat->SetDoubleAttribute("m_dIntY", sFormatData.m_dIntY);
|
||||
markup_dimtolformat->SetDoubleAttribute("m_dExtX", sFormatData.m_dExtX);
|
||||
markup_dimtolformat->SetDoubleAttribute("m_dExtY", sFormatData.m_dExtY);
|
||||
|
||||
markup_dimtolformat->SetAttribute("m_iMergeSame", sFormatData.m_iMergeSame);
|
||||
markup_dimtolformat->SetAttribute("m_iShowNull", sFormatData.m_iShowNull);
|
||||
|
||||
markup_dimtolformat->SetDoubleAttribute("m_dScale", sFormatData.m_dScale);
|
||||
|
||||
A3DMDDimensionSimpleToleranceFormatGet(NULL, &sFormatData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseDimensionToleranceFormat(const A3DMDDimensionToleranceFormat* psToleranceFormat,
|
||||
_TiXmlElement* setting)
|
||||
{
|
||||
A3DEEntityType eType = kA3DTypeUnknown;
|
||||
if(psToleranceFormat == NULL)
|
||||
{
|
||||
setting->SetAttribute("psToleranceFormat", "NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
A3DStatus iRet = A3DEntityGetType(psToleranceFormat, &eType);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("psToleranceFormat", "type error");
|
||||
return;
|
||||
}
|
||||
|
||||
if(eType == kA3DTypeMDDimensionSimpleToleranceFormat)
|
||||
{
|
||||
sttraverseDimensionToleranceSimpleFormat((A3DMDDimensionSimpleToleranceFormat*)psToleranceFormat, setting);
|
||||
}
|
||||
else if(eType == kA3DTypeMDDimensionCombinedToleranceFormat)
|
||||
{
|
||||
A3DMDDimensionCombinedToleranceFormatData sFormatData;
|
||||
A3D_INITIALIZE_DATA(A3DMDDimensionCombinedToleranceFormatData, sFormatData);
|
||||
|
||||
_TiXmlElement* markup_dimtolformat = new _TiXmlElement("A3DMDDimensionCombinedToleranceFormatData");
|
||||
setting->LinkEndChild(markup_dimtolformat);
|
||||
|
||||
iRet = A3DMDDimensionCombinedToleranceFormatGet(psToleranceFormat, &sFormatData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_dimtolformat->SetAttribute("psToleranceFormat", "NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
markup_dimtolformat->SetAttribute("m_pcName", (sFormatData.m_pcName && sFormatData.m_pcName[0]!=0)?sFormatData.m_pcName:"no name");
|
||||
markup_dimtolformat->SetAttribute("m_iType", sFormatData.m_iType);
|
||||
sttraverseDimensionToleranceSimpleFormat(sFormatData.m_pToleranceFormat1, markup_dimtolformat);
|
||||
markup_dimtolformat->SetDoubleAttribute("m_dExtX1", sFormatData.m_dExtX1);
|
||||
markup_dimtolformat->SetDoubleAttribute("m_dExtY1", sFormatData.m_dExtY1);
|
||||
markup_dimtolformat->SetAttribute("m_iAnchorPt1", sFormatData.m_iAnchorPt1);
|
||||
markup_dimtolformat->SetAttribute("m_iPtOnValue1", sFormatData.m_iPtOnValue1);
|
||||
markup_dimtolformat->SetAttribute("m_iSepar_1", sFormatData.m_iSepar_1);
|
||||
sttraverseDimensionToleranceSimpleFormat(sFormatData.m_pToleranceFormat2, markup_dimtolformat);
|
||||
markup_dimtolformat->SetDoubleAttribute("m_dExtX2", sFormatData.m_dExtX2);
|
||||
markup_dimtolformat->SetDoubleAttribute("m_dExtY2", sFormatData.m_dExtY2);
|
||||
markup_dimtolformat->SetAttribute("m_iAnchorPt2", sFormatData.m_iAnchorPt2);
|
||||
markup_dimtolformat->SetAttribute("m_iPtOnValue2", sFormatData.m_iPtOnValue2);
|
||||
markup_dimtolformat->SetAttribute("m_iSepar_2", sFormatData.m_iSepar_2);
|
||||
A3DMDDimensionCombinedToleranceFormatGet(NULL, &sFormatData);
|
||||
}
|
||||
else
|
||||
setting->SetAttribute("A3DMDDimensionToleranceFormat", "unexpected type");
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseDimensionValue(const A3DMDDimensionValue* psValue, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDDimensionValueData sValueData;
|
||||
A3D_INITIALIZE_DATA(A3DMDDimensionValueData, sValueData);
|
||||
|
||||
_TiXmlElement* markup_dimvalue = new _TiXmlElement("A3DMDDimensionValueData");
|
||||
setting->LinkEndChild(markup_dimvalue);
|
||||
|
||||
A3DStatus iRet = A3DMDDimensionValueGet(psValue, &sValueData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_dimvalue->SetAttribute("error", iRet);
|
||||
return;
|
||||
}
|
||||
if(sValueData.m_iType == 0)
|
||||
markup_dimvalue->SetAttribute("m_iType", "true value");
|
||||
else if(sValueData.m_iType == 1)
|
||||
markup_dimvalue->SetAttribute("m_iType", "fake num value");
|
||||
else if(sValueData.m_iType == 2)
|
||||
markup_dimvalue->SetAttribute("m_iType", "fake alpha num value");
|
||||
else
|
||||
markup_dimvalue->SetAttribute("m_iType", "unexpected");
|
||||
|
||||
markup_dimvalue->SetAttribute("m_bFormat", sValueData.m_bFormat ? "decimal format" : "fractional");
|
||||
markup_dimvalue->SetDoubleAttribute("m_dAccuracy", sValueData.m_dAccuracy);
|
||||
markup_dimvalue->SetDoubleAttribute("m_dToleranceAccuracy", sValueData.m_dToleranceAccuracy);
|
||||
markup_dimvalue->SetAttribute("m_pcFakeValue", sValueData.m_pcFakeValue ? sValueData.m_pcFakeValue : "null");
|
||||
markup_dimvalue->SetDoubleAttribute("m_dTolNumSup", sValueData.m_dTolNumSup);
|
||||
markup_dimvalue->SetDoubleAttribute("m_dTolNumInf", sValueData.m_dTolNumInf);
|
||||
markup_dimvalue->SetAttribute("m_pcTolTxtSup", sValueData.m_pcTolTxtSup ? sValueData.m_pcTolTxtSup : "null");
|
||||
markup_dimvalue->SetAttribute("m_pcTolTxtInf", sValueData.m_pcTolTxtInf ? sValueData.m_pcTolTxtInf : "null");
|
||||
markup_dimvalue->SetAttribute("m_pcBeforeText", sValueData.m_pcBeforeText ? sValueData.m_pcBeforeText : "null");
|
||||
markup_dimvalue->SetAttribute("m_pcAfterText", sValueData.m_pcAfterText ? sValueData.m_pcAfterText : "null");
|
||||
markup_dimvalue->SetAttribute("m_pcAboveText", sValueData.m_pcAboveText ? sValueData.m_pcAboveText : "null");
|
||||
markup_dimvalue->SetAttribute("m_pcBelowText", sValueData.m_pcBelowText ? sValueData.m_pcBelowText : "null");
|
||||
markup_dimvalue->SetAttribute("m_usLastSeparDefinedNum", sValueData.m_usLastSeparDefinedNum);
|
||||
|
||||
markup_dimvalue->SetAttribute("m_iOption", sValueData.m_iOption);
|
||||
markup_dimvalue->SetDoubleAttribute("m_dDeltaForMinMax", sValueData.m_dDeltaForMinMax);
|
||||
|
||||
sttraverseDimensionValueFormat(sValueData.m_pDimValueFormat, markup_dimvalue);
|
||||
sttraverseDimensionToleranceFormat(sValueData.m_pToleranceFormat, markup_dimvalue);
|
||||
|
||||
if(sValueData.m_pChamferDimSecondValue)
|
||||
sttraverseDimensionValue(sValueData.m_pChamferDimSecondValue, markup_dimvalue);
|
||||
|
||||
A3DMDDimensionValueGet(NULL, &sValueData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseDimensionExtentionLine(const A3DMDDimensionExtentionLine* psExtentionLine, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDDimensionExtentionLineData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDDimensionExtentionLineData, sData);
|
||||
|
||||
_TiXmlElement* markup_extline = new _TiXmlElement("A3DMDDimensionExtentionLineData");
|
||||
setting->LinkEndChild(markup_extline);
|
||||
|
||||
A3DStatus iRet = A3DMDDimensionExtentionLineGet(psExtentionLine, &sData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_extline->SetAttribute("error", iRet);
|
||||
return;
|
||||
}
|
||||
|
||||
if(sData.m_pFunnel)
|
||||
{
|
||||
A3DMDDimensionFunnelData sFunnelData;
|
||||
A3D_INITIALIZE_DATA(A3DMDDimensionFunnelData, sFunnelData);
|
||||
|
||||
_TiXmlElement* markup_funnel = new _TiXmlElement("A3DMDDimensionFunnelData");
|
||||
markup_extline->LinkEndChild(markup_funnel);
|
||||
|
||||
iRet = A3DMDDimensionFunnelGet(sData.m_pFunnel, &sFunnelData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_funnel->SetAttribute("error", iRet);
|
||||
return;
|
||||
}
|
||||
|
||||
markup_funnel->SetAttribute("m_usIndex", sFunnelData.m_usIndex);
|
||||
markup_funnel->SetAttribute("m_bMode", sFunnelData.m_bMode ? "true" : "false");
|
||||
markup_funnel->SetDoubleAttribute("m_dAngle", sFunnelData.m_dAngle);
|
||||
markup_funnel->SetDoubleAttribute("m_dHeight", sFunnelData.m_dHeight);
|
||||
markup_funnel->SetDoubleAttribute("m_dWidth", sFunnelData.m_dWidth);
|
||||
A3DMDDimensionFunnelGet(NULL, &sFunnelData);
|
||||
}
|
||||
|
||||
_TiXmlElement* markup_ext1 = new _TiXmlElement("m_sExtremity1");
|
||||
markup_extline->LinkEndChild(markup_ext1);
|
||||
markup_ext1->SetAttribute("m_bShow", sData.m_sExtremity1.m_bShow ? "true" : "false");
|
||||
markup_ext1->SetDoubleAttribute("m_dBlanking", sData.m_sExtremity1.m_dBlanking);
|
||||
markup_ext1->SetDoubleAttribute("m_dOverrun", sData.m_sExtremity1.m_dOverrun);
|
||||
|
||||
_TiXmlElement* markup_ext2 = new _TiXmlElement("m_sExtremity2");
|
||||
markup_extline->LinkEndChild(markup_ext2);
|
||||
markup_ext2->SetAttribute("m_bShow", sData.m_sExtremity2.m_bShow ? "true" : "false");
|
||||
markup_ext2->SetDoubleAttribute("m_dBlanking", sData.m_sExtremity2.m_dBlanking);
|
||||
markup_ext2->SetDoubleAttribute("m_dOverrun", sData.m_sExtremity2.m_dOverrun);
|
||||
|
||||
markup_extline->SetDoubleAttribute("m_dLineSlant", sData.m_dLineSlant);
|
||||
markup_extline->SetAttribute("m_usStyle", sData.m_usStyle);
|
||||
markup_extline->SetDoubleAttribute("m_fThickness", sData.m_fThickness);
|
||||
|
||||
A3DMDDimensionExtentionLineGet(NULL, &sData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseDimensionLineSymbol(const A3DMDDimensionLineSymbol* psLineSymbol, _TiXmlElement* setting)
|
||||
{
|
||||
if(psLineSymbol == NULL)
|
||||
return;
|
||||
|
||||
A3DMDDimensionLineSymbolData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDDimensionLineSymbolData, sData);
|
||||
|
||||
_TiXmlElement* markup_dimline = new _TiXmlElement("A3DMDDimensionLineSymbolData");
|
||||
setting->LinkEndChild(markup_dimline);
|
||||
|
||||
A3DStatus iRet = A3DMDDimensionLineSymbolGet(psLineSymbol, &sData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_dimline->SetAttribute("error", iRet);
|
||||
return;
|
||||
}
|
||||
|
||||
markup_dimline->SetAttribute("m_eShape", sData.m_eShape);
|
||||
markup_dimline->SetAttribute("m_iLineColor", sData.m_iLineColor);
|
||||
markup_dimline->SetDoubleAttribute("m_fThickness", sData.m_fThickness);
|
||||
markup_dimline->SetDoubleAttribute("m_fArrowLength", sData.m_fArrowLength);
|
||||
markup_dimline->SetDoubleAttribute("m_fArrowAngle", sData.m_fArrowAngle);
|
||||
A3DMDDimensionLineSymbolGet(NULL, &sData);
|
||||
}
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseDimensionSecondPart(const A3DMDDimensionSecondPart* psSecondPart, _TiXmlElement* setting)
|
||||
{
|
||||
if (psSecondPart == NULL)
|
||||
return;
|
||||
|
||||
A3DMDDimensionSecondPartData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDDimensionSecondPartData, sData);
|
||||
|
||||
_TiXmlElement* markup_secondpart = new _TiXmlElement("A3DMDDimensionSecondPartData");
|
||||
setting->LinkEndChild(markup_secondpart);
|
||||
|
||||
A3DStatus iRet = A3DMDDimensionSecondPartGet(psSecondPart, &sData);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_secondpart->SetAttribute("error", iRet);
|
||||
return;
|
||||
}
|
||||
|
||||
markup_secondpart->SetAttribute("m_eOrientation", sData.m_eOrientation);
|
||||
markup_secondpart->SetDoubleAttribute("m_dAngle", sData.m_dAngle);
|
||||
markup_secondpart->SetDoubleAttribute("m_dOffSet", sData.m_dOffSet);
|
||||
|
||||
A3DMDDimensionSecondPartGet(NULL, &sData);
|
||||
}
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseDimensionForeshortened(const A3DMDDimensionForeshortened* psForeshortened, _TiXmlElement* setting)
|
||||
{
|
||||
if (psForeshortened == NULL)
|
||||
return;
|
||||
|
||||
A3DMDDimensionForeshortenedData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDDimensionForeshortenedData, sData);
|
||||
|
||||
_TiXmlElement* markup_Foreshortened = new _TiXmlElement("A3DMDDimensionForeshortenedData");
|
||||
setting->LinkEndChild(markup_Foreshortened);
|
||||
|
||||
A3DStatus iRet = A3DMDDimensionForeshortenedGet(psForeshortened, &sData);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_Foreshortened->SetAttribute("error", iRet);
|
||||
return;
|
||||
}
|
||||
|
||||
markup_Foreshortened->SetAttribute("m_bOrientation", sData.m_bOrientation);
|
||||
markup_Foreshortened->SetAttribute("m_bTextPosition", sData.m_bTextPosition);
|
||||
markup_Foreshortened->SetDoubleAttribute("m_dAngle", sData.m_dAngle);
|
||||
markup_Foreshortened->SetDoubleAttribute("m_fRatio", sData.m_fRatio);
|
||||
markup_Foreshortened->SetAttribute("m_usPointScale", sData.m_usPointScale);
|
||||
|
||||
A3DMDDimensionForeshortenedGet(NULL, &sData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseDimensionLine(const A3DMDDimensionLine* psLine, _TiXmlElement* setting)
|
||||
{
|
||||
if (psLine == NULL)
|
||||
return;
|
||||
|
||||
A3DMDDimensionLineData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDDimensionLineData, sData);
|
||||
|
||||
_TiXmlElement* markup_dimline = new _TiXmlElement("A3DMDDimensionLineData");
|
||||
setting->LinkEndChild(markup_dimline);
|
||||
|
||||
A3DStatus iRet = A3DMDDimensionLineGet(psLine, &sData);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_dimline->SetAttribute("error", iRet);
|
||||
return;
|
||||
}
|
||||
if (sData.m_pSymbol1)
|
||||
{
|
||||
_TiXmlElement* Symbol1 = new _TiXmlElement("Symbol1");
|
||||
markup_dimline->LinkEndChild(Symbol1);
|
||||
sttraverseDimensionLineSymbol(sData.m_pSymbol1, Symbol1);
|
||||
}
|
||||
if (sData.m_pSymbol2)
|
||||
{
|
||||
_TiXmlElement* Symbol2 = new _TiXmlElement("Symbol2");
|
||||
markup_dimline->LinkEndChild(Symbol2);
|
||||
sttraverseDimensionLineSymbol(sData.m_pSymbol2, Symbol2);
|
||||
}
|
||||
if (sData.m_pLeaderSymbol)
|
||||
{
|
||||
_TiXmlElement* LeaderSymbol = new _TiXmlElement("LeaderSymbol");
|
||||
markup_dimline->LinkEndChild(LeaderSymbol);
|
||||
sttraverseDimensionLineSymbol(sData.m_pLeaderSymbol, LeaderSymbol);
|
||||
}
|
||||
|
||||
markup_dimline->SetAttribute("m_eGraphRepresentation", sData.m_eGraphRepresentation);
|
||||
if (sData.m_pSecondPart)
|
||||
{
|
||||
_TiXmlElement* SecondPart = new _TiXmlElement("SecondPart");
|
||||
markup_dimline->LinkEndChild(SecondPart);
|
||||
sttraverseDimensionSecondPart(sData.m_pSecondPart, SecondPart);
|
||||
}
|
||||
|
||||
markup_dimline->SetAttribute("m_usStyle", sData.m_usStyle);
|
||||
markup_dimline->SetDoubleAttribute("m_fThickness", sData.m_fThickness);
|
||||
markup_dimline->SetAttribute("m_usReversal", sData.m_usReversal);
|
||||
|
||||
if (sData.m_psForeshortened)
|
||||
{
|
||||
_TiXmlElement* Foreshortened = new _TiXmlElement("Foreshortened");
|
||||
markup_dimline->LinkEndChild(Foreshortened);
|
||||
sttraverseDimensionForeshortened(sData.m_psForeshortened, Foreshortened);
|
||||
}
|
||||
markup_dimline->SetDoubleAttribute("m_dLeaderAngle", sData.m_dLeaderAngle);
|
||||
markup_dimline->SetAttribute("m_eExtension", sData.m_eExtension);
|
||||
|
||||
if (sData.m_pExplicitCurve)
|
||||
{
|
||||
_TiXmlElement* ExplicitCurve = new _TiXmlElement("ExplicitCurve");
|
||||
markup_dimline->LinkEndChild(ExplicitCurve);
|
||||
traverseCurve(sData.m_pExplicitCurve, ExplicitCurve);
|
||||
}
|
||||
|
||||
A3DMDDimensionLineGet(NULL, &sData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupDimension(const A3DMarkupDimension* pMarkup, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMarkupDimensionData sMarkupData;
|
||||
A3D_INITIALIZE_DATA(A3DMarkupDimensionData, sMarkupData);
|
||||
|
||||
_TiXmlElement* markup_dim = new _TiXmlElement("A3DMarkupDimensionData");
|
||||
setting->LinkEndChild(markup_dim);
|
||||
|
||||
A3DStatus iRet = A3DMarkupDimensionGet(pMarkup, &sMarkupData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_dim->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
sttraverseDimensionType(sMarkupData.m_eType, markup_dim);
|
||||
sttraverseDimensionValue(sMarkupData.m_pMainValue, markup_dim);
|
||||
|
||||
if(sMarkupData.m_pDualValue)
|
||||
{
|
||||
_TiXmlElement* markup_dualval = new _TiXmlElement("m_pDualValue");
|
||||
markup_dim->LinkEndChild(markup_dualval);
|
||||
|
||||
if(sMarkupData.m_eDualDisplay == KEA3DMDDimensionDualDisplayNone)
|
||||
markup_dualval->SetAttribute("m_eDualDisplay", "KEA3DMDDimensionDualDisplayNone");
|
||||
else if(sMarkupData.m_eDualDisplay == KEA3DMDDimensionDualDisplayBelow)
|
||||
markup_dualval->SetAttribute("m_eDualDisplay", "KEA3DMDDimensionDualDisplayBelow");
|
||||
else if(sMarkupData.m_eDualDisplay == KEA3DMDDimensionDualDisplayFractional)
|
||||
markup_dualval->SetAttribute("m_eDualDisplay", "KEA3DMDDimensionDualDisplayFractional");
|
||||
else if(sMarkupData.m_eDualDisplay == KEA3DMDDimensionDualDisplaySideBySide)
|
||||
markup_dualval->SetAttribute("m_eDualDisplay", "KEA3DMDDimensionDualDisplaySideBySide");
|
||||
else
|
||||
markup_dualval->SetAttribute("m_eDualDisplay", "unexpected");
|
||||
|
||||
sttraverseDimensionValue(sMarkupData.m_pDualValue, markup_dualval);
|
||||
}
|
||||
|
||||
markup_dim->SetDoubleAttribute("m_dValue", sMarkupData.m_dValue);
|
||||
markup_dim->SetAttribute("m_eSymbol", sMarkupData.m_eSymbol);
|
||||
markup_dim->SetAttribute("m_eAdditionnalSymbol", sMarkupData.m_eAdditionnalSymbol);
|
||||
markup_dim->SetAttribute("m_pcSuffixe", sMarkupData.m_pcSuffixe?sMarkupData.m_pcSuffixe : "null");
|
||||
markup_dim->SetAttribute("m_pcPrefixe", sMarkupData.m_pcPrefixe?sMarkupData.m_pcPrefixe : "null");
|
||||
if(sMarkupData.m_eType == KEA3DMDDimensionTypeChamfer)
|
||||
markup_dim->SetDoubleAttribute("m_dChamferDimSecondValue", sMarkupData.m_dChamferDimSecondValue);
|
||||
|
||||
sttraverseDimensionExtentionLine(sMarkupData.m_pExtentionLine, markup_dim);
|
||||
sttraverseDimensionLine(sMarkupData.m_pLine, markup_dim);
|
||||
markup_dim->SetAttribute("m_eOrientation", sMarkupData.m_eOrientation);
|
||||
markup_dim->SetAttribute("m_usPosition", sMarkupData.m_usPosition);
|
||||
|
||||
_TiXmlElement* markup_frame = new _TiXmlElement("Frame");
|
||||
markup_dim->LinkEndChild(markup_frame);
|
||||
markup_frame->SetAttribute("m_eFrame", sMarkupData.m_eFrame);
|
||||
markup_frame->SetAttribute("m_usFrame", sMarkupData.m_usFrame);
|
||||
markup_frame->SetAttribute("m_usFrameGroup", sMarkupData.m_usFrameGroup);
|
||||
|
||||
_TiXmlElement* markup_score = new _TiXmlElement("Score");
|
||||
markup_dim->LinkEndChild(markup_score);
|
||||
markup_score->SetAttribute("m_eScore", sMarkupData.m_eScore);
|
||||
markup_score->SetAttribute("m_usScore", sMarkupData.m_usScore);
|
||||
markup_score->SetAttribute("m_usScoreGroup", sMarkupData.m_usScoreGroup);
|
||||
|
||||
traverseMarkupTextProperties(sMarkupData.m_pTextProperties, markup_dim);
|
||||
|
||||
return A3DMarkupDimensionGet(NULL, &sMarkupData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseToleranceSizeValue(const A3DMDToleranceSizeValue* pToleranceSizeValue, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDToleranceSizeValueData sToleranceSizeValueData;
|
||||
A3D_INITIALIZE_DATA(A3DMDToleranceSizeValueData, sToleranceSizeValueData);
|
||||
|
||||
_TiXmlElement* markup_ToleranceSizeValue = new _TiXmlElement("A3DMDToleranceSizeValueData");
|
||||
setting->LinkEndChild(markup_ToleranceSizeValue);
|
||||
|
||||
A3DStatus iRet = A3DMDToleranceSizeValueGet(pToleranceSizeValue, &sToleranceSizeValueData);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_ToleranceSizeValue->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
sttraverseDimensionType(sToleranceSizeValueData.m_eType, markup_ToleranceSizeValue);
|
||||
markup_ToleranceSizeValue->SetDoubleAttribute("m_dValue", sToleranceSizeValueData.m_dValue);
|
||||
|
||||
markup_ToleranceSizeValue->SetAttribute("m_pcSeparator", sToleranceSizeValueData.m_pcSeparator ? sToleranceSizeValueData.m_pcSeparator : "null");
|
||||
|
||||
_TiXmlElement* MainValue = new _TiXmlElement("A3DMDDimensionValue");
|
||||
markup_ToleranceSizeValue->LinkEndChild(MainValue);
|
||||
if (sToleranceSizeValueData.m_sMainValue.m_iType == 0)
|
||||
MainValue->SetAttribute("m_iType", "true value");
|
||||
else if (sToleranceSizeValueData.m_sMainValue.m_iType == 1)
|
||||
MainValue->SetAttribute("m_iType", "fake num value");
|
||||
else if (sToleranceSizeValueData.m_sMainValue.m_iType == 2)
|
||||
MainValue->SetAttribute("m_iType", "fake alpha num value");
|
||||
else
|
||||
MainValue->SetAttribute("m_iType", "unexpected");
|
||||
|
||||
MainValue->SetAttribute("m_bFormat", sToleranceSizeValueData.m_sMainValue.m_bFormat ? "decimal format" : "fractional");
|
||||
MainValue->SetDoubleAttribute("m_dAccuracy", sToleranceSizeValueData.m_sMainValue.m_dAccuracy);
|
||||
MainValue->SetDoubleAttribute("m_dToleranceAccuracy", sToleranceSizeValueData.m_sMainValue.m_dToleranceAccuracy);
|
||||
MainValue->SetAttribute("m_pcFakeValue", sToleranceSizeValueData.m_sMainValue.m_pcFakeValue ? sToleranceSizeValueData.m_sMainValue.m_pcFakeValue : "null");
|
||||
MainValue->SetDoubleAttribute("m_dTolNumSup", sToleranceSizeValueData.m_sMainValue.m_dTolNumSup);
|
||||
MainValue->SetDoubleAttribute("m_dTolNumInf", sToleranceSizeValueData.m_sMainValue.m_dTolNumInf);
|
||||
MainValue->SetAttribute("m_pcTolTxtSup", sToleranceSizeValueData.m_sMainValue.m_pcTolTxtSup ? sToleranceSizeValueData.m_sMainValue.m_pcTolTxtSup : "null");
|
||||
MainValue->SetAttribute("m_pcTolTxtInf", sToleranceSizeValueData.m_sMainValue.m_pcTolTxtInf ? sToleranceSizeValueData.m_sMainValue.m_pcTolTxtInf : "null");
|
||||
MainValue->SetAttribute("m_pcBeforeText", sToleranceSizeValueData.m_sMainValue.m_pcBeforeText ? sToleranceSizeValueData.m_sMainValue.m_pcBeforeText : "null");
|
||||
MainValue->SetAttribute("m_pcAfterText", sToleranceSizeValueData.m_sMainValue.m_pcAfterText ? sToleranceSizeValueData.m_sMainValue.m_pcAfterText : "null");
|
||||
MainValue->SetAttribute("m_pcAboveText", sToleranceSizeValueData.m_sMainValue.m_pcAboveText ? sToleranceSizeValueData.m_sMainValue.m_pcAboveText : "null");
|
||||
MainValue->SetAttribute("m_pcBelowText", sToleranceSizeValueData.m_sMainValue.m_pcBelowText ? sToleranceSizeValueData.m_sMainValue.m_pcBelowText : "null");
|
||||
MainValue->SetAttribute("m_usLastSeparDefinedNum", sToleranceSizeValueData.m_sMainValue.m_usLastSeparDefinedNum);
|
||||
|
||||
MainValue->SetAttribute("m_iOption", sToleranceSizeValueData.m_sMainValue.m_iOption);
|
||||
MainValue->SetDoubleAttribute("m_dDeltaForMinMax", sToleranceSizeValueData.m_sMainValue.m_dDeltaForMinMax);
|
||||
|
||||
sttraverseDimensionValueFormat(sToleranceSizeValueData.m_sMainValue.m_pDimValueFormat, MainValue);
|
||||
sttraverseDimensionToleranceFormat(sToleranceSizeValueData.m_sMainValue.m_pToleranceFormat, MainValue);
|
||||
|
||||
if (sToleranceSizeValueData.m_sMainValue.m_pChamferDimSecondValue)
|
||||
sttraverseDimensionValue(sToleranceSizeValueData.m_sMainValue.m_pChamferDimSecondValue, MainValue);
|
||||
|
||||
sttraverseDimensionValue(sToleranceSizeValueData.m_pDualValue, MainValue);
|
||||
|
||||
return A3DMDToleranceSizeValueGet(NULL, &sToleranceSizeValueData);
|
||||
}
|
||||
658
exchange/exchangesource/PRC2XML/PRC2XMLMarkupGDT.cpp
Normal file
658
exchange/exchangesource/PRC2XML/PRC2XMLMarkupGDT.cpp
Normal file
@@ -0,0 +1,658 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
static void stvAddModifier(int iModifier, _TiXmlElement* setting)
|
||||
{
|
||||
switch(iModifier)
|
||||
{
|
||||
case KEA3DGDTModifierNone: setting->SetAttribute("m_eModifier", "none"); break;
|
||||
case KEA3DGDTModifierMax: setting->SetAttribute("m_eModifier", "maximum material condition"); break;
|
||||
case KEA3DGDTModifierMin: setting->SetAttribute("m_eModifier", "least material condition"); break;
|
||||
case KEA3DGDTModifierProj: setting->SetAttribute("m_eModifier", "projected tolerance zone"); break;
|
||||
case KEA3DGDTModifierFree: setting->SetAttribute("m_eModifier", "free state"); break;
|
||||
case KEA3DGDTModifierRfs: setting->SetAttribute("m_eModifier", "regardless of feature size"); break;
|
||||
case KEA3DGDTModifierTangent: setting->SetAttribute("m_eModifier", "tangent plane"); break;
|
||||
case KEA3DGDTModifierST: setting->SetAttribute("m_eModifier", "statical"); break;
|
||||
default: setting->SetAttribute("m_eModifier", "unexpected"); break;
|
||||
}
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void stvAddGDTType(int itype, _TiXmlElement* setting)
|
||||
{
|
||||
switch(itype)
|
||||
{
|
||||
case KEA3DGDTTypeNone: setting->SetAttribute("m_eType", "none"); break;
|
||||
case KEA3DGDTTypeStraightness: setting->SetAttribute("m_eType", "Straightness"); break;
|
||||
case KEA3DGDTTypeFlatness: setting->SetAttribute("m_eType", "Flatness"); break;
|
||||
case KEA3DGDTTypeCircularity: setting->SetAttribute("m_eType", "Circularity"); break;
|
||||
case KEA3DGDTTypeCylindricity: setting->SetAttribute("m_eType", "Cylindricity"); break;
|
||||
case KEA3DGDTTypeLineProfile: setting->SetAttribute("m_eType", "Profile of a line"); break;
|
||||
case KEA3DGDTTypeSurfaceProfile: setting->SetAttribute("m_eType", "Profile of a surface"); break;
|
||||
case KEA3DGDTTypeAngularity: setting->SetAttribute("m_eType", "Angularity"); break;
|
||||
case KEA3DGDTTypePerpendicularity: setting->SetAttribute("m_eType", "Perpendicularity"); break;
|
||||
case KEA3DGDTTypeParallelism: setting->SetAttribute("m_eType", "Parallel"); break;
|
||||
case KEA3DGDTTypePosition: setting->SetAttribute("m_eType", "Positional"); break;
|
||||
case KEA3DGDTTypeConcentricity: setting->SetAttribute("m_eType", "Concentricity"); break;
|
||||
case KEA3DGDTTypeSymmetry: setting->SetAttribute("m_eType", "Symmetric"); break;
|
||||
case KEA3DGDTTypeCircularRunout: setting->SetAttribute("m_eType", "Circular run out"); break;
|
||||
case KEA3DGDTTypeTotalRunout: setting->SetAttribute("m_eType", "Total run out"); break;
|
||||
default: setting->SetAttribute("m_eType", "unexpected"); break;
|
||||
}
|
||||
}
|
||||
|
||||
static int sttraverseFCFDraftingIndicator(const A3DMDFCFDraftingIndicatorData& sData, _TiXmlElement* indicator);
|
||||
//######################################################################################################################
|
||||
static int sttraverseDraftingRow(const A3DMDFCFDraftingRow *psRow, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDFCFDraftingRowData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCFDraftingRowData, sData);
|
||||
|
||||
_TiXmlElement* drft_row = new _TiXmlElement("A3DMDFCFDraftingRowData");
|
||||
setting->LinkEndChild(drft_row);
|
||||
|
||||
A3DStatus iRet = A3DMDFCFDraftingRowGet(psRow, &sData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
drft_row->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
stvAddGDTType(sData.m_eType, drft_row);
|
||||
|
||||
_TiXmlElement* row_boxes = new _TiXmlElement("A3DMDFCFDraftingRowData");
|
||||
drft_row->LinkEndChild(row_boxes);
|
||||
if(sData.m_uiNumberOfTextsInBoxes == 0)
|
||||
row_boxes->SetAttribute("error", "no box");
|
||||
|
||||
A3DUns32 i;
|
||||
char sName[20];
|
||||
for(i = 0; i < sData.m_uiNumberOfTextsInBoxes; ++i)
|
||||
{
|
||||
sprintf_s(sName,sizeof(sName)-1, "box_%u", i);
|
||||
if(sData.m_ppcTextsInBoxes[i] == NULL)
|
||||
{
|
||||
row_boxes->SetAttribute("error", "no text in box");
|
||||
continue;
|
||||
}
|
||||
row_boxes->SetAttribute(sName, sData.m_ppcTextsInBoxes[i]);
|
||||
}
|
||||
if (sData.m_uiNumberOfIndicators)
|
||||
{
|
||||
_TiXmlElement* indicators = new _TiXmlElement("m_ppIndicators");
|
||||
drft_row->LinkEndChild(indicators);
|
||||
for (i = 0; i < sData.m_uiNumberOfIndicators; ++i)
|
||||
{
|
||||
A3DMDFCFDraftingIndicatorData sIndicatorData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCFDraftingIndicatorData, sIndicatorData);
|
||||
iRet = A3DMDFCFDraftingIndicatorGet(sData.m_ppIndicators[i], &sIndicatorData);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* indicator = new _TiXmlElement("A3DMDFCFIndicatorData");
|
||||
indicators->LinkEndChild(indicator);
|
||||
sttraverseFCFDraftingIndicator(sIndicatorData, indicator);
|
||||
A3DMDFCFDraftingIndicatorGet(nullptr, &sIndicatorData);
|
||||
}
|
||||
else
|
||||
{
|
||||
drft_row->SetAttribute("error", "A3DMDFCFIndicatorGet");
|
||||
}
|
||||
}
|
||||
}
|
||||
return A3DMDFCFDraftingRowGet(NULL, &sData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseDatumReference(const char* pcTitle, A3DMDFCFRowDatum* psDatum, _TiXmlElement* drw_row)
|
||||
{
|
||||
_TiXmlElement* datum_ref = new _TiXmlElement(pcTitle);
|
||||
drw_row->LinkEndChild(datum_ref);
|
||||
|
||||
A3DMDFCFRowDatumData sDatumData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCFRowDatumData, sDatumData);
|
||||
|
||||
A3DStatus iRet = A3DMDFCFRowDatumGet(psDatum, &sDatumData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
drw_row->SetAttribute("error", iRet);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
datum_ref->SetAttribute("m_pcDatum", sDatumData.m_pcDatum?sDatumData.m_pcDatum : "null");
|
||||
stvAddModifier(sDatumData.m_eModifier, datum_ref);
|
||||
|
||||
if(sDatumData.m_pLinkedItem)
|
||||
traverseLinkedItem(sDatumData.m_pLinkedItem, datum_ref);
|
||||
A3DMDFCFRowDatum* pNext = nullptr;
|
||||
if ((pNext = sDatumData.m_pNext)!= nullptr)
|
||||
{
|
||||
A3DMDFCFRowDatumGet(nullptr, &sDatumData);
|
||||
return sttraverseDatumReference("next", pNext, datum_ref);
|
||||
}
|
||||
|
||||
return A3DMDFCFRowDatumGet(nullptr, &sDatumData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseRowToleranceValue(const A3DMDFCFToleranceValueData& sToleranceData, _TiXmlElement* semantic_value)
|
||||
{
|
||||
A3DStatus iRet = A3D_SUCCESS;
|
||||
// value
|
||||
if (sToleranceData.m_eValueType == KEA3DGDTValueNone)
|
||||
semantic_value->SetAttribute("m_eValueType", "none");
|
||||
else if (sToleranceData.m_eValueType == KEA3DGDTValueDiameter)
|
||||
semantic_value->SetAttribute("m_eValueType", "diameter");
|
||||
else if (sToleranceData.m_eValueType == KEA3DGDTValueRadius)
|
||||
semantic_value->SetAttribute("m_eValueType", "radius");
|
||||
else if (sToleranceData.m_eValueType == KEA3DGDTValueSpherical)
|
||||
semantic_value->SetAttribute("m_eValueType", "spherical");
|
||||
else
|
||||
semantic_value->SetAttribute("m_eValueType", "unexpected");
|
||||
|
||||
|
||||
// modifier
|
||||
stvAddModifier(sToleranceData.m_eModifier, semantic_value);
|
||||
semantic_value->SetAttribute("m_bFreeState", sToleranceData.m_bFreeState ? "true" : "false");
|
||||
semantic_value->SetAttribute("m_bStatistical", sToleranceData.m_bStatistical ? "true" : "false");
|
||||
|
||||
|
||||
// main value
|
||||
if (sToleranceData.m_sValue.m_bIsValue)
|
||||
{
|
||||
if (sToleranceData.m_sValue.m_pcValue == NULL)
|
||||
semantic_value->SetAttribute("m_sValue.m_pcValue", "NULL");
|
||||
else
|
||||
semantic_value->SetAttribute("m_sValue.m_pcValue", sToleranceData.m_sValue.m_pcValue);
|
||||
}
|
||||
else
|
||||
semantic_value->SetDoubleAttribute("m_sValue.m_dValue", sToleranceData.m_sValue.m_dValue);
|
||||
|
||||
// tolerance per unit
|
||||
if (sToleranceData.m_psTolerancePerUnit)
|
||||
{
|
||||
_TiXmlElement* tol_per_unit = new _TiXmlElement("m_psTolerancePerUnit");
|
||||
semantic_value->LinkEndChild(tol_per_unit);
|
||||
|
||||
A3DMDFCTolerancePerUnitData sTolerancePerUnitData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCTolerancePerUnitData, sTolerancePerUnitData);
|
||||
|
||||
iRet = A3DMDFCTolerancePerUnitGet(sToleranceData.m_psTolerancePerUnit, &sTolerancePerUnitData);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
tol_per_unit->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
tol_per_unit->SetDoubleAttribute("m_dUnitLengthOrAreaFirstValue", sTolerancePerUnitData.m_dUnitLengthOrAreaFirstValue);
|
||||
if (sTolerancePerUnitData.m_pdUnitAreaSecondLength)
|
||||
tol_per_unit->SetDoubleAttribute("m_pdUnitAreaSecondLength", *sTolerancePerUnitData.m_pdUnitAreaSecondLength);
|
||||
|
||||
if (sTolerancePerUnitData.m_psRefinementZone)
|
||||
{
|
||||
_TiXmlElement* tol_per_unit_ref = new _TiXmlElement("m_psRefinementZone");
|
||||
tol_per_unit->LinkEndChild(tol_per_unit_ref);
|
||||
|
||||
A3DMDFCValueData sValueData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCValueData, sValueData);
|
||||
|
||||
iRet = A3DMDFCValueGet(sTolerancePerUnitData.m_psRefinementZone, &sValueData);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
tol_per_unit_ref->SetAttribute("refinement_zone_error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
if (sValueData.m_bIsValue)
|
||||
{
|
||||
if (sValueData.m_pcValue == NULL)
|
||||
tol_per_unit_ref->SetAttribute("m_sValue.m_pcValue", "NULL");
|
||||
else
|
||||
tol_per_unit_ref->SetAttribute("m_sValue.m_pcValue", sValueData.m_pcValue);
|
||||
}
|
||||
else
|
||||
tol_per_unit_ref->SetDoubleAttribute("m_sValue.m_dValue", sValueData.m_dValue);
|
||||
|
||||
CHECK_RET(A3DMDFCValueGet(NULL, &sValueData));
|
||||
}
|
||||
|
||||
CHECK_RET(A3DMDFCTolerancePerUnitGet(NULL, &sTolerancePerUnitData));
|
||||
}
|
||||
|
||||
// projected zone
|
||||
if (sToleranceData.m_psProjectedZone)
|
||||
{
|
||||
_TiXmlElement* proj_zone = new _TiXmlElement("m_psProjectedZone");
|
||||
semantic_value->LinkEndChild(proj_zone);
|
||||
|
||||
A3DMDFCProjectedZoneData sProjectedZoneData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCProjectedZoneData, sProjectedZoneData);
|
||||
|
||||
iRet = A3DMDFCProjectedZoneGet(sToleranceData.m_psProjectedZone, &sProjectedZoneData);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
proj_zone->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
if (sProjectedZoneData.m_sLength.m_bIsValue)
|
||||
{
|
||||
if (sProjectedZoneData.m_sLength.m_pcValue == NULL)
|
||||
proj_zone->SetAttribute("m_sLength.m_pcValue", "NULL");
|
||||
else
|
||||
proj_zone->SetAttribute("m_sLength.m_pcValue", sProjectedZoneData.m_sLength.m_pcValue);
|
||||
}
|
||||
else
|
||||
proj_zone->SetDoubleAttribute("m_sLength.m_dValue", sProjectedZoneData.m_sLength.m_dValue);
|
||||
|
||||
if (sProjectedZoneData.m_pdPosition)
|
||||
proj_zone->SetDoubleAttribute("m_pdPosition", *sProjectedZoneData.m_pdPosition);
|
||||
CHECK_RET(A3DMDFCProjectedZoneGet(NULL, &sProjectedZoneData));
|
||||
}
|
||||
|
||||
// profile tolerance offset
|
||||
if (sToleranceData.m_psProfileTolerance)
|
||||
{
|
||||
_TiXmlElement* prof_tolerance = new _TiXmlElement("m_psProfileTolerance");
|
||||
semantic_value->LinkEndChild(prof_tolerance);
|
||||
|
||||
A3DMDFCValueData sValueData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCValueData, sValueData);
|
||||
|
||||
iRet = A3DMDFCValueGet(sToleranceData.m_psProfileTolerance, &sValueData);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
prof_tolerance->SetAttribute("profile_tolerance_error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
if (sValueData.m_bIsValue)
|
||||
{
|
||||
if (sValueData.m_pcValue == NULL)
|
||||
prof_tolerance->SetAttribute("m_sValue.m_pcValue", "NULL");
|
||||
else
|
||||
prof_tolerance->SetAttribute("m_sValue.m_pcValue", sValueData.m_pcValue);
|
||||
}
|
||||
else
|
||||
prof_tolerance->SetDoubleAttribute("m_dValue", sValueData.m_dValue);
|
||||
|
||||
CHECK_RET(A3DMDFCValueGet(NULL, &sValueData));
|
||||
}
|
||||
|
||||
// maximum bonus
|
||||
if (sToleranceData.m_psMaximumBonus)
|
||||
{
|
||||
_TiXmlElement* max_bonus = new _TiXmlElement("m_psMaximumBonus");
|
||||
semantic_value->LinkEndChild(max_bonus);
|
||||
A3DMDFCValueData sValueData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCValueData, sValueData);
|
||||
iRet = A3DMDFCValueGet(sToleranceData.m_psMaximumBonus, &sValueData);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
max_bonus->SetAttribute("maximum_bonus_error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
if (sValueData.m_bIsValue)
|
||||
{
|
||||
if (sValueData.m_pcValue == NULL)
|
||||
max_bonus->SetAttribute("m_sValue.m_pcValue", "NULL");
|
||||
else
|
||||
max_bonus->SetAttribute("m_sValue.m_pcValue", sValueData.m_pcValue);
|
||||
}
|
||||
else
|
||||
max_bonus->SetDoubleAttribute("m_dValue", sValueData.m_dValue);
|
||||
|
||||
CHECK_RET(A3DMDFCValueGet(NULL, &sValueData));
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseDrawingRow(const A3DMDFCFDrawingRowData& sData, _TiXmlElement* drw_row)
|
||||
{
|
||||
A3DStatus iRet;
|
||||
|
||||
// row type
|
||||
stvAddGDTType(sData.m_eType, drw_row);
|
||||
|
||||
drw_row->SetAttribute("m_pcValue", sData.m_pcValue ? sData.m_pcValue : "null");
|
||||
|
||||
// references
|
||||
if(sData.m_psPrimaryRef)
|
||||
sttraverseDatumReference("m_psPrimaryRef", sData.m_psPrimaryRef, drw_row);
|
||||
if(sData.m_psSecondaryRef)
|
||||
sttraverseDatumReference("m_psSecondaryRef", sData.m_psSecondaryRef, drw_row);
|
||||
if(sData.m_psTertiaryRef)
|
||||
sttraverseDatumReference("m_psTertiaryRef", sData.m_psTertiaryRef, drw_row);
|
||||
|
||||
if(sData.m_psSemanticValue == NULL)
|
||||
{
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
// semantic tolerance value
|
||||
_TiXmlElement* semantic_value = new _TiXmlElement("m_psSemanticValue");
|
||||
drw_row->LinkEndChild(semantic_value);
|
||||
|
||||
A3DMDFCFToleranceValueData sSemanticData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCFToleranceValueData, sSemanticData);
|
||||
|
||||
iRet = A3DMDFCFToleranceValueGet(sData.m_psSemanticValue, &sSemanticData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
semantic_value->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
sttraverseRowToleranceValue(sSemanticData, semantic_value);
|
||||
|
||||
_TiXmlElement* semantic_value2 = new _TiXmlElement("m_psNextSemanticValue");
|
||||
drw_row->LinkEndChild(semantic_value2);
|
||||
|
||||
A3DMDFCFToleranceValueData sSemanticData2;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCFToleranceValueData, sSemanticData2);
|
||||
|
||||
iRet = A3DMDFCFToleranceValueGet(sSemanticData.m_psNext, &sSemanticData2);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
semantic_value2->SetAttribute("error", iRet);
|
||||
CHECK_RET(A3DMDFCFToleranceValueGet(NULL, &sSemanticData));
|
||||
return iRet;
|
||||
}
|
||||
|
||||
drw_row->SetAttribute("m_pcNextValue", sSemanticData2.m_sValue.m_pcValue ? sSemanticData2.m_sValue.m_pcValue : "null");
|
||||
sttraverseRowToleranceValue(sSemanticData2, semantic_value2);
|
||||
CHECK_RET(A3DMDFCFToleranceValueGet(NULL, &sSemanticData2));
|
||||
CHECK_RET(A3DMDFCFToleranceValueGet(NULL, &sSemanticData));
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseFCFDraftingIndicator(const A3DMDFCFDraftingIndicatorData& sData, _TiXmlElement* indicator)
|
||||
{
|
||||
// type
|
||||
if (sData.m_eType == kA3DFCFIndicatorType_Undef)
|
||||
indicator->SetAttribute("m_eType", "none");
|
||||
else if (sData.m_eType == kA3DFCFIndicatorType_DirectionFeature)
|
||||
indicator->SetAttribute("m_eType", "direction_feature");
|
||||
else if (sData.m_eType == kA3DFCFIndicatorType_CollectionPlane)
|
||||
indicator->SetAttribute("m_eType", "collection_plane");
|
||||
else if (sData.m_eType == kA3DFCFIndicatorType_IntersectionPlane)
|
||||
indicator->SetAttribute("m_eType", "intersection_plane");
|
||||
else if (sData.m_eType == kA3DFCFIndicatorType_OrientationPlane)
|
||||
indicator->SetAttribute("m_eType", "orientation_plane");
|
||||
else if (sData.m_eType == kA3DFCFIndicatorType_Text)
|
||||
indicator->SetAttribute("m_eType", "text");
|
||||
else
|
||||
indicator->SetAttribute("m_eType", "unexpected");
|
||||
|
||||
char sName[20];
|
||||
for (unsigned i = 0; i < sData.m_uiNumberOfTexts; ++i)
|
||||
{
|
||||
sprintf(sName, "m_pctext_%u", i);
|
||||
if (sData.m_ppcTexts[i])
|
||||
indicator->SetAttribute(sName, sData.m_ppcTexts[i]);
|
||||
}
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseFCFIndicator(const A3DMDFCFIndicatorData& sData, _TiXmlElement* indicator)
|
||||
{
|
||||
// type
|
||||
if (sData.m_eType == kA3DFCFIndicatorType_Undef)
|
||||
indicator->SetAttribute("m_eType", "none");
|
||||
else if (sData.m_eType == kA3DFCFIndicatorType_DirectionFeature)
|
||||
indicator->SetAttribute("m_eType", "direction_feature");
|
||||
else if (sData.m_eType == kA3DFCFIndicatorType_CollectionPlane)
|
||||
indicator->SetAttribute("m_eType", "collection_plane");
|
||||
else if (sData.m_eType == kA3DFCFIndicatorType_IntersectionPlane)
|
||||
indicator->SetAttribute("m_eType", "intersection_plane");
|
||||
else if (sData.m_eType == kA3DFCFIndicatorType_OrientationPlane)
|
||||
indicator->SetAttribute("m_eType", "orientation_plane");
|
||||
else if (sData.m_eType == kA3DFCFIndicatorType_Text)
|
||||
indicator->SetAttribute("m_eType", "text");
|
||||
else
|
||||
indicator->SetAttribute("m_eType", "unexpected");
|
||||
|
||||
// symbol
|
||||
if (sData.m_eSymbol == kA3DFCFIndicatorSymbol_Undef)
|
||||
indicator->SetAttribute("m_eSymbol", "none");
|
||||
else if (sData.m_eSymbol == kA3DFCFIndicatorSymbol_Angularity)
|
||||
indicator->SetAttribute("m_eSymbol", "angularity");
|
||||
else if (sData.m_eSymbol == kA3DFCFIndicatorSymbol_Perpendicularity)
|
||||
indicator->SetAttribute("m_eSymbol", "perpendicularity");
|
||||
else if (sData.m_eSymbol == kA3DFCFIndicatorSymbol_Parallelism)
|
||||
indicator->SetAttribute("m_eSymbol", "parallelism");
|
||||
else if (sData.m_eSymbol == kA3DFCFIndicatorSymbol_Symmetry)
|
||||
indicator->SetAttribute("m_eSymbol", "symmetry");
|
||||
else if (sData.m_eSymbol == kA3DFCFIndicatorSymbol_Runout)
|
||||
indicator->SetAttribute("m_eSymbol", "runout");
|
||||
else
|
||||
indicator->SetAttribute("m_eSymbol", "unexpected");
|
||||
|
||||
// datum
|
||||
if (sData.m_pDatum)
|
||||
sttraverseDatumReference("m_pDatum", sData.m_pDatum, indicator);
|
||||
|
||||
if (sData.m_pcText && sData.m_eType == kA3DFCFIndicatorType_Text)
|
||||
indicator->SetAttribute("m_pcText", sData.m_pcText);
|
||||
|
||||
for (unsigned i = 0; i < sData.m_uiNumberOfLinkedItems; ++i)
|
||||
{
|
||||
if (sData.m_ppLinkedItems[i])
|
||||
traverseLinkedItem(sData.m_ppLinkedItems[i], indicator);
|
||||
}
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
//######################################################################################################################
|
||||
static int sttraverseFeatureControlFrameData(const A3DMDFeatureControlFrameData& sFeatureControlFrameData,
|
||||
_TiXmlElement* setting)
|
||||
{
|
||||
A3DUns32 r;
|
||||
A3DEEntityType eType = kA3DTypeUnknown;
|
||||
A3DStatus iRet;
|
||||
|
||||
_TiXmlElement* fcf = new _TiXmlElement("A3DMDFeatureControlFrameData");
|
||||
setting->LinkEndChild(fcf);
|
||||
|
||||
_TiXmlElement* rows = new _TiXmlElement("m_ppRows");
|
||||
fcf->LinkEndChild(rows);
|
||||
for(r = 0; r < sFeatureControlFrameData.m_uiNumberOfRows; ++r)
|
||||
{
|
||||
iRet = A3DEntityGetType(sFeatureControlFrameData.m_ppRows[r], &eType);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
rows->SetAttribute("error_A3DEntityGetType", iRet);
|
||||
continue;
|
||||
}
|
||||
|
||||
A3DMDFCFDrawingRowData sDrawingRowData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCFDrawingRowData, sDrawingRowData);
|
||||
|
||||
iRet = A3DMDFCFSemanticRowGet(sFeatureControlFrameData.m_ppRows[r], &sDrawingRowData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* drw_row = new _TiXmlElement("A3DMDFCFDrawingRowData");
|
||||
rows->LinkEndChild(drw_row);
|
||||
sttraverseDrawingRow(sDrawingRowData, drw_row);
|
||||
A3DMDFCFDrawingRowGet(NULL, &sDrawingRowData);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(eType != kA3DTypeMDFCFDraftingRow)
|
||||
rows->SetAttribute("error", "FCFRow");
|
||||
else
|
||||
sttraverseDraftingRow((const A3DMDFCFDraftingRow*) sFeatureControlFrameData.m_ppRows[r], rows);
|
||||
}
|
||||
|
||||
}
|
||||
if (sFeatureControlFrameData.m_uiNumberOfIndicators)
|
||||
{
|
||||
_TiXmlElement* indicators = new _TiXmlElement("m_ppIndicators");
|
||||
fcf->LinkEndChild(indicators);
|
||||
for (r = 0; r < sFeatureControlFrameData.m_uiNumberOfIndicators; ++r)
|
||||
{
|
||||
A3DMDFCFIndicatorData sIndicatorData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFCFIndicatorData, sIndicatorData);
|
||||
iRet = A3DMDFCFIndicatorGet(sFeatureControlFrameData.m_ppIndicators[r], &sIndicatorData);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* indicator = new _TiXmlElement("A3DMDFCFIndicatorData");
|
||||
indicators->LinkEndChild(indicator);
|
||||
sttraverseFCFIndicator(sIndicatorData, indicator);
|
||||
A3DMDFCFIndicatorGet(nullptr, &sIndicatorData);
|
||||
}
|
||||
else
|
||||
{
|
||||
fcf->SetAttribute("error", "A3DMDFCFIndicatorGet");
|
||||
}
|
||||
}
|
||||
}
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseToleranceSize(const A3DMDToleranceSize* pToleranceSize, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMDToleranceSizeData sToleranceSizeData;
|
||||
A3D_INITIALIZE_DATA(A3DMDToleranceSizeData, sToleranceSizeData);
|
||||
|
||||
_TiXmlElement* toleranceSize = new _TiXmlElement("A3DMDToleranceSizeData");
|
||||
setting->LinkEndChild(toleranceSize);
|
||||
|
||||
_TiXmlElement* values = new _TiXmlElement("m_ppTolSizeValue");
|
||||
toleranceSize->LinkEndChild(values);
|
||||
|
||||
A3DStatus iRet = A3DMDToleranceSizeGet(pToleranceSize, &sToleranceSizeData);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
toleranceSize->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
for (A3DUns32 i = 0; i < sToleranceSizeData.m_uiNumberOfSizeValues; ++i)
|
||||
{
|
||||
traverseToleranceSizeValue(sToleranceSizeData.m_ppTolSizeValue[i], toleranceSize);
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupGDT(const A3DMarkupGDT* psMarkup, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMarkupGDTData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMarkupGDTData, sData);
|
||||
|
||||
_TiXmlElement* markup_gdt = new _TiXmlElement("A3DMarkupGDTData");
|
||||
setting->LinkEndChild(markup_gdt);
|
||||
|
||||
A3DStatus iRet = A3DMarkupGDTGet(psMarkup, &sData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_gdt->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
markup_gdt->SetAttribute("m_pcAboveText", sData.m_pcAboveText ? sData.m_pcAboveText : "null");
|
||||
markup_gdt->SetAttribute("m_pcBelowText", sData.m_pcBelowText ? sData.m_pcBelowText : "null");
|
||||
markup_gdt->SetAttribute("m_pcBeforeText", sData.m_pcBeforeText ? sData.m_pcBeforeText : "null");
|
||||
markup_gdt->SetAttribute("m_pcAfterText", sData.m_pcAfterText ? sData.m_pcAfterText : "null");
|
||||
|
||||
A3DUns32 i;
|
||||
char sName[20];
|
||||
A3DEEntityType eType = kA3DTypeUnknown;
|
||||
_TiXmlElement* tolerance = NULL;
|
||||
for (i = 0; i < sData.m_uiNumberOfMarkupTolerances; ++i)
|
||||
{
|
||||
sprintf_s(sName, sizeof(sName)-1,"A3DMDTolerance_%u", i);
|
||||
tolerance = new _TiXmlElement(sName);
|
||||
markup_gdt->LinkEndChild(tolerance);
|
||||
iRet = A3DEntityGetType(sData.m_ppsMarkupTolerances[i], &eType);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
tolerance->SetAttribute("error", iRet);
|
||||
continue;
|
||||
}
|
||||
if (eType == kA3DTypeMDFeatureControlFrame)
|
||||
{
|
||||
// semantic data
|
||||
A3DMDFeatureControlFrameData sFCFData;
|
||||
A3D_INITIALIZE_DATA(A3DMDFeatureControlFrameData, sFCFData);
|
||||
|
||||
iRet = A3DMDSemanticFeatureControlFrameGet(sData.m_ppsMarkupTolerances[i], &sFCFData);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* semantic_data = new _TiXmlElement("SEMANTIC_DATA");
|
||||
tolerance->LinkEndChild(semantic_data);
|
||||
sttraverseFeatureControlFrameData(sFCFData, semantic_data);
|
||||
A3DMDSemanticFeatureControlFrameGet(NULL, &sFCFData);
|
||||
}
|
||||
else if (A3DMDFeatureControlFrameGet(sData.m_ppsMarkupTolerances[i], &sFCFData) == A3D_SUCCESS)
|
||||
{
|
||||
sttraverseFeatureControlFrameData(sFCFData, tolerance);
|
||||
A3DMDFeatureControlFrameGet(NULL, &sFCFData);
|
||||
}
|
||||
else
|
||||
tolerance->SetAttribute("error", iRet);
|
||||
}
|
||||
else if (eType == kA3DTypeMDToleranceSize)
|
||||
{
|
||||
sttraverseToleranceSize(sData.m_ppsMarkupTolerances[i], tolerance);
|
||||
}
|
||||
else
|
||||
{
|
||||
tolerance->SetAttribute("eType", "unexpected");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// text properties
|
||||
traverseMarkupTextProperties(sData.m_pTextProperties, setting);
|
||||
|
||||
return A3DMarkupGDTGet(NULL, &sData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupDatum(const A3DMarkupDatum* psMarkup, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMarkupDatumData sMarkupData;
|
||||
A3D_INITIALIZE_DATA(A3DMarkupDatumData, sMarkupData);
|
||||
_TiXmlElement* markup_datum = new _TiXmlElement("A3DMarkupDatumData");
|
||||
setting->LinkEndChild(markup_datum);
|
||||
A3DStatus iRet = A3DMarkupDatumGet(psMarkup, &sMarkupData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_datum->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
markup_datum->SetAttribute("m_pcUpText", sMarkupData.m_pcUpText?sMarkupData.m_pcUpText:"NULL");
|
||||
markup_datum->SetAttribute("m_pcDownText", sMarkupData.m_pcDownText?sMarkupData.m_pcDownText:"NULL");
|
||||
|
||||
markup_datum->SetAttribute("m_bTarget", sMarkupData.m_bTarget ? "true" : "false");
|
||||
markup_datum->SetAttribute("m_bDiameter", sMarkupData.m_bDiameter ? "true" : "false");
|
||||
markup_datum->SetAttribute("m_bIndividual", sMarkupData.m_bIndividual ? "true" : "false");
|
||||
|
||||
|
||||
markup_datum->SetAttribute("m_pcAboveText", sMarkupData.m_pcAboveText ? sMarkupData.m_pcAboveText : "null");
|
||||
markup_datum->SetAttribute("m_pcBelowText", sMarkupData.m_pcBelowText ? sMarkupData.m_pcBelowText : "null");
|
||||
markup_datum->SetAttribute("m_pcBeforeText", sMarkupData.m_pcBeforeText ? sMarkupData.m_pcBeforeText : "null");
|
||||
markup_datum->SetAttribute("m_pcAfterText", sMarkupData.m_pcAfterText ? sMarkupData.m_pcAfterText : "null");
|
||||
|
||||
traverseMarkupTextProperties(sMarkupData.m_pTextProperties, markup_datum);
|
||||
return A3DMarkupDatumGet(NULL, &sMarkupData);
|
||||
}
|
||||
262
exchange/exchangesource/PRC2XML/PRC2XMLMarkupText.cpp
Normal file
262
exchange/exchangesource/PRC2XML/PRC2XMLMarkupText.cpp
Normal file
@@ -0,0 +1,262 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseFrameType(int iFrameType, _TiXmlElement* setting)
|
||||
{
|
||||
switch(iFrameType)
|
||||
{
|
||||
case KA3DMarkupFrameNone: setting->SetAttribute("m_eFrameType", "No Frame"); break;
|
||||
case KA3DMarkupFrameRectangle: setting->SetAttribute("m_eFrameType", "Rectangle"); break;
|
||||
case KA3DMarkupFrameSquare: setting->SetAttribute("m_eFrameType", "Square"); break;
|
||||
case KA3DMarkupFrameCircle: setting->SetAttribute("m_eFrameType", "Circle"); break;
|
||||
case KA3DMarkupFrameScoredCircle: setting->SetAttribute("m_eFrameType", "Scored Circle"); break;
|
||||
case KA3DMarkupFrameDiamond: setting->SetAttribute("m_eFrameType", "Diamond"); break;
|
||||
case KA3DMarkupFrameTriangle: setting->SetAttribute("m_eFrameType", "Triangle"); break;
|
||||
case KA3DMarkupFrameRightFlag: setting->SetAttribute("m_eFrameType", "Right Flag"); break;
|
||||
case KA3DMarkupFrameLeftFlag: setting->SetAttribute("m_eFrameType", "Left Flag"); break;
|
||||
case KA3DMarkupFrameBothFlag: setting->SetAttribute("m_eFrameType", "Both Flag"); break;
|
||||
case KA3DMarkupFrameOblong: setting->SetAttribute("m_eFrameType", "Oblong"); break;
|
||||
case KA3DMarkupFrameEllipse: setting->SetAttribute("m_eFrameType", "Ellipse"); break;
|
||||
case KA3DMarkupFrameFixRectangle: setting->SetAttribute("m_eFrameType", "Fixed Rectangle"); break;
|
||||
case KA3DMarkupFrameFixSquare: setting->SetAttribute("m_eFrameType", "Fixed Square"); break;
|
||||
case KA3DMarkupFrameFixCircle: setting->SetAttribute("m_eFrameType", "Fixed Circle"); break;
|
||||
case KA3DMarkupFrameFixScoredCircle: setting->SetAttribute("m_eFrameType", "Fixed Scored Circle"); break;
|
||||
case KA3DMarkupFrameFixDiamond: setting->SetAttribute("m_eFrameType", "Fixed Diamond"); break;
|
||||
case KA3DMarkupFrameFixTriangle: setting->SetAttribute("m_eFrameType", "Fixed Triangle"); break;
|
||||
case KA3DMarkupFrameFixRightFlag: setting->SetAttribute("m_eFrameType", "Fixed Right Flag"); break;
|
||||
case KA3DMarkupFrameFixLeftFlag: setting->SetAttribute("m_eFrameType", "Fixed Left Flag"); break;
|
||||
case KA3DMarkupFrameFixBothFlag: setting->SetAttribute("m_eFrameType", "Fixed Both Flag"); break;
|
||||
case KA3DMarkupFrameFixOblong: setting->SetAttribute("m_eFrameType", "Fixed Oblong"); break;
|
||||
case KA3DMarkupFrameFixEllipse: setting->SetAttribute("m_eFrameType", "Fixed Ellipse"); break;
|
||||
case KA3DMarkupFrameCustom: setting->SetAttribute("m_eFrameType", "Custom"); break;
|
||||
default: setting->SetAttribute("m_eFrameType", "unexpected"); break;
|
||||
}
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseAlignmentType(int iAlignmentType, _TiXmlElement* setting)
|
||||
{
|
||||
switch(iAlignmentType)
|
||||
{
|
||||
case KA3DLeaderAlignment_Simple: setting->SetAttribute("m_eLeaderAlignmentType", "Simple"); break;
|
||||
case KA3DLeaderAlignment_Below: setting->SetAttribute("m_eLeaderAlignmentType", "Below"); break;
|
||||
case KA3DLeaderAlignment_Underline: setting->SetAttribute("m_eLeaderAlignmentType", "Underline"); break;
|
||||
case KA3DLeaderAlignment_ExtToMax: setting->SetAttribute("m_eLeaderAlignmentType", "Extend to line maximum"); break;
|
||||
case KA3DLeaderAlignment_OnBoxPoint: setting->SetAttribute("m_eLeaderAlignmentType", "On box point"); break;
|
||||
case KA3DLeaderAlignment_SimpleOnBoxPoint: setting->SetAttribute("m_eLeaderAlignmentType", "Simple on box point"); break;
|
||||
case KA3DLeaderAlignment_Maximal_Underline: setting->SetAttribute("m_eLeaderAlignmentType", "Underline maximum"); break;
|
||||
case KA3DLeaderAlignment_Simple_OppositeAnchor: setting->SetAttribute("m_eLeaderAlignmentType", "Simple, opposite anchor point"); break;
|
||||
default: setting->SetAttribute("m_eLeaderAlignmentType", "unexpected"); break;
|
||||
}
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static void sttraverseTextPosition(const A3DMDTextPosition* pTextPosition, _TiXmlElement* setting)
|
||||
{
|
||||
if(pTextPosition == NULL)
|
||||
{
|
||||
setting->SetAttribute("text_position", "not defined");
|
||||
return;
|
||||
}
|
||||
|
||||
A3DMDTextPositionData sTextPositionData;
|
||||
A3D_INITIALIZE_DATA(A3DMDTextPositionData, sTextPositionData);
|
||||
if(A3DMDTextPositionGet(pTextPosition, &sTextPositionData) != A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("error", "text_properties");
|
||||
return;
|
||||
}
|
||||
|
||||
_TiXmlElement* markup_textposition = new _TiXmlElement("A3DMDTextPositionData");
|
||||
setting->LinkEndChild(markup_textposition);
|
||||
traversePoint("m_sPosition" , sTextPositionData.m_sPosition , markup_textposition);
|
||||
traversePoint("m_sBaseVector", sTextPositionData.m_sBaseVector, markup_textposition);
|
||||
traversePoint("m_sUpVector" , sTextPositionData.m_sUpVector , markup_textposition);
|
||||
A3DMDTextPositionGet(NULL, &sTextPositionData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
|
||||
int traverseMarkupTextProperties(const A3DMDTextProperties* pTextProperties, _TiXmlElement* setting)
|
||||
{
|
||||
if(pTextProperties == NULL)
|
||||
{
|
||||
setting->SetAttribute("text_properties", "not defined");
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
A3DStatus iRet = A3D_SUCCESS;
|
||||
A3DMDTextPropertiesData sTextPropertiesData;
|
||||
A3D_INITIALIZE_DATA(A3DMDTextPropertiesData, sTextPropertiesData);
|
||||
iRet = A3DMDTextPropertiesGet(pTextProperties, &sTextPropertiesData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
setting->SetAttribute("error", "text_properties");
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
_TiXmlElement* markup_textprops = new _TiXmlElement("A3DMDTextPropertiesData");
|
||||
setting->LinkEndChild(markup_textprops);
|
||||
markup_textprops->SetAttribute("m_pcFont", sTextPropertiesData.m_pcFont ? sTextPropertiesData.m_pcFont : "null");
|
||||
markup_textprops->SetDoubleAttribute("m_dAngle", sTextPropertiesData.m_dAngle);
|
||||
markup_textprops->SetAttribute("m_bSlant", sTextPropertiesData.m_bSlant ? "true" : "false");
|
||||
markup_textprops->SetAttribute("m_ucThickness", sTextPropertiesData.m_ucThickness);
|
||||
markup_textprops->SetAttribute("m_ucSize", sTextPropertiesData.m_ucSize);
|
||||
markup_textprops->SetAttribute("m_usLineStyle", sTextPropertiesData.m_usLineStyle);
|
||||
markup_textprops->SetDoubleAttribute("m_dCharHeight", sTextPropertiesData.m_dCharHeight);
|
||||
markup_textprops->SetDoubleAttribute("m_dCharSpacing", sTextPropertiesData.m_dCharSpacing);
|
||||
markup_textprops->SetDoubleAttribute("m_dCharWidth", sTextPropertiesData.m_dCharWidth);
|
||||
markup_textprops->SetAttribute("m_iCharFixedRatioMode", sTextPropertiesData.m_iCharFixedRatioMode);
|
||||
|
||||
switch(sTextPropertiesData.m_eGlobalTextScoring)
|
||||
{
|
||||
case KEA3DMDTextPropertiesScoreNone:
|
||||
markup_textprops->SetAttribute("m_eGlobalTextScoring", "KEA3DMDTextPropertiesScoreNone");
|
||||
break;
|
||||
case KEA3DMDTextPropertiesUnderScored:
|
||||
markup_textprops->SetAttribute("m_eGlobalTextScoring", "KEA3DMDTextPropertiesUnderScored");
|
||||
break;
|
||||
case KEA3DMDTextPropertiesScored:
|
||||
markup_textprops->SetAttribute("m_eGlobalTextScoring", "KEA3DMDTextPropertiesScored");
|
||||
break;
|
||||
case KEA3DMDTextPropertiesOverScored:
|
||||
markup_textprops->SetAttribute("m_eGlobalTextScoring", "KEA3DMDTextPropertiesOverScored");
|
||||
break;
|
||||
default:
|
||||
markup_textprops->SetAttribute("m_eGlobalTextScoring", "unexpected");
|
||||
}
|
||||
|
||||
switch(sTextPropertiesData.m_eFormat)
|
||||
{
|
||||
case KEA3DMDTextPropertiesFormatNormal:
|
||||
markup_textprops->SetAttribute("m_eFormat", "KEA3DMDTextPropertiesFormatNormal");
|
||||
break;
|
||||
case KEA3DMDTextPropertiesFormatUnderLine:
|
||||
markup_textprops->SetAttribute("m_eFormat", "KEA3DMDTextPropertiesFormatUnderLine");
|
||||
break;
|
||||
case KEA3DMDTextPropertiesFormatOverLine:
|
||||
markup_textprops->SetAttribute("m_eFormat", "KEA3DMDTextPropertiesFormatOverLine");
|
||||
break;
|
||||
case KEA3DMDTextPropertiesFormatExposant:
|
||||
markup_textprops->SetAttribute("m_eFormat", "KEA3DMDTextPropertiesFormatExposant");
|
||||
break;
|
||||
case KEA3DMDTextPropertiesFormatindice:
|
||||
markup_textprops->SetAttribute("m_eFormat", "KEA3DMDTextPropertiesFormatindice");
|
||||
break;
|
||||
default:
|
||||
markup_textprops->SetAttribute("m_eFormat", "unexpected");
|
||||
}
|
||||
|
||||
switch(sTextPropertiesData.m_eJustification)
|
||||
{
|
||||
case KEA3DMDTextPropertiesJustificationLeft:
|
||||
markup_textprops->SetAttribute("m_eJustification", "KEA3DMDTextPropertiesJustificationLeft");
|
||||
break;
|
||||
case KEA3DMDTextPropertiesJustificationCenter:
|
||||
markup_textprops->SetAttribute("m_eJustification", "KEA3DMDTextPropertiesJustificationCenter");
|
||||
break;
|
||||
case KEA3DMDTextPropertiesJustificationRight:
|
||||
markup_textprops->SetAttribute("m_eJustification", "KEA3DMDTextPropertiesJustificationRight");
|
||||
break;
|
||||
default:
|
||||
markup_textprops->SetAttribute("m_eJustification", "unexpected");
|
||||
}
|
||||
|
||||
return A3DMDTextPropertiesGet(NULL, &sTextPropertiesData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
|
||||
int traverseMarkupText(const A3DMarkupText* pMarkup, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMarkupTextData sMarkupData;
|
||||
A3D_INITIALIZE_DATA(A3DMarkupTextData, sMarkupData);
|
||||
_TiXmlElement* markup_text = new _TiXmlElement("A3DMarkupTextData");
|
||||
setting->LinkEndChild(markup_text);
|
||||
A3DStatus iRet = A3DMarkupTextGet(pMarkup, &sMarkupData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_text->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
char acName[20];
|
||||
for(A3DUns32 i = 0; i < sMarkupData.m_uiLinesSize; i++)
|
||||
{
|
||||
sprintf(acName, "line_%u", i);
|
||||
markup_text->SetAttribute(acName, sMarkupData.m_ppLines[i]);
|
||||
}
|
||||
for(A3DUns32 i = 0; i < sMarkupData.m_uiFileLinksSize; i++)
|
||||
{
|
||||
sprintf(acName, "file_link_%u", i);
|
||||
markup_text->SetAttribute(acName, sMarkupData.m_ppFileLinks[i]);
|
||||
}
|
||||
sttraverseFrameType(sMarkupData.m_eFrameType, markup_text);
|
||||
sttraverseAlignmentType(sMarkupData.m_eLeaderAlignmentType, markup_text);
|
||||
sttraverseTextPosition(sMarkupData.m_psTextPosition, markup_text);
|
||||
markup_text->SetDoubleAttribute("Wrapping_width", sMarkupData.m_dWrappingWidth);
|
||||
traverseMarkupTextProperties(sMarkupData.m_psTextPosition, markup_text);
|
||||
|
||||
return A3DMarkupTextGet(NULL, &sMarkupData);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupRichText(const A3DMarkupRichText* pMarkup, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMarkupRichTextData sMarkupData;
|
||||
A3D_INITIALIZE_DATA(A3DMarkupRichTextData, sMarkupData);
|
||||
_TiXmlElement* markup_text = new _TiXmlElement("A3DMarkupRichTextData");
|
||||
setting->LinkEndChild(markup_text);
|
||||
A3DStatus iRet = A3DMarkupRichTextGet(pMarkup, &sMarkupData);
|
||||
if(iRet != A3D_SUCCESS)
|
||||
{
|
||||
markup_text->SetAttribute("error", iRet);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
markup_text->SetAttribute("m_pcRichText", sMarkupData.m_pcRichText?sMarkupData.m_pcRichText:"NULL");
|
||||
// Let's try to parse the string
|
||||
char acAttributValue[1024];
|
||||
A3DMkpRTFField* pRTF = NULL;
|
||||
if (A3DMkpRTFFieldCreate(sMarkupData.m_pcRichText, &pRTF) == A3D_SUCCESS)
|
||||
{
|
||||
A3DMkpRTFFieldData sRTFFieldData;
|
||||
A3D_INITIALIZE_DATA(A3DRTFFieldData, sRTFFieldData);
|
||||
|
||||
while (A3DMkpRTFFieldGet(pRTF, &sRTFFieldData) == A3D_SUCCESS)
|
||||
{
|
||||
if (sRTFFieldData.m_pcFamilyName)
|
||||
snprintf(acAttributValue,sizeof(acAttributValue), "font-family:%s;", sRTFFieldData.m_pcFamilyName);
|
||||
|
||||
A3DMkpRTFFieldGet(NULL, &sRTFFieldData);
|
||||
}
|
||||
A3DMkpRTFFieldDelete(pRTF);
|
||||
}
|
||||
|
||||
char acName[20];
|
||||
for(A3DUns32 i = 0; i < sMarkupData.m_uiFileLinksSize; i++)
|
||||
{
|
||||
sprintf(acName, "file_link_%u", i);
|
||||
markup_text->SetAttribute(acName, sMarkupData.m_ppFileLinks[i]);
|
||||
}
|
||||
sttraverseFrameType(sMarkupData.m_eFrameType, markup_text);
|
||||
sttraverseAlignmentType(sMarkupData.m_eLeaderAlignmentType, markup_text);
|
||||
sttraverseTextPosition(sMarkupData.m_psTextPosition, markup_text);
|
||||
markup_text->SetDoubleAttribute("Wrapping_width", sMarkupData.m_dWrappingWidth);
|
||||
|
||||
return A3DMarkupRichTextGet(NULL, &sMarkupData);
|
||||
}
|
||||
478
exchange/exchangesource/PRC2XML/PRC2XMLRepItems.cpp
Normal file
478
exchange/exchangesource/PRC2XML/PRC2XMLRepItems.cpp
Normal file
@@ -0,0 +1,478 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseCSys(const A3DRiCoordinateSystem* pCSys, _TiXmlElement* setting)
|
||||
{
|
||||
A3DRiCoordinateSystemData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRiCoordinateSystemData, sData);
|
||||
|
||||
_TiXmlElement* csys = new _TiXmlElement("A3DRiCoordinateSystemData");
|
||||
traverseSource(pCSys, csys);
|
||||
|
||||
A3DInt32 iRet = A3DRiCoordinateSystemGet(pCSys, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
iRet = traverseTransformation(sData.m_pTransformation, csys);
|
||||
A3DRiCoordinateSystemGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
csys->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(csys);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseRepItemContent(const A3DRiRepresentationItem* pRi, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DRiRepresentationItemData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRiRepresentationItemData, sData);
|
||||
|
||||
iRet = A3DRiRepresentationItemGet(pRi, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
std::unique_ptr<_TiXmlElement> repitemdata(new _TiXmlElement("A3DRiRepresentationItemData"));
|
||||
|
||||
if(sData.m_pCoordinateSystem)
|
||||
traverseCSys(sData.m_pCoordinateSystem, repitemdata.get());
|
||||
|
||||
if(sData.m_pTessBase)
|
||||
traverseTessBase(sData.m_pTessBase, repitemdata.get());
|
||||
|
||||
if(sData.m_pCoordinateSystem || sData.m_pTessBase)
|
||||
setting->LinkEndChild(repitemdata.release());
|
||||
|
||||
A3DRiRepresentationItemGet(NULL, &sData);
|
||||
}
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int traverseBrepModel(const A3DRiBrepModel* pBrepModel, _TiXmlElement* setting)
|
||||
{
|
||||
A3DRiBrepModelData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRiBrepModelData, sData);
|
||||
|
||||
_TiXmlElement* brep = new _TiXmlElement("A3DRiBrepModelData");
|
||||
traverseSource(pBrepModel, brep);
|
||||
traverseRepItemContent(pBrepModel, brep);
|
||||
traverseMaterialProperties(pBrepModel, brep);
|
||||
|
||||
_TiXmlElement* physicalprops = new _TiXmlElement("A3DPhysicalPropertiesData");
|
||||
|
||||
A3DVector3dData psScale;
|
||||
A3D_INITIALIZE_DATA(A3DVector3dData, psScale);
|
||||
psScale.m_dX = 1;
|
||||
psScale.m_dY = 1;
|
||||
psScale.m_dZ = 1;
|
||||
A3DPhysicalPropertiesData physicalPropertiesData;
|
||||
A3D_INITIALIZE_A3DPhysicalPropertiesData(physicalPropertiesData);
|
||||
A3DInt32 iRet = A3DComputePhysicalProperties(pBrepModel, &psScale, &physicalPropertiesData);
|
||||
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
physicalprops->SetAttribute("m_bVolumecomputed", physicalPropertiesData.m_bVolumeComputed);
|
||||
physicalprops->SetDoubleAttribute("m_dSurface", (double)physicalPropertiesData.m_dSurface);
|
||||
physicalprops->SetDoubleAttribute("m_dVolume", (double)physicalPropertiesData.m_dVolume);
|
||||
|
||||
physicalprops->SetDoubleAttribute("m_sGravityCenter.m_dX", (double)physicalPropertiesData.m_sGravityCenter.m_dX);
|
||||
physicalprops->SetDoubleAttribute("m_sGravityCenter.m_dY", (double)physicalPropertiesData.m_sGravityCenter.m_dY);
|
||||
physicalprops->SetDoubleAttribute("m_sGravityCenter.m_dZ", (double)physicalPropertiesData.m_sGravityCenter.m_dZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
physicalprops->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(physicalprops);
|
||||
iRet = A3DRiBrepModelGet(pBrepModel, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseBrepData(sData.m_pBrepData, brep);
|
||||
A3DRiBrepModelGet(NULL, &sData);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(brep);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int traversePolyBrepModel(const A3DRiPolyBrepModel* pPolyBrepModel, _TiXmlElement* setting)
|
||||
{
|
||||
A3DRiPolyBrepModelData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRiPolyBrepModelData, sData);
|
||||
|
||||
_TiXmlElement* polybrep = new _TiXmlElement("A3DRiPolyBrepModelData");
|
||||
traverseSource(pPolyBrepModel, polybrep);
|
||||
traverseRepItemContent(pPolyBrepModel, polybrep);
|
||||
traverseMaterialProperties(pPolyBrepModel, polybrep);
|
||||
|
||||
A3DPhysicalPropertiesData physicalPropertiesData;
|
||||
A3D_INITIALIZE_DATA(A3DPhysicalPropertiesData, physicalPropertiesData);
|
||||
A3DVector3dData psScale;
|
||||
A3D_INITIALIZE_DATA(A3DVector3dData, psScale);
|
||||
psScale.m_dX = 1;
|
||||
psScale.m_dY = 1;
|
||||
psScale.m_dZ = 1;
|
||||
A3DInt32 iRet = A3DComputePolyBrepPhysicalProperties(pPolyBrepModel, &psScale, &physicalPropertiesData);
|
||||
|
||||
_TiXmlElement* physicalprops = new _TiXmlElement("A3DPhysicalPropertiesData");
|
||||
physicalprops->SetAttribute("m_bVolumecomputed", physicalPropertiesData.m_bVolumeComputed);
|
||||
physicalprops->SetDoubleAttribute("m_dSurface", (double)physicalPropertiesData.m_dSurface);
|
||||
physicalprops->SetDoubleAttribute("m_dVolume", (double)physicalPropertiesData.m_dVolume);
|
||||
|
||||
physicalprops->SetDoubleAttribute("m_sGravityCenter.m_dX",(double) physicalPropertiesData.m_sGravityCenter.m_dX);
|
||||
physicalprops->SetDoubleAttribute("m_sGravityCenter.m_dY", (double)physicalPropertiesData.m_sGravityCenter.m_dY);
|
||||
physicalprops->SetDoubleAttribute("m_sGravityCenter.m_dZ",(double) physicalPropertiesData.m_sGravityCenter.m_dZ);
|
||||
|
||||
setting->LinkEndChild(physicalprops);
|
||||
|
||||
iRet = A3DRiPolyBrepModelGet(pPolyBrepModel, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
polybrep->SetAttribute("m_bIsClosed", (int) sData.m_bIsClosed);
|
||||
A3DRiPolyBrepModelGet(NULL, &sData);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(polybrep);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int traverseRICurve(const A3DRiCurve* pRICrv, _TiXmlElement* setting)
|
||||
{
|
||||
A3DRiCurveData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRiCurveData, sData);
|
||||
|
||||
_TiXmlElement* ricrv = new _TiXmlElement("A3DRiCurveData");
|
||||
traverseSource(pRICrv, ricrv);
|
||||
traverseRepItemContent(pRICrv, ricrv);
|
||||
traverseMaterialProperties(pRICrv, ricrv);
|
||||
|
||||
A3DInt32 iRet = A3DRiCurveGet(pRICrv, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseSingleWireBody(sData.m_pBody, ricrv);
|
||||
A3DRiCurveGet(NULL, &sData);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(ricrv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int traverseRIPlane(const A3DRiPlane* pRIPlane, _TiXmlElement* setting)
|
||||
{
|
||||
A3DRiPlaneData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRiPlaneData, sData);
|
||||
|
||||
_TiXmlElement* riplane = new _TiXmlElement("A3DRiPlaneData");
|
||||
traverseSource(pRIPlane, riplane);
|
||||
traverseRepItemContent(pRIPlane, riplane);
|
||||
traverseMaterialProperties(pRIPlane, riplane);
|
||||
|
||||
A3DInt32 iRet = A3DRiPlaneGet(pRIPlane, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseBrepData(sData.m_pBrepData, riplane);
|
||||
A3DRiPlaneGet(NULL, &sData);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(riplane);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int traverseDirection(const A3DRiDirection* pDirection, _TiXmlElement* setting)
|
||||
{
|
||||
A3DRiDirectionData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRiDirectionData, sData);
|
||||
|
||||
_TiXmlElement* dir = new _TiXmlElement("A3DRiDirectionData");
|
||||
traverseSource(pDirection, dir);
|
||||
traverseRepItemContent(pDirection, dir);
|
||||
|
||||
A3DInt32 iRet = A3DRiDirectionGet(pDirection, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traversePoint("m_sOrigin" , sData.m_sOrigin , dir);
|
||||
traversePoint("m_sDirection", sData.m_sDirection, dir);
|
||||
A3DRiDirectionGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
dir->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(dir);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int traversePointSet(const A3DRiPointSet* pPointSet, _TiXmlElement* setting)
|
||||
{
|
||||
A3DRiPointSetData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRiPointSetData, sData);
|
||||
|
||||
_TiXmlElement* pointset = new _TiXmlElement("A3DRiPointSetData");
|
||||
traverseSource(pPointSet, pointset);
|
||||
traverseRepItemContent(pPointSet, pointset);
|
||||
traverseMaterialProperties(pPointSet, pointset);
|
||||
|
||||
A3DInt32 iRet = A3DRiPointSetGet(pPointSet, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiSize; ++ui)
|
||||
traversePoint("m_pPts", sData.m_pPts[ui], pointset);
|
||||
A3DRiPointSetGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
pointset->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(pointset);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int traverseSet(const A3DRiSet* pSet, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DRiSetData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRiSetData, sData);
|
||||
|
||||
_TiXmlElement* set = new _TiXmlElement("A3DRiSetData");
|
||||
traverseSource(pSet, set);
|
||||
traverseRepItemContent(pSet, set);
|
||||
traverseMaterialProperties(pSet, set);
|
||||
|
||||
iRet = A3DRiSetGet(pSet, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiRepItemsSize; ++ui)
|
||||
iRet = traverseRepItem(sData.m_ppRepItems[ui], set);
|
||||
|
||||
A3DRiSetGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
set->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(set);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDrawingBlock(const A3DDrawingBlock *pDrwBlock, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
A3DDrawingBlockBasicData sDrwBlockData;
|
||||
A3D_INITIALIZE_DATA(A3DDrawingBlockBasicData, sDrwBlockData);
|
||||
|
||||
CHECK_RET( A3DDrawingBlockBasicGet( (A3DDrawingBlockBasic const*) pDrwBlock, &sDrwBlockData));
|
||||
|
||||
_TiXmlElement* drwBlock = new _TiXmlElement("A3DDrawingBlockData");
|
||||
traverseSource(pDrwBlock, drwBlock);
|
||||
|
||||
drwBlock->SetAttribute("Nb_Entities", sDrwBlockData.m_uiDrwEntitiesSize);
|
||||
drwBlock->SetAttribute("Nb_Markups", sDrwBlockData.m_uiMarkupsSize);
|
||||
drwBlock->SetAttribute("Nb_SubBlocks", sDrwBlockData.m_uiDrwBlocksSize);
|
||||
|
||||
for (A3DUns32 ui = 0; ui < sDrwBlockData.m_uiMarkupsSize; ++ui)
|
||||
{
|
||||
traverseMarkup(sDrwBlockData.m_ppMarkups[ui], drwBlock);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(drwBlock);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDrawingView(const A3DDrawingView *pDrwView, _TiXmlElement* setting)
|
||||
{
|
||||
|
||||
A3DDrawingViewData sDrwViewData;
|
||||
A3D_INITIALIZE_DATA(A3DDrawingViewData, sDrwViewData);
|
||||
|
||||
|
||||
_TiXmlElement* drwView = new _TiXmlElement("A3DDrawingViewData");
|
||||
|
||||
// Get the type of the drawing view
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
iRet = A3DDrawingViewGet(pDrwView, &sDrwViewData);
|
||||
|
||||
A3DEDrawingViewType eDrwType = sDrwViewData.m_eType;
|
||||
|
||||
switch(eDrwType)
|
||||
{
|
||||
case kA3DDrawingViewTypeIso:
|
||||
drwView->SetAttribute("ISO_view",1);
|
||||
case kA3DDrawingViewTypeTop:
|
||||
drwView->SetAttribute("Top_view",1);
|
||||
case kA3DDrawingViewTypeBottom:
|
||||
drwView->SetAttribute("Bottom_view",1);
|
||||
case kA3DDrawingViewTypeLeft:
|
||||
drwView->SetAttribute("Left_view",1);
|
||||
case kA3DDrawingViewTypeRight:
|
||||
drwView->SetAttribute("Right_view",1);
|
||||
case kA3DDrawingViewTypeFront:
|
||||
drwView->SetAttribute("Front_view",1);
|
||||
case kA3DDrawingViewTypeBack:
|
||||
drwView->SetAttribute("Back_view",1);
|
||||
case kA3DDrawingViewTypeBackground:
|
||||
drwView->SetAttribute("Background_view",1);
|
||||
case kA3DDrawingViewTypeWorking:
|
||||
drwView->SetAttribute("Working_view",1);
|
||||
case kA3DDrawingViewTypeProjected:
|
||||
drwView->SetAttribute("Projected_view",1);
|
||||
case kA3DDrawingViewTypeAuxiliary:
|
||||
drwView->SetAttribute("Auxiliary_view",1);
|
||||
case kA3DDrawingViewTypeSection:
|
||||
drwView->SetAttribute("Section_view",1);
|
||||
case kA3DDrawingViewTypeDetail :
|
||||
drwView->SetAttribute("Detail_view",1);
|
||||
default:
|
||||
drwView->SetAttribute("Unknown",1);
|
||||
break;
|
||||
}
|
||||
|
||||
// get the name of the drawing view
|
||||
A3DRootBaseData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseData, sData);
|
||||
CHECK_RET(A3DRootBaseGet(pDrwView, &sData));
|
||||
|
||||
if(sData.m_pcName && sData.m_pcName[0] != '\0')
|
||||
drwView->SetAttribute("name", sData.m_pcName);
|
||||
A3DRootBaseGet(NULL,&sData);
|
||||
|
||||
if (sDrwViewData.m_pLocalBlocks)
|
||||
{
|
||||
traverseDrawingBlock(sDrwViewData.m_pLocalBlocks, drwView);
|
||||
}
|
||||
|
||||
for (A3DUns32 ui = 0; ui < sDrwViewData.m_uiDrwBlocksSize; ++ui)
|
||||
{
|
||||
traverseDrawingBlock(sDrwViewData.m_ppDrwBlocks[ui], drwView);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(drwView);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDrawingSheet(const A3DDrawingSheet * pDrwSheet, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
A3DDrawingSheetData sDrwSheetData;
|
||||
A3D_INITIALIZE_DATA(A3DDrawingSheetData, sDrwSheetData);
|
||||
|
||||
iRet = A3DDrawingSheetGet(pDrwSheet, &sDrwSheetData);
|
||||
|
||||
|
||||
_TiXmlElement* pSheet = new _TiXmlElement("A3DDrawingSheetdata");
|
||||
|
||||
for (A3DUns32 ui = 0; ui < sDrwSheetData.m_uiDrwViewsSize; ++ui)
|
||||
{
|
||||
traverseDrawingView(sDrwSheetData.m_ppDrwViews[ui], pSheet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(pSheet);
|
||||
|
||||
return iRet;
|
||||
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDrawing(const A3DDrawingModel * pDrawing, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
A3DDrawingModelData sDrwModelData;
|
||||
A3D_INITIALIZE_DATA(A3DDrawingModelData, sDrwModelData);
|
||||
|
||||
A3DRootBaseData sBaseData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseData, sBaseData);
|
||||
|
||||
A3DRootBaseGet(pDrawing, &sBaseData);
|
||||
|
||||
iRet = A3DDrawingModelGet(pDrawing, &sDrwModelData);
|
||||
|
||||
_TiXmlElement* drawing = new _TiXmlElement("A3DDrawingModeldata");
|
||||
|
||||
// traverse the drawing sheet
|
||||
for (A3DUns32 ui = 0; ui < sDrwModelData.m_uiDrwSheetsSize; ++ui)
|
||||
{
|
||||
traverseDrawingSheet(sDrwModelData.m_ppDrwSheets[ui], drawing);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(drawing);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseRepItem(const A3DRiRepresentationItem* pRepItem, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DEEntityType eType;
|
||||
|
||||
CHECK_RET(A3DEntityGetType(pRepItem, &eType));
|
||||
|
||||
switch(eType)
|
||||
{
|
||||
case kA3DTypeRiSet:
|
||||
iRet = traverseSet(pRepItem, setting);
|
||||
break;
|
||||
case kA3DTypeRiPointSet:
|
||||
iRet = traversePointSet(pRepItem, setting);
|
||||
break;
|
||||
case kA3DTypeRiDirection:
|
||||
iRet = traverseDirection(pRepItem, setting);
|
||||
break;
|
||||
case kA3DTypeRiCurve:
|
||||
iRet = traverseRICurve(pRepItem, setting);
|
||||
break;
|
||||
case kA3DTypeRiCoordinateSystem:
|
||||
iRet = traverseCSys(pRepItem, setting);
|
||||
break;
|
||||
case kA3DTypeRiPlane:
|
||||
iRet = traverseRIPlane(pRepItem, setting);
|
||||
break;
|
||||
case kA3DTypeRiBrepModel:
|
||||
iRet = traverseBrepModel(pRepItem, setting);
|
||||
break;
|
||||
case kA3DTypeRiPolyBrepModel:
|
||||
iRet = traversePolyBrepModel(pRepItem, setting);
|
||||
break;
|
||||
default:
|
||||
iRet = A3D_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
197
exchange/exchangesource/PRC2XML/PRC2XMLRootEntities.cpp
Normal file
197
exchange/exchangesource/PRC2XML/PRC2XMLRootEntities.cpp
Normal file
@@ -0,0 +1,197 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseAttribute(const A3DMiscAttribute* pAttribute, _TiXmlElement* setting)
|
||||
{
|
||||
A3DMiscAttributeData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMiscAttributeData, sData);
|
||||
|
||||
A3DInt32 iRet = A3DMiscAttributeGet(pAttribute, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* attribute = new _TiXmlElement("A3DMiscAttributeData");
|
||||
attribute->SetAttribute("m_bTitleIsInt", (int) sData.m_bTitleIsInt);
|
||||
if(sData.m_bTitleIsInt)
|
||||
{
|
||||
A3DUns32 uiVal;
|
||||
memcpy(&uiVal,sData.m_pcTitle, sizeof(A3DUns32));
|
||||
attribute->SetAttribute("m_pcTitle", (int)uiVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sData.m_pcTitle && sData.m_pcTitle[0] != '\0')
|
||||
attribute->SetAttribute("m_pcTitle", sData.m_pcTitle);
|
||||
}
|
||||
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiSize; ++ui)
|
||||
{
|
||||
_TiXmlElement* single = new _TiXmlElement("m_asSingleAttributesData");
|
||||
|
||||
single->SetAttribute("m_bTitleIsInt", (int) sData.m_asSingleAttributesData[ui].m_bTitleIsInt);
|
||||
if(sData.m_asSingleAttributesData[ui].m_pcTitle == NULL)
|
||||
single->SetAttribute("m_pcTitle", "NULL");
|
||||
else if(sData.m_asSingleAttributesData[ui].m_bTitleIsInt)
|
||||
{
|
||||
A3DUns32 uiVal;
|
||||
memcpy(&uiVal,sData.m_asSingleAttributesData[ui].m_pcTitle, sizeof(A3DUns32));
|
||||
single->SetAttribute("m_pcTitle", (int)uiVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sData.m_asSingleAttributesData[ui].m_pcTitle && sData.m_asSingleAttributesData[ui].m_pcTitle[0] != '\0')
|
||||
single->SetAttribute("m_pcTitle", sData.m_asSingleAttributesData[ui].m_pcTitle);
|
||||
}
|
||||
|
||||
A3DInt32 iVal;
|
||||
|
||||
switch(sData.m_asSingleAttributesData[ui].m_eType)
|
||||
{
|
||||
case kA3DModellerAttributeTypeInt:
|
||||
memcpy(&iVal, sData.m_asSingleAttributesData[ui].m_pcData, sizeof(A3DInt32));
|
||||
single->SetAttribute("m_eType", "kA3DModellerAttributeTypeInt");
|
||||
single->SetAttribute("m_pcData", iVal);
|
||||
break;
|
||||
|
||||
case kA3DModellerAttributeTypeReal:
|
||||
A3DDouble dVal;
|
||||
memcpy(&dVal, sData.m_asSingleAttributesData[ui].m_pcData, sizeof(A3DDouble));
|
||||
single->SetAttribute("m_eType", "kA3DModellerAttributeTypeReal");
|
||||
_SetDoubleAttribute(single, "m_pcData", dVal);
|
||||
if (sData.m_asSingleAttributesData[ui].m_usUnit!= A3D_DEFAULT_NO_UNIT)
|
||||
single->SetAttribute("m_usUnit", sData.m_asSingleAttributesData[ui].m_usUnit);
|
||||
break;
|
||||
|
||||
case kA3DModellerAttributeTypeTime:
|
||||
memcpy(&iVal, sData.m_asSingleAttributesData[ui].m_pcData, sizeof(A3DInt32));
|
||||
single->SetAttribute("m_eType", "kA3DModellerAttributeTypeTime");
|
||||
single->SetAttribute("m_pcData", iVal);
|
||||
break;
|
||||
|
||||
case kA3DModellerAttributeTypeString:
|
||||
single->SetAttribute("m_eType", "kA3DModellerAttributeTypeString");
|
||||
if(sData.m_asSingleAttributesData[ui].m_pcData && sData.m_asSingleAttributesData[ui].m_pcData[0] != '\0')
|
||||
single->SetAttribute("m_pcData", sData.m_asSingleAttributesData[ui].m_pcData);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
attribute->LinkEndChild(single);
|
||||
}
|
||||
setting->LinkEndChild(attribute);
|
||||
A3DMiscAttributeGet(NULL, &sData);
|
||||
}
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseGraphics(const A3DGraphics* pGraphics, _TiXmlElement* setting)
|
||||
{
|
||||
A3DGraphicsData sData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphicsData, sData);
|
||||
|
||||
A3DInt32 iRet = A3DGraphicsGet(pGraphics, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* graphics = new _TiXmlElement("A3DGraphicsData");
|
||||
|
||||
if(sData.m_uiLayerIndex != A3D_DEFAULT_LAYER)
|
||||
graphics->SetAttribute("m_uiLayerIndex", (int) sData.m_uiLayerIndex);
|
||||
if(sData.m_uiStyleIndex != A3D_DEFAULT_STYLE_INDEX)
|
||||
graphics->SetAttribute("m_uiStyleIndex", (int) sData.m_uiStyleIndex);
|
||||
|
||||
graphics->SetAttribute("m_usBehaviour", (int) sData.m_usBehaviour);
|
||||
|
||||
CHECK_RET(A3DGraphicsGet(NULL, &sData));
|
||||
setting->LinkEndChild(graphics);
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseBase(const A3DEntity* pEntity, _TiXmlElement* setting)
|
||||
{
|
||||
A3DRootBaseData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseData, sData);
|
||||
A3DInt32 iRet = A3DRootBaseGet(pEntity, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* base = new _TiXmlElement("A3DRootBaseData");
|
||||
if(sData.m_pcName && sData.m_pcName[0] != '\0')
|
||||
base->SetAttribute("m_pcName", sData.m_pcName);
|
||||
|
||||
base->SetAttribute("m_uiPersistentId", sData.m_uiPersistentId);
|
||||
base->SetAttribute("m_uiNonPersistentId", sData.m_uiNonPersistentId);
|
||||
if (sData.m_pcPersistentId)
|
||||
base->SetAttribute("m_pcPersistentId", sData.m_pcPersistentId);
|
||||
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiSize; ++ui)
|
||||
traverseAttribute(sData.m_ppAttributes[ui], base);
|
||||
|
||||
A3DBoundingBoxData sBoundingBox;
|
||||
A3D_INITIALIZE_DATA(A3DBoundingBoxData, sBoundingBox);
|
||||
iRet = A3DMiscGetBoundingBox(pEntity, &sBoundingBox);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
if((sBoundingBox.m_sMin.m_dX + sBoundingBox.m_sMin.m_dY + sBoundingBox.m_sMin.m_dZ + sBoundingBox.m_sMax.m_dX + sBoundingBox.m_sMax.m_dY + sBoundingBox.m_sMax.m_dZ) != 0.0)
|
||||
{
|
||||
char acBBox[256];
|
||||
sprintf(acBBox, "Min(%f,%f,%f) Max(%f,%f,%f)", sBoundingBox.m_sMin.m_dX, sBoundingBox.m_sMin.m_dY, sBoundingBox.m_sMin.m_dZ, sBoundingBox.m_sMax.m_dX, sBoundingBox.m_sMax.m_dY, sBoundingBox.m_sMax.m_dZ);
|
||||
base->SetAttribute("BoundingBox", acBBox);
|
||||
A3DMiscGetBoundingBox(NULL, &sBoundingBox);
|
||||
}
|
||||
}
|
||||
|
||||
setting->LinkEndChild(base);
|
||||
A3DRootBaseGet(NULL, &sData);
|
||||
}
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseBaseWithGraphics(const A3DEntity* pEntity, _TiXmlElement* setting)
|
||||
{
|
||||
A3DRootBaseWithGraphicsData sData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseWithGraphicsData, sData);
|
||||
|
||||
A3DInt32 iRet = A3DRootBaseWithGraphicsGet(pEntity, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* basewithgraphics = new _TiXmlElement("A3DRootBaseWithGraphicsData");
|
||||
traverseBase(pEntity,basewithgraphics);
|
||||
if(sData.m_pGraphics != NULL)
|
||||
traverseGraphics(sData.m_pGraphics,basewithgraphics);
|
||||
setting->LinkEndChild(basewithgraphics);
|
||||
A3DRootBaseWithGraphicsGet(NULL, &sData);
|
||||
}
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseSource(const A3DEntity* pEntity, _TiXmlElement* setting)
|
||||
{
|
||||
if(A3DEntityIsBaseWithGraphicsType(pEntity))
|
||||
return traverseBaseWithGraphics(pEntity, setting);
|
||||
else if(A3DEntityIsBaseType(pEntity))
|
||||
return traverseBase(pEntity, setting);
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
614
exchange/exchangesource/PRC2XML/PRC2XMLStructure.cpp
Normal file
614
exchange/exchangesource/PRC2XML/PRC2XMLStructure.cpp
Normal file
@@ -0,0 +1,614 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
int traverseDisplayFilters(A3DUns32 uiSize, A3DAsmFilter** ppFilters, _TiXmlElement* setting);
|
||||
int traverseGraphScene(const A3DGraphSceneDisplayParametersData& sData, _TiXmlElement* setting);
|
||||
//######################################################################################################################
|
||||
int traverseMaterialProperties(const A3DEntity* pEntity, _TiXmlElement* xmlfather)
|
||||
{
|
||||
_TiXmlElement* xml = new _TiXmlElement("A3DMiscMaterialPropertiesData");
|
||||
A3DMiscMaterialPropertiesData sMaterialPropertiesData;
|
||||
A3D_INITIALIZE_DATA(A3DMiscMaterialPropertiesData, sMaterialPropertiesData);
|
||||
|
||||
A3DStatus iRet = A3DMiscGetMaterialProperties(pEntity, &sMaterialPropertiesData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
xml->SetDoubleAttribute("m_dDensity", sMaterialPropertiesData.m_dDensity);
|
||||
xml->SetAttribute("m_pcMaterialName", sMaterialPropertiesData.m_pcMaterialName ? sMaterialPropertiesData.m_pcMaterialName:"NULL");
|
||||
xml->SetAttribute("m_ePhysicType", sMaterialPropertiesData.m_ePhysicType);
|
||||
switch (sMaterialPropertiesData.m_ePhysicType)
|
||||
{
|
||||
case A3DPhysicType_None:
|
||||
case A3DPhysicType_Fiber:
|
||||
case A3DPhysicType_HoneyComb:
|
||||
case A3DPhysicType_Isotropic:
|
||||
case A3DPhysicType_Orthotropic2D:
|
||||
case A3DPhysicType_Orthotropic3D:
|
||||
case A3DPhysicType_Anisotropic:
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
A3DMiscGetMaterialProperties(NULL, &sMaterialPropertiesData);
|
||||
}
|
||||
|
||||
xmlfather->LinkEndChild(xml);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int stTraversePartDef(const A3DAsmPartDefinition* pPart, _TiXmlElement* xmlfather)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DAsmPartDefinitionData sData;
|
||||
A3D_INITIALIZE_DATA(A3DAsmPartDefinitionData, sData);
|
||||
|
||||
_TiXmlElement* part = new _TiXmlElement("A3DAsmPartDefinitionData");
|
||||
traverseSource(pPart, part);
|
||||
|
||||
iRet = A3DAsmPartDefinitionGet(pPart, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
A3DUns32 ui;
|
||||
part->SetAttribute("m_bInactivateAnnotations", sData.m_bInactivateAnnotations ? "true" : "false");
|
||||
|
||||
iRet = traverseBoundingBox(&sData.m_sBoundingBox, part);
|
||||
|
||||
for(ui = 0; ui < sData.m_uiAnnotationsSize; ++ui)
|
||||
traverseAnnotation(sData.m_ppAnnotations[ui], part);
|
||||
|
||||
for(ui = 0; ui < sData.m_uiViewsSize; ++ui)
|
||||
traverseView(sData.m_ppViews[ui], part);
|
||||
|
||||
for(ui = 0; ui < sData.m_uiRepItemsSize; ++ui)
|
||||
traverseRepItem(sData.m_ppRepItems[ui], part);
|
||||
|
||||
// traverse the drawing !!!!!!!
|
||||
for (ui = 0; ui < sData.m_uiDrawingModelsSize; ++ui)
|
||||
traverseDrawing(sData.m_ppDrawingModels[ui], part);
|
||||
|
||||
A3DAsmPartDefinitionGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
part->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
traverseMaterialProperties(pPart, part);
|
||||
xmlfather->LinkEndChild(part);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int stTraverseFilter(const A3DAsmFilter* pFilter, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DAsmFilterData sData;
|
||||
A3D_INITIALIZE_DATA(A3DAsmFilterData, sData);
|
||||
|
||||
_TiXmlElement* filter = new _TiXmlElement("A3DAsmFilterData");
|
||||
traverseSource(pFilter, filter);
|
||||
|
||||
iRet = A3DAsmFilterGet(pFilter, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
filter->SetAttribute("active", (int) sData.m_bIsActive);
|
||||
A3DAsmFilterGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
filter->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(filter);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseEntityReference(const A3DMiscEntityReference* pEntityReference, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DMiscEntityReferenceData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMiscEntityReferenceData, sData);
|
||||
|
||||
_TiXmlElement* entityreference = new _TiXmlElement("A3DMiscEntityReferenceData");
|
||||
traverseSource(pEntityReference, entityreference);
|
||||
|
||||
iRet = A3DMiscEntityReferenceGet(pEntityReference, &sData);
|
||||
if (iRet != A3D_SUCCESS || sData.m_pEntity == NULL)
|
||||
{
|
||||
entityreference->SetAttribute("error", iRet);
|
||||
setting->LinkEndChild(entityreference);
|
||||
return iRet;
|
||||
}
|
||||
_TiXmlElement* entity = new _TiXmlElement("m_pEntity");
|
||||
_SetAttributePtr(entity, "Address", (void*)sData.m_pEntity);
|
||||
entityreference->LinkEndChild(entity);
|
||||
|
||||
if (sData.m_pCoordinateSystem != NULL)
|
||||
iRet = traverseCSys(sData.m_pCoordinateSystem, entityreference);
|
||||
|
||||
A3DEEntityType eType = kA3DTypeUnknown;
|
||||
iRet = A3DEntityGetType(sData.m_pEntity, &eType);
|
||||
if (iRet != A3D_SUCCESS)
|
||||
{
|
||||
entityreference->SetAttribute("error_A3DEntityGetType", iRet);
|
||||
setting->LinkEndChild(entityreference);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
if (eType == kA3DTypeMiscReferenceOnTopology)
|
||||
{
|
||||
A3DMiscReferenceOnTopologyData sReferenceOnTopologyData;
|
||||
A3D_INITIALIZE_DATA(A3DMiscReferenceOnTopologyData, sReferenceOnTopologyData);
|
||||
if(A3DMiscReferenceOnTopologyGet((A3DMiscReferenceOnTopology*) sData.m_pEntity, &sReferenceOnTopologyData) != A3D_SUCCESS)
|
||||
{
|
||||
entityreference->SetAttribute("error_A3DMiscReferenceOnTopologyGet", iRet);
|
||||
setting->LinkEndChild(entityreference);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
switch(sReferenceOnTopologyData.m_eTopoItemType)
|
||||
{
|
||||
case kA3DTypeTopoEdge:
|
||||
entityreference->SetAttribute("topotype", "Edge");
|
||||
if(sReferenceOnTopologyData.m_uiSize != 3)
|
||||
{
|
||||
entityreference->SetAttribute("ref_count", "error");
|
||||
break;
|
||||
}
|
||||
entityreference->SetAttribute("face_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[0]);
|
||||
entityreference->SetAttribute("loop_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[1]);
|
||||
entityreference->SetAttribute("edge_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[2]);
|
||||
break;
|
||||
case kA3DTypeTopoCoEdge:
|
||||
entityreference->SetAttribute("topotype", "CoEdge");
|
||||
if(sReferenceOnTopologyData.m_uiSize != 3)
|
||||
{
|
||||
entityreference->SetAttribute("ref_count", "error");
|
||||
break;
|
||||
}
|
||||
entityreference->SetAttribute("face_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[0]);
|
||||
entityreference->SetAttribute("loop_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[1]);
|
||||
entityreference->SetAttribute("coedge_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[2]);
|
||||
break;
|
||||
case kA3DTypeTopoFace:
|
||||
entityreference->SetAttribute("topotype", "Face");
|
||||
if(sReferenceOnTopologyData.m_uiSize != 1)
|
||||
{
|
||||
entityreference->SetAttribute("ref_count", "error");
|
||||
break;
|
||||
}
|
||||
entityreference->SetAttribute("face_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[0]);
|
||||
break;
|
||||
case kA3DTypeTopoUniqueVertex:
|
||||
entityreference->SetAttribute("topotype", "Unique Vertex");
|
||||
if(sReferenceOnTopologyData.m_uiSize != 4)
|
||||
{
|
||||
entityreference->SetAttribute("ref_count", "error");
|
||||
break;
|
||||
}
|
||||
entityreference->SetAttribute("face_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[0]);
|
||||
entityreference->SetAttribute("loop_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[1]);
|
||||
entityreference->SetAttribute("edge_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[2]);
|
||||
entityreference->SetAttribute("vertex_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[3]);
|
||||
break;
|
||||
case kA3DTypeTopoMultipleVertex:
|
||||
entityreference->SetAttribute("topotype", "Multiple Vertex");
|
||||
if(sReferenceOnTopologyData.m_uiSize%3 != 0)
|
||||
{
|
||||
entityreference->SetAttribute("ref_count", "error");
|
||||
break;
|
||||
}
|
||||
entityreference->SetAttribute("ref_count", "todo");
|
||||
entityreference->SetAttribute("face_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[0]);
|
||||
entityreference->SetAttribute("loop_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[1]);
|
||||
entityreference->SetAttribute("edge_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[2]);
|
||||
entityreference->SetAttribute("vertex_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[3]);
|
||||
break;
|
||||
default:
|
||||
entityreference->SetAttribute("linked_item_topo_reference", "unexpected");
|
||||
break;
|
||||
}
|
||||
A3DMiscReferenceOnTopologyGet(nullptr, &sReferenceOnTopologyData);
|
||||
}
|
||||
else if(eType == kA3DTypeMiscReferenceOnCsysItem)
|
||||
{
|
||||
A3DMiscReferenceOnCsysItemData sA3DMiscReferenceOnCSYSITemData;
|
||||
A3D_INITIALIZE_DATA(A3DMiscReferenceOnCsysItemData, sA3DMiscReferenceOnCSYSITemData);
|
||||
iRet = A3DMiscReferenceOnCsysItemGet(sData.m_pEntity, &sA3DMiscReferenceOnCSYSITemData);
|
||||
if(iRet!=A3D_SUCCESS || !sA3DMiscReferenceOnCSYSITemData.m_pCoordinateSystem)
|
||||
{
|
||||
entityreference->SetAttribute("error_A3DMiscReferenceOnCsysItemGet", iRet);
|
||||
setting->LinkEndChild(entityreference);
|
||||
A3DMiscReferenceOnCsysItemGet(nullptr, &sA3DMiscReferenceOnCSYSITemData);
|
||||
return iRet;
|
||||
}
|
||||
A3DRootBaseData sCSYSRootData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseData, sCSYSRootData);
|
||||
if( A3DRootBaseGet(sA3DMiscReferenceOnCSYSITemData.m_pCoordinateSystem, &sCSYSRootData)== A3D_SUCCESS)
|
||||
{
|
||||
entityreference->SetAttribute("cys_name", (sCSYSRootData.m_pcName && sCSYSRootData.m_pcName[0] != '\0')?sCSYSRootData.m_pcName:"NULL");
|
||||
entityreference->SetAttribute("index", sA3DMiscReferenceOnCSYSITemData.m_uiIndex);
|
||||
}
|
||||
A3DMiscReferenceOnCsysItemGet(nullptr, &sA3DMiscReferenceOnCSYSITemData);
|
||||
}
|
||||
else
|
||||
{
|
||||
A3DRootBaseData sBaseData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseData, sBaseData);
|
||||
iRet = A3DRootBaseGet(sData.m_pEntity,&sBaseData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
if(sBaseData.m_pcName && sBaseData.m_pcName[0] != '\0')
|
||||
entityreference->SetAttribute("name", sBaseData.m_pcName);
|
||||
A3DRootBaseGet(NULL,&sBaseData);
|
||||
}
|
||||
|
||||
if (eType == kA3DTypeRiPolyBrepModel)
|
||||
{
|
||||
A3DMiscReferenceOnTessData sReferenceOnTessData;
|
||||
A3D_INITIALIZE_DATA(A3DMiscReferenceOnTessData, sReferenceOnTessData);
|
||||
if (A3DMiscReferenceOnTessGet(pEntityReference, &sReferenceOnTessData) == A3D_SUCCESS)
|
||||
{
|
||||
switch(sReferenceOnTessData.m_eTopoItemType)
|
||||
{
|
||||
case kA3DTypeTessFace:
|
||||
entityreference->SetAttribute("topotype", "Face");
|
||||
if (sReferenceOnTessData.m_uiSize == 0)
|
||||
entityreference->SetAttribute("ref_count", "error");
|
||||
|
||||
for (A3DUns32 iFace=0;iFace<sReferenceOnTessData.m_uiSize;iFace++)
|
||||
entityreference->SetAttribute("face_indice", sReferenceOnTessData.m_puiAdditionalIndexes[iFace]);
|
||||
break;
|
||||
case kA3DTypeTessEdge:
|
||||
entityreference->SetAttribute("topotype", "Edge");
|
||||
if (sReferenceOnTessData.m_uiSize != 3)
|
||||
entityreference->SetAttribute("ref_count", "error");
|
||||
else
|
||||
{
|
||||
entityreference->SetAttribute("face_indice", sReferenceOnTessData.m_puiAdditionalIndexes[0]);
|
||||
entityreference->SetAttribute("loop_indice", sReferenceOnTessData.m_puiAdditionalIndexes[1]);
|
||||
entityreference->SetAttribute("edge_indice", sReferenceOnTessData.m_puiAdditionalIndexes[2]);
|
||||
}
|
||||
break;
|
||||
case kA3DTypeTessVertex:
|
||||
entityreference->SetAttribute("topotype", "Vertex");
|
||||
if (sReferenceOnTessData.m_uiSize != 4)
|
||||
entityreference->SetAttribute("ref_count", "error");
|
||||
else
|
||||
{
|
||||
entityreference->SetAttribute("face_indice" , sReferenceOnTessData.m_puiAdditionalIndexes[0]);
|
||||
entityreference->SetAttribute("loop_indice" , sReferenceOnTessData.m_puiAdditionalIndexes[1]);
|
||||
entityreference->SetAttribute("edge_indice" , sReferenceOnTessData.m_puiAdditionalIndexes[2]);
|
||||
entityreference->SetAttribute("vertex_indice", sReferenceOnTessData.m_puiAdditionalIndexes[3]);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
A3DMiscReferenceOnTessGet(NULL, &sReferenceOnTessData);
|
||||
}
|
||||
}
|
||||
else if(eType == kA3DTypeRiPlane)
|
||||
{
|
||||
A3DMiscMarkupLinkedItem* pLinkedItem = NULL;
|
||||
A3DRiPlaneSupportGet((const A3DRiPlane*) sData.m_pEntity, &pLinkedItem);
|
||||
if( pLinkedItem)
|
||||
{
|
||||
_TiXmlElement* entityreferencesupport = new _TiXmlElement("SUPPORT");
|
||||
entityreference->LinkEndChild(entityreferencesupport);
|
||||
traverseEntityReference(pLinkedItem, entityreferencesupport);
|
||||
}
|
||||
}
|
||||
else if(eType == kA3DTypeRiCurve)
|
||||
{
|
||||
A3DMiscMarkupLinkedItem* pLinkedItem = NULL;
|
||||
A3DRiCurveSupportGet((const A3DRiCurve*) sData.m_pEntity, &pLinkedItem);
|
||||
if( pLinkedItem)
|
||||
{
|
||||
_TiXmlElement* entityreferencesupport = new _TiXmlElement("SUPPORT");
|
||||
entityreference->LinkEndChild(entityreferencesupport);
|
||||
traverseEntityReference(pLinkedItem, entityreferencesupport);
|
||||
}
|
||||
}
|
||||
}
|
||||
A3DMiscEntityReferenceGet(NULL, &sData);
|
||||
|
||||
setting->LinkEndChild(entityreference);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int traverseMaterialAndVis(const A3DMaterialAndVisualisationInfos& oMatVis, _TiXmlElement* setting)
|
||||
{
|
||||
setting->SetAttribute("m_bIsSuppressed", oMatVis.m_bIsSuppressed);
|
||||
setting->SetAttribute("m_usLayer", oMatVis.m_usLayer);
|
||||
setting->SetAttribute("m_usBehaviour", oMatVis.m_usBehaviour);
|
||||
setting->SetAttribute("m_ucType", oMatVis.m_ucType);
|
||||
|
||||
for (A3DUns32 i = 0; i < oMatVis.m_uiPathInAssemblyTreeSize; i++)
|
||||
{
|
||||
A3DUTF8Char* acValue = oMatVis.m_ppPathInAssemblyTree[i];
|
||||
char acBuffer[32];
|
||||
sprintf(acBuffer, "m_ppPathInAssemblyTree_%d", i);
|
||||
|
||||
setting->SetAttribute(acBuffer, acValue ? acValue : "");
|
||||
}
|
||||
|
||||
if (oMatVis.m_pMaterial)
|
||||
traverseMaterial(*oMatVis.m_pMaterial, setting);
|
||||
|
||||
if (oMatVis.m_pTransform)
|
||||
traverseCartesianTransformationData(*oMatVis.m_pTransform, setting);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int stTraversePOccurrence(const A3DAsmProductOccurrence* pOccurrence, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DAsmProductOccurrenceData sData;
|
||||
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sData);
|
||||
|
||||
_TiXmlElement* occurrence = new _TiXmlElement("A3DAsmProductOccurrenceData");
|
||||
traverseSource(pOccurrence, occurrence);
|
||||
|
||||
A3DRootBaseData sRootBaseData;
|
||||
A3D_INITIALIZE_DATA(A3DRootBaseData, sRootBaseData);
|
||||
iRet = A3DRootBaseGet(pOccurrence, &sRootBaseData);
|
||||
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
if (sRootBaseData.m_pcName && sRootBaseData.m_pcName[0] != '\0')
|
||||
occurrence->SetAttribute("m_pcName", sRootBaseData.m_pcName);
|
||||
|
||||
A3DRootBaseGet(NULL, &sRootBaseData);
|
||||
}
|
||||
|
||||
iRet = A3DAsmProductOccurrenceGet(pOccurrence, &sData);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
A3DUns32 ui;
|
||||
|
||||
occurrence->SetAttribute("m_ucBehaviour", (int)(sData.m_ucBehaviour));
|
||||
occurrence->SetAttribute("m_eProductLoadStatus", (int)(sData.m_eProductLoadStatus));
|
||||
|
||||
occurrence->SetAttribute("m_uiProductFlags", (int)(sData.m_uiProductFlags));
|
||||
occurrence->SetAttribute("m_bUnitFromCAD", (int)(sData.m_bUnitFromCAD));
|
||||
occurrence->SetDoubleAttribute("m_dUnit", (double)(sData.m_dUnit));
|
||||
occurrence->SetDoubleAttribute("m_dDensityVolumeUnit", sData.m_dDensityVolumeUnit);
|
||||
occurrence->SetDoubleAttribute("m_dDensityMassUnit", sData.m_dDensityMassUnit);
|
||||
occurrence->SetAttribute("m_eModellerType", sData.m_eModellerType);
|
||||
occurrence->SetAttribute("m_bInactivateAnnotations", sData.m_bInactivateAnnotations ? "true" : "false");
|
||||
|
||||
traverseTransformation(sData.m_pLocation, occurrence);
|
||||
|
||||
if (sData.m_uiDisplayFilterSize && sData.m_ppDisplayFilters)
|
||||
{
|
||||
_TiXmlElement* displayfilters = new _TiXmlElement("DisplayFilters");
|
||||
traverseDisplayFilters(sData.m_uiDisplayFilterSize, sData.m_ppDisplayFilters, displayfilters);
|
||||
occurrence->LinkEndChild(displayfilters);
|
||||
}
|
||||
|
||||
A3DUns32 uiLayers=0;
|
||||
A3DAsmLayer* asLayers = 0;
|
||||
if (A3DAsmProductOccurrenceGetLayerList(pOccurrence,&uiLayers,&asLayers) == A3D_SUCCESS)
|
||||
{
|
||||
if (uiLayers)
|
||||
{
|
||||
_TiXmlElement * pLayers = new _TiXmlElement("Layers");
|
||||
for (A3DUns32 i = 0; i < uiLayers; ++i)
|
||||
{
|
||||
_TiXmlElement * Layer = new _TiXmlElement("Layer");
|
||||
Layer->SetAttribute("Name", asLayers[i].m_pcLayerName ? asLayers[i].m_pcLayerName : "null");
|
||||
Layer->SetAttribute("Layer", asLayers[i].m_usLayer);
|
||||
pLayers->LinkEndChild(Layer);
|
||||
}
|
||||
occurrence->LinkEndChild(pLayers);
|
||||
}
|
||||
A3DAsmProductOccurrenceGetLayerList(0, &uiLayers, &asLayers);
|
||||
}
|
||||
|
||||
if (sData.m_pPrototype)
|
||||
{
|
||||
_TiXmlElement* occurrenceproto = new _TiXmlElement("m_pPrototype");
|
||||
stTraversePOccurrence(sData.m_pPrototype, occurrenceproto);
|
||||
occurrence->LinkEndChild(occurrenceproto);
|
||||
}
|
||||
//else // this is commented but beware http://docs.techsoft3d.com/exchange/latest/build/group__a3d__productoccurrence.html#ga497615eb89393c2aba37cce2e2323f4d
|
||||
{
|
||||
A3DUTF8Char* mPOPath = NULL;
|
||||
|
||||
iRet = A3DAsmProductOccurrenceGetFilePathName(pOccurrence, &mPOPath);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
occurrence->SetAttribute("A3DAsmProductOccurrenceGetFilePathName", mPOPath != NULL ? mPOPath : "");
|
||||
else
|
||||
occurrence->SetAttribute("A3DAsmProductOccurrenceGetFilePathName", iRet);
|
||||
A3DAsmProductOccurrenceGetFilePathName(NULL, &mPOPath);
|
||||
|
||||
mPOPath = NULL;
|
||||
iRet = A3DAsmProductOccurrenceGetOriginalFilePathName(pOccurrence, &mPOPath);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
occurrence->SetAttribute("A3DAsmProductOccurrenceGetOriginalFilePathName", mPOPath != NULL ? mPOPath : "");
|
||||
else
|
||||
occurrence->SetAttribute("A3DAsmProductOccurrenceGetOriginalFilePathName", iRet);
|
||||
A3DAsmProductOccurrenceGetOriginalFilePathName(NULL, &mPOPath);
|
||||
}
|
||||
|
||||
if (sData.m_pExternalData)
|
||||
{
|
||||
_TiXmlElement* occurrenceexternaldata = new _TiXmlElement("m_pExternalData");
|
||||
stTraversePOccurrence(sData.m_pExternalData, occurrenceexternaldata);
|
||||
occurrence->LinkEndChild(occurrenceexternaldata);
|
||||
}
|
||||
|
||||
for (ui = 0; ui < sData.m_uiPOccurrencesSize; ++ui)
|
||||
stTraversePOccurrence(sData.m_ppPOccurrences[ui], occurrence);
|
||||
|
||||
for (ui = 0; ui < sData.m_uiEntityReferenceSize; ++ui)
|
||||
traverseEntityReference(sData.m_ppEntityReferences[ui], occurrence);
|
||||
|
||||
for (ui = 0; ui < sData.m_uiAnnotationsSize; ++ui)
|
||||
traverseAnnotation(sData.m_ppAnnotations[ui], occurrence);
|
||||
|
||||
for (ui = 0; ui < sData.m_uiSceneDisplayParameterSize; ++ui)
|
||||
traverseGraphScene(sData.m_psSceneDisplayParameters[ui], occurrence);
|
||||
|
||||
for (ui = 0; ui < sData.m_uiViewsSize; ++ui)
|
||||
traverseView(sData.m_ppViews[ui], occurrence);
|
||||
|
||||
if (sData.m_pPart)
|
||||
stTraversePartDef(sData.m_pPart, occurrence);
|
||||
|
||||
if (sData.m_pEntityFilter)
|
||||
stTraverseFilter(sData.m_pEntityFilter, occurrence);
|
||||
|
||||
for (ui = 0; ui < sData.m_uiFeatureBasedEntitiesSize; ++ui)
|
||||
traverseFeatureTree(sData.m_ppFeatureBasedEntities[ui], occurrence);
|
||||
|
||||
for (ui = 0; ui < sData.m_uiContraintsSize; ++ui)
|
||||
traverseConstraint(sData.m_ppConstraints[ui], occurrence);
|
||||
|
||||
for (ui = 0; ui < sData.m_uiMaterialAndVisualisationSetupSize; ++ui)
|
||||
{
|
||||
_TiXmlElement* materialandvis = new _TiXmlElement("m_psMaterialAndVisualisationSetup");
|
||||
traverseMaterialAndVis(sData.m_psMaterialAndVisualisationSetup[ui], materialandvis);
|
||||
occurrence->LinkEndChild(materialandvis);
|
||||
}
|
||||
|
||||
//----------- Export Specific information per CAD format -----------
|
||||
switch (sData.m_eModellerType)
|
||||
{
|
||||
case kA3DModellerUnigraphics:
|
||||
{
|
||||
A3DAsmProductOccurrenceDataUg sDataUg;
|
||||
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceDataUg, sDataUg);
|
||||
iRet = A3DAsmProductOccurrenceGetUg(pOccurrence, &sDataUg);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* occurrencedataug = new _TiXmlElement("A3DAsmProductOccurrenceDataUg");
|
||||
|
||||
occurrencedataug->SetAttribute("RootFilePath", sDataUg.m_psRootFilePath ? sDataUg.m_psRootFilePath : "NULL");
|
||||
occurrencedataug->SetAttribute("FileName", sDataUg.m_psFileName ? sDataUg.m_psFileName : "NULL");
|
||||
occurrencedataug->SetAttribute("PartUID", sDataUg.m_psPartUID ? sDataUg.m_psPartUID : "NULL");
|
||||
occurrencedataug->SetAttribute("InstanceFileName", sDataUg.m_psInstanceFileName ? sDataUg.m_psInstanceFileName : "NULL");
|
||||
occurrencedataug->SetAttribute("InstanceTag", sDataUg.m_uiInstanceTag);
|
||||
|
||||
// Treat RefSets
|
||||
if (sDataUg.m_uiChildrenByRefsetsSize || sDataUg.m_uiSolidsByRefsetsSize)
|
||||
{
|
||||
_TiXmlElement* refsetList = new _TiXmlElement("RefSets");
|
||||
|
||||
// Children by RefSet
|
||||
for (A3DUns32 iRefSet = 0; iRefSet < sDataUg.m_uiChildrenByRefsetsSize; ++iRefSet)
|
||||
{
|
||||
const A3DElementsByRefsetUg &pRefsetData = sDataUg.m_asChildrenByRefsets[iRefSet];
|
||||
|
||||
// Init Xml Element if first occurrence
|
||||
_TiXmlElement* refset = new _TiXmlElement("RefSet");
|
||||
refset->SetAttribute("Name", pRefsetData.m_psRefset);
|
||||
|
||||
// Add children
|
||||
for (A3DUns32 i = 0; i < pRefsetData.m_uiElementsSize; ++i)
|
||||
{
|
||||
_TiXmlElement * refsetChild = new _TiXmlElement("Child");
|
||||
refsetChild->SetAttribute("id", pRefsetData.m_auiElements[i]);
|
||||
refset->LinkEndChild(refsetChild);
|
||||
}
|
||||
|
||||
refsetList->LinkEndChild(refset);
|
||||
}
|
||||
|
||||
// Solid by RefSet
|
||||
for (A3DUns32 iRefSet = 0; iRefSet < sDataUg.m_uiSolidsByRefsetsSize; ++iRefSet)
|
||||
{
|
||||
const A3DElementsByRefsetUg &pRefsetData = sDataUg.m_asSolidsByRefsets[iRefSet];
|
||||
|
||||
// Init Xml Element if first occurrence
|
||||
_TiXmlElement* refset = new _TiXmlElement("RefSet");
|
||||
refset->SetAttribute("Name", pRefsetData.m_psRefset);
|
||||
|
||||
// Add Solid
|
||||
for (A3DUns32 i = 0; i < pRefsetData.m_uiElementsSize; ++i)
|
||||
{
|
||||
_TiXmlElement * refsetChild = new _TiXmlElement("Solid");
|
||||
refsetChild->SetAttribute("id", pRefsetData.m_auiElements[i]);
|
||||
refset->LinkEndChild(refsetChild);
|
||||
}
|
||||
|
||||
refsetList->LinkEndChild(refset);
|
||||
}
|
||||
|
||||
occurrencedataug->LinkEndChild(refsetList);
|
||||
}
|
||||
|
||||
occurrence->LinkEndChild(occurrencedataug);
|
||||
|
||||
CHECK_RET(A3DAsmProductOccurrenceGetUg(NULL, &sDataUg));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CHECK_RET(A3DAsmProductOccurrenceGet(NULL, &sData));
|
||||
}
|
||||
else
|
||||
{
|
||||
occurrence->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
traverseMaterialProperties(pOccurrence, occurrence);
|
||||
|
||||
setting->LinkEndChild(occurrence);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseModel(const A3DAsmModelFile* pModelFile, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DAsmModelFileData sData;
|
||||
A3D_INITIALIZE_DATA(A3DAsmModelFileData, sData);
|
||||
|
||||
_TiXmlElement* model = new _TiXmlElement("A3DAsmModelFileData");
|
||||
traverseSource(pModelFile, model);
|
||||
|
||||
iRet = A3DAsmModelFileGet(pModelFile , &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
A3DUns32 ui;
|
||||
|
||||
model->SetAttribute("m_bUnitFromCAD", sData.m_bUnitFromCAD);
|
||||
model->SetDoubleAttribute("m_dUnit", sData.m_dUnit);
|
||||
model->SetAttribute("m_eModellerType", sData.m_eModellerType);
|
||||
|
||||
dumpRelationships(sData.m_pBIMData, model);
|
||||
|
||||
for(ui = 0; ui < sData.m_uiPOccurrencesSize; ++ui)
|
||||
stTraversePOccurrence(sData.m_ppPOccurrences[ui], model);
|
||||
|
||||
CHECK_RET(A3DAsmModelFileGet(NULL, &sData));
|
||||
}
|
||||
else
|
||||
{
|
||||
model->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(model);
|
||||
return iRet;
|
||||
}
|
||||
316
exchange/exchangesource/PRC2XML/PRC2XMLTessellation.cpp
Normal file
316
exchange/exchangesource/PRC2XML/PRC2XMLTessellation.cpp
Normal file
@@ -0,0 +1,316 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
static _TiXmlElement* stfonts = NULL;
|
||||
|
||||
//######################################################################################################################
|
||||
A3DVoid _InitializeFontsArray()
|
||||
{
|
||||
if(stfonts == NULL)
|
||||
stfonts = new _TiXmlElement("Fonts");
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
A3DVoid _TerminateFontsArray()
|
||||
{
|
||||
delete stfonts;
|
||||
stfonts = NULL;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static A3DBool stCompareFontData(const _TiXmlElement* node, const A3DFontData* psFontData)
|
||||
{
|
||||
if(node->Attribute("m_pcFamilyName") && strcmp(node->Attribute("m_pcFamilyName"), psFontData->m_pcFamilyName) != 0)
|
||||
return false;
|
||||
|
||||
int iSize;
|
||||
if(node->Attribute("m_uiSize", &iSize) && iSize != (int) psFontData->m_uiSize)
|
||||
return false;
|
||||
if(node->Attribute("m_eCharset", &iSize) && iSize != psFontData->m_eCharset)
|
||||
return false;
|
||||
if(node->Attribute("m_cAttributes", &iSize) && iSize != psFontData->m_cAttributes)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static A3DVoid stAddFont(const A3DFontData* psFontData)
|
||||
{
|
||||
if(stfonts == NULL || psFontData == NULL)
|
||||
return;
|
||||
|
||||
_TiXmlElement* node = stfonts->FirstChildElement();
|
||||
while(node)
|
||||
{
|
||||
if(stCompareFontData(node, psFontData))
|
||||
return;
|
||||
node = node->NextSiblingElement();
|
||||
}
|
||||
|
||||
_TiXmlElement* font = new _TiXmlElement("A3DFontData");
|
||||
font->SetAttribute("m_pcFamilyName", psFontData->m_pcFamilyName);
|
||||
font->SetAttribute("m_eCharset", psFontData->m_eCharset);
|
||||
font->SetAttribute("m_uiSize", (int)psFontData->m_uiSize);
|
||||
font->SetAttribute("m_cAttributes", psFontData->m_cAttributes);
|
||||
stfonts->LinkEndChild(font);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static A3DInt32 stExportFontsFromMarkupTessellation(const A3DTessMarkupData* psTess)
|
||||
{
|
||||
if(psTess->m_uiCodesSize == 0)
|
||||
return A3D_SUCCESS;
|
||||
|
||||
A3DFontKeyData sFontKeyData;
|
||||
A3DFontData sFontData;
|
||||
unsigned int uiCount, uiExtraDataType;
|
||||
const A3DUns32* puiStart = &psTess->m_puiCodes[0];
|
||||
const A3DUns32* puiEnd = &psTess->m_puiCodes[psTess->m_uiCodesSize-1];
|
||||
|
||||
for(; puiStart < puiEnd; puiStart++)
|
||||
{
|
||||
uiCount = *puiStart & kA3DMarkupIntegerMask;
|
||||
if((*puiStart & kA3DMarkupIsExtraData) != 0)
|
||||
{
|
||||
uiExtraDataType = (*puiStart & kA3DMarkupExtraDataType);
|
||||
switch(uiExtraDataType) // forced to decode these modes to traverse the inside
|
||||
{
|
||||
case kA3DMarkupFaceViewMask:
|
||||
case kA3DMarkupFrameDrawMask:
|
||||
case kA3DMarkupFixedSizeMask:
|
||||
puiStart += 1;
|
||||
break;
|
||||
case kA3DMarkupFontMask:
|
||||
A3D_INITIALIZE_DATA(A3DFontKeyData, sFontKeyData);
|
||||
sFontKeyData.m_iFontFamilyIndex = *(puiStart+2);
|
||||
sFontKeyData.m_iFontStyleIndex = (*(puiStart+3) & kA3DFontKeyStyle) >> 24;
|
||||
sFontKeyData.m_iFontSizeIndex = (*(puiStart+3) & kA3DFontKeySize) >> 12;
|
||||
sFontKeyData.m_cAttributes = (A3DInt8) (*(puiStart+3) & kA3DFontKeyAttrib);
|
||||
A3D_INITIALIZE_DATA(A3DFontData, sFontData);
|
||||
CHECK_RET(A3DGlobalFontKeyGet(&sFontKeyData, &sFontData));
|
||||
stAddFont(&sFontData);
|
||||
puiStart += size_t(uiCount + 1);
|
||||
CHECK_RET(A3DGlobalFontKeyGet(nullptr, &sFontData));
|
||||
break;
|
||||
default:
|
||||
puiStart += size_t(uiCount + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// forced to decode that mode to traverse the inside
|
||||
else if((*puiStart & kA3DMarkupIsMatrix) != 0)
|
||||
puiStart += 1;
|
||||
else
|
||||
puiStart += size_t(uiCount + 1);
|
||||
}
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseFonts(_TiXmlElement* setting)
|
||||
{
|
||||
if(stfonts == NULL)
|
||||
return A3D_ERROR;
|
||||
|
||||
_TiXmlElement* node = setting->FirstChildElement("A3DGlobalData");
|
||||
if(node == NULL)
|
||||
return A3D_ERROR;
|
||||
|
||||
_TiXmlElement* font = stfonts->FirstChildElement();
|
||||
while(font)
|
||||
{
|
||||
_TiXmlElement* newfont = new _TiXmlElement(*font);
|
||||
node->LinkEndChild(newfont);
|
||||
font = font->NextSiblingElement();
|
||||
}
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static A3DInt32 stTraverseTessBase(const A3DTessBase* pTess, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTessBaseData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTessBaseData, sData);
|
||||
|
||||
_TiXmlElement* tessbase = new _TiXmlElement("A3DTessBaseData");
|
||||
|
||||
A3DInt32 iRet = A3DTessBaseGet(pTess, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
tessbase->SetAttribute("m_bIsCalculated", sData.m_bIsCalculated ? 1 : 0);
|
||||
traverseDoubles("m_pdCoords", sData.m_uiCoordSize, sData.m_pdCoords, tessbase);
|
||||
|
||||
A3DTessBaseGet(NULL, &sData);
|
||||
}
|
||||
setting->LinkEndChild(tessbase);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseMarkupTess(const A3DTessMarkup* pMarkupTess, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DTessMarkupData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTessMarkupData, sData);
|
||||
|
||||
_TiXmlElement* markuptess = new _TiXmlElement("A3DTessMarkupData");
|
||||
|
||||
stTraverseTessBase(pMarkupTess, markuptess);
|
||||
|
||||
iRet = A3DTessMarkupGet(pMarkupTess, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseUInts("m_puiCodes",sData.m_uiCodesSize, sData.m_puiCodes, markuptess);
|
||||
|
||||
for(A3DUns32 i = 0; i < sData.m_uiTextsSize; ++i)
|
||||
{
|
||||
_TiXmlElement* text = new _TiXmlElement("pcText");
|
||||
text->SetAttribute("data", sData.m_ppcTexts[i]);
|
||||
markuptess->LinkEndChild(text);
|
||||
}
|
||||
|
||||
if(sData.m_pcLabel)
|
||||
markuptess->SetAttribute("m_pcLabel", sData.m_pcLabel);
|
||||
markuptess->SetAttribute("m_cBehaviour", (int) sData.m_cBehaviour);
|
||||
|
||||
stExportFontsFromMarkupTessellation(&sData);
|
||||
A3DTessMarkupGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
markuptess->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(markuptess);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int traverse3DWireTess(const A3DTess3DWire* pWireTess, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DTess3DWireData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTess3DWireData, sData);
|
||||
|
||||
_TiXmlElement* wiretess = new _TiXmlElement("A3DTess3DWireData");
|
||||
|
||||
stTraverseTessBase(pWireTess, wiretess);
|
||||
|
||||
iRet = A3DTess3DWireGet(pWireTess, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseUInts("m_puiSizesWires", sData.m_uiSizesWiresSize, sData.m_puiSizesWires, wiretess);
|
||||
traverseUChars("m_pucRGBAVertices", sData.m_uiRGBAVerticesSize, sData.m_pucRGBAVertices, wiretess);
|
||||
|
||||
A3DTess3DWireGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
wiretess->SetAttribute("error", iRet);
|
||||
}
|
||||
setting->LinkEndChild(wiretess);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int traverseFaceTessData(const A3DTessFaceData& sFaceTessData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
|
||||
_TiXmlElement* facetess = new _TiXmlElement("A3DTessFaceData");
|
||||
|
||||
facetess->SetAttribute("m_usUsedEntitiesFlags", (int) sFaceTessData.m_usUsedEntitiesFlags);
|
||||
facetess->SetAttribute("m_uiStartTriangulated", (int) sFaceTessData.m_uiStartTriangulated);
|
||||
facetess->SetAttribute("m_uiStartWire", (int) sFaceTessData.m_uiStartWire);
|
||||
facetess->SetAttribute("m_uiTextureCoordIndexesSize", (int) sFaceTessData.m_uiTextureCoordIndexesSize);
|
||||
|
||||
traverseUInts("m_puiStyleIndexes", sFaceTessData.m_uiStyleIndexesSize, sFaceTessData.m_puiStyleIndexes, facetess);
|
||||
traverseUInts("m_puiSizesTriangulated", sFaceTessData.m_uiSizesTriangulatedSize,
|
||||
sFaceTessData.m_puiSizesTriangulated, facetess);
|
||||
traverseUInts("m_puiSizesWires", sFaceTessData.m_uiSizesWiresSize, sFaceTessData.m_puiSizesWires, facetess);
|
||||
traverseUChars("m_pucRGBAVertices", sFaceTessData.m_uiRGBAVerticesSize, sFaceTessData.m_pucRGBAVertices, facetess);
|
||||
|
||||
setting->LinkEndChild(facetess);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverse3DTess(const A3DTess3D* pTess, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
A3DTess3DData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTess3DData, sData);
|
||||
|
||||
_TiXmlElement* tess = new _TiXmlElement("A3DTess3DData");
|
||||
|
||||
stTraverseTessBase(pTess, tess);
|
||||
|
||||
iRet = A3DTess3DGet(pTess, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
tess->SetAttribute("m_bHasFaces", (int)(sData.m_bHasFaces));
|
||||
traverseDoubles("m_pdNormals", sData.m_uiNormalSize, sData.m_pdNormals, tess);
|
||||
traverseUInts("m_puiWireIndexes", sData.m_uiWireIndexSize, sData.m_puiWireIndexes, tess);
|
||||
traverseUInts("m_puiTriangulatedIndexes", sData.m_uiTriangulatedIndexSize, sData.m_puiTriangulatedIndexes,
|
||||
tess);
|
||||
traverseDoubles("m_pdTextureCoords", sData.m_uiTextureCoordSize, sData.m_pdTextureCoords, tess);
|
||||
tess->SetDoubleAttribute("m_dCreaseAngle", sData.m_dCreaseAngle);
|
||||
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiFaceTessSize; ++ui)
|
||||
traverseFaceTessData(sData.m_psFaceTessData[ui], tess);
|
||||
|
||||
A3DTess3DGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
tess->SetAttribute("error", iRet);
|
||||
}
|
||||
setting->LinkEndChild(tess);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseTessBase(const A3DTessBase* pTess, _TiXmlElement* setting)
|
||||
{
|
||||
A3DEEntityType eType;
|
||||
A3DInt32 iRet = A3DEntityGetType(pTess, &eType);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
switch(eType)
|
||||
{
|
||||
case kA3DTypeTess3D:
|
||||
sttraverse3DTess(pTess,setting);
|
||||
break;
|
||||
case kA3DTypeTess3DWire:
|
||||
traverse3DWireTess(pTess,setting);
|
||||
break;
|
||||
case kA3DTypeTessMarkup:
|
||||
traverseMarkupTess(pTess,setting);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
94
exchange/exchangesource/PRC2XML/PRC2XMLTexture.cpp
Normal file
94
exchange/exchangesource/PRC2XML/PRC2XMLTexture.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseTextureApplication(const A3DGraphTextureApplicationData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
_TiXmlElement *textureapplication = new _TiXmlElement("A3DGraphTextureApplicationData");
|
||||
|
||||
textureapplication->SetAttribute("m_uiMaterialIndex", (int) sData.m_uiMaterialIndex);
|
||||
textureapplication->SetAttribute("m_uiTextureDefinitionIndex", (int) sData.m_uiTextureDefinitionIndex);
|
||||
textureapplication->SetAttribute("m_iUVCoordinatesIndex", (int) sData.m_iUVCoordinatesIndex);
|
||||
textureapplication->SetAttribute("m_uiNextTextureApplicationIndex", (int) sData.m_uiNextTextureApplicationIndex);
|
||||
setting->LinkEndChild(textureapplication);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseTextureTransformation(const A3DGraphTextureTransformationData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
_TiXmlElement *texturetransformation = new _TiXmlElement("A3DGraphTextureTransformationData");
|
||||
|
||||
texturetransformation->SetAttribute("m_bTextureFlipS", (int) sData.m_bTextureFlipS);
|
||||
texturetransformation->SetAttribute("m_bTextureFlipT", (int) sData.m_bTextureFlipT);
|
||||
traverseDoubles("m_dMatrix",16,(A3DDouble*)(&(sData.m_dMatrix)),texturetransformation);
|
||||
texturetransformation->SetAttribute("m_bIs2D", (int) sData.m_bIs2D);
|
||||
setting->LinkEndChild(texturetransformation);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseTextureDefinition(const A3DGraphTextureDefinitionData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iRet = A3D_SUCCESS;
|
||||
_TiXmlElement *texturedefinition = new _TiXmlElement("A3DGraphTextureDefinitionData");
|
||||
|
||||
texturedefinition->SetAttribute("m_uiPictureIndex", (int) sData.m_uiPictureIndex);
|
||||
texturedefinition->SetAttribute("m_ucTextureDimension", (int) sData.m_ucTextureDimension);
|
||||
texturedefinition->SetAttribute("m_eMappingType", (int) sData.m_eMappingType);
|
||||
texturedefinition->SetAttribute("m_eMappingOperator", (int) sData.m_eMappingOperator);
|
||||
|
||||
traverseCartesianTransformation(sData.m_pOperatorTransfo, texturedefinition);
|
||||
|
||||
texturedefinition->SetAttribute("m_uiMappingAttributes", (int) sData.m_uiMappingAttributes);
|
||||
traverseDoubles("m_pdMappingAttributesIntensity", sData.m_uiMappingAttributesIntensitySize,
|
||||
sData.m_pdMappingAttributesIntensity, texturedefinition);
|
||||
traverseUChars("m_pucMappingAttributesComponents", sData.m_uiMappingAttributesComponentsSize,
|
||||
sData.m_pucMappingAttributesComponents, texturedefinition);
|
||||
texturedefinition->SetAttribute("m_eTextureFunction", (int) sData.m_eTextureFunction);
|
||||
texturedefinition->SetAttribute("m_dRed", (int) sData.m_dRed);
|
||||
texturedefinition->SetAttribute("m_dGreen", (int) sData.m_dGreen);
|
||||
texturedefinition->SetAttribute("m_dBlue", (int) sData.m_dBlue);
|
||||
texturedefinition->SetAttribute("m_dAlpha", (int) sData.m_dAlpha);
|
||||
texturedefinition->SetAttribute("m_eBlend_src_RGB", (int) sData.m_eBlend_src_RGB);
|
||||
texturedefinition->SetAttribute("m_eBlend_dst_RGB", (int) sData.m_eBlend_dst_RGB);
|
||||
texturedefinition->SetAttribute("m_eBlend_src_Alpha", (int) sData.m_eBlend_src_Alpha);
|
||||
texturedefinition->SetAttribute("m_eBlend_dst_Alpha", (int) sData.m_eBlend_dst_Alpha);
|
||||
texturedefinition->SetAttribute("m_ucTextureApplyingMode", (int) sData.m_ucTextureApplyingMode);
|
||||
texturedefinition->SetAttribute("m_eTextureAlphaTest", (int) sData.m_eTextureAlphaTest);
|
||||
texturedefinition->SetAttribute("m_dAlphaTestReference", (int) sData.m_dAlphaTestReference);
|
||||
texturedefinition->SetAttribute("m_eTextureWrappingModeS", (int) sData.m_eTextureWrappingModeS);
|
||||
texturedefinition->SetAttribute("m_eTextureWrappingModeT", (int) sData.m_eTextureWrappingModeT);
|
||||
|
||||
if(sData.m_pTextureTransfo != NULL)
|
||||
{
|
||||
A3DGraphTextureTransformationData sTransfoData;
|
||||
A3D_INITIALIZE_DATA(A3DGraphTextureTransformationData, sTransfoData);
|
||||
iRet = A3DGraphTextureTransformationGet(sData.m_pTextureTransfo,&sTransfoData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
sttraverseTextureTransformation(sTransfoData,texturedefinition);
|
||||
A3DGraphTextureTransformationGet(NULL,&sTransfoData);
|
||||
}
|
||||
}
|
||||
setting->LinkEndChild(texturedefinition);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
450
exchange/exchangesource/PRC2XML/PRC2XMLTools.cpp
Normal file
450
exchange/exchangesource/PRC2XML/PRC2XMLTools.cpp
Normal file
@@ -0,0 +1,450 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
#define READMAXBIGSTRING 65536
|
||||
A3DUTF8Char gbigstring[READMAXBIGSTRING]; // 64 kB buffer is OK to store big strings like array of doubles
|
||||
A3DUns32 gnAllocatedStrings = 0;
|
||||
|
||||
//######################################################################################################################
|
||||
void _SetDoubleAttribute(_TiXmlElement* psElement, const char* name, double val)
|
||||
{
|
||||
// max size of one double: "%.15 " 13+1+15+1=30
|
||||
A3DUTF8Char* pc = gbigstring;
|
||||
size_t iwritten = sprintf_s(pc,sizeof(gbigstring)-1, "%.15f", val);
|
||||
for(size_t i = iwritten - 1; i > 0; i--)
|
||||
{
|
||||
if((pc)[i] == '0')
|
||||
(pc)[i] = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
psElement->SetAttribute(name, pc);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
const _TiXmlElement* _FirstChildByAttribute(_TiXmlElement* psElement, const A3DUTF8Char* pcAttribName, void* pValue)
|
||||
{
|
||||
A3DUTF8Char buffer[64];
|
||||
sprintf_s(buffer,sizeof(buffer)-1, "%p", pValue);
|
||||
|
||||
const _TiXmlElement* child = psElement->FirstChildElement();
|
||||
for(; child; child = child->NextSiblingElement())
|
||||
{
|
||||
const A3DUTF8Char* pcValue = child->Attribute(pcAttribName);
|
||||
if(pcValue != NULL && strcmp(pcValue, buffer) == 0)
|
||||
return child;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
void _SetAttributePtr(_TiXmlElement* psElement, const A3DUTF8Char* pcAttribName, void* pValue)
|
||||
{
|
||||
A3DUTF8Char buffer[64];
|
||||
sprintf_s(buffer,sizeof(buffer)-1, "%p", pValue);
|
||||
psElement->SetAttribute(pcAttribName, buffer);
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDoubles(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DDouble* pd, _TiXmlElement* setting)
|
||||
{
|
||||
if(uiSize > 0)
|
||||
{
|
||||
A3DUns32 ui = 0;
|
||||
_TiXmlElement* doubles = new _TiXmlElement(name);
|
||||
|
||||
doubles->SetAttribute("size", (int)uiSize);
|
||||
|
||||
// max size of one double: "%.15 " 13+1+15+1=30
|
||||
A3DUns32 uiFormat = 30;
|
||||
A3DUTF8Char* pc = NULL;
|
||||
if(uiFormat*uiSize > READMAXBIGSTRING)
|
||||
{
|
||||
pc = (A3DUTF8Char*) malloc(size_t(uiSize * uiFormat) * sizeof(A3DUTF8Char));
|
||||
pc[0] = 0;
|
||||
gnAllocatedStrings++;
|
||||
}
|
||||
else
|
||||
pc = gbigstring;
|
||||
|
||||
size_t uiNext = 0;
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
int iwritten = sprintf(pc+uiNext, "%.15f", pd[ui]);
|
||||
size_t i = size_t(iwritten - 1);
|
||||
for(; i > 0; i--)
|
||||
{
|
||||
if((pc+uiNext)[i] == '0')
|
||||
(pc+uiNext)[i] = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
(pc+uiNext)[i+1] = L' ';
|
||||
uiNext += i+2;
|
||||
}
|
||||
pc[uiNext-1] = 0;
|
||||
|
||||
doubles->SetAttribute("data", pc);
|
||||
setting->LinkEndChild(doubles);
|
||||
|
||||
if(uiFormat*uiSize > READMAXBIGSTRING)
|
||||
free(pc);
|
||||
}
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseUInts(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DUns32* pui, _TiXmlElement* setting)
|
||||
{
|
||||
if(uiSize > 0)
|
||||
{
|
||||
A3DUns32 ui = 0;
|
||||
_TiXmlElement* uints = new _TiXmlElement(name);
|
||||
uints->SetAttribute("size", (int)uiSize);
|
||||
|
||||
// max size of one uint: "%d " 14+1=15
|
||||
A3DUns32 uiFormat = 15;
|
||||
A3DUTF8Char* pc = NULL;
|
||||
if(uiFormat*uiSize > READMAXBIGSTRING)
|
||||
{
|
||||
pc = (A3DUTF8Char*) malloc(size_t(uiSize * uiFormat) * sizeof(A3DUTF8Char));
|
||||
pc[0] = 0;
|
||||
gnAllocatedStrings++;
|
||||
}
|
||||
else
|
||||
pc = gbigstring;
|
||||
|
||||
size_t uiNext = 0;
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
int iwritten = sprintf(pc+uiNext, "%u ", pui[ui]);
|
||||
uiNext += size_t(iwritten);
|
||||
}
|
||||
pc[uiNext] = 0;
|
||||
|
||||
uints->SetAttribute("data", pc);
|
||||
setting->LinkEndChild(uints);
|
||||
|
||||
if(uiFormat*uiSize > READMAXBIGSTRING)
|
||||
free(pc);
|
||||
}
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseUChars(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DUns8* pui, _TiXmlElement* setting)
|
||||
{
|
||||
if(uiSize > 0)
|
||||
{
|
||||
A3DUns32 ui = 0;
|
||||
_TiXmlElement* uints = new _TiXmlElement(name);
|
||||
uints->SetAttribute("size", (int)uiSize);
|
||||
|
||||
// max size of one uchar: "%d ": 6
|
||||
A3DUns32 uiFormat = 6;
|
||||
A3DUTF8Char* pc = NULL;
|
||||
if(uiFormat*uiSize > READMAXBIGSTRING)
|
||||
{
|
||||
pc = (A3DUTF8Char*) malloc(size_t(uiSize * uiFormat) * sizeof(A3DUTF8Char));
|
||||
pc[0] = 0;
|
||||
gnAllocatedStrings++;
|
||||
}
|
||||
else
|
||||
pc = gbigstring;
|
||||
|
||||
size_t uiNext = 0;
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
int iwritten = sprintf(pc+uiNext, "%u ", pui[ui]);
|
||||
uiNext += size_t(iwritten);
|
||||
}
|
||||
pc[uiNext] = 0;
|
||||
|
||||
uints->SetAttribute("data", pc);
|
||||
setting->LinkEndChild(uints);
|
||||
|
||||
if(uiFormat*uiSize > READMAXBIGSTRING)
|
||||
free(pc);
|
||||
}
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseBools(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DBool* pb, _TiXmlElement* setting)
|
||||
{
|
||||
if(uiSize > 0)
|
||||
{
|
||||
A3DUns32 ui = 0;
|
||||
_TiXmlElement* bools = new _TiXmlElement(name);
|
||||
bools->SetAttribute("size", (int) uiSize);
|
||||
|
||||
// max size of one bool: 2
|
||||
A3DUns32 uiFormat = 2;
|
||||
A3DUTF8Char* pc = NULL;
|
||||
if(uiFormat*uiSize > READMAXBIGSTRING)
|
||||
{
|
||||
pc = (A3DUTF8Char*) malloc(size_t(uiSize * uiFormat) * sizeof(A3DUTF8Char));
|
||||
pc[0] = 0;
|
||||
gnAllocatedStrings++;
|
||||
}
|
||||
else
|
||||
pc = gbigstring;
|
||||
|
||||
size_t uiNext = 0;
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
int iwritten = sprintf(pc+uiNext, "%u ", pb[ui] ? 1 : 0);
|
||||
uiNext += size_t(iwritten);
|
||||
}
|
||||
pc[uiNext] = 0;
|
||||
|
||||
bools->SetAttribute("data", pc);
|
||||
setting->LinkEndChild(bools);
|
||||
|
||||
if(uiFormat*uiSize > READMAXBIGSTRING)
|
||||
free(pc);
|
||||
}
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseVoids(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DVoid** pp, _TiXmlElement* setting)
|
||||
{
|
||||
if(uiSize > 0)
|
||||
{
|
||||
A3DUns32 ui = 0;
|
||||
_TiXmlElement* uints = new _TiXmlElement(name);
|
||||
uints->SetAttribute("size", (int)uiSize);
|
||||
|
||||
// max size of one void: "%p ":8
|
||||
A3DUns32 uiFormat = 8;
|
||||
A3DUTF8Char* pc = NULL;
|
||||
if(uiFormat*uiSize > READMAXBIGSTRING)
|
||||
{
|
||||
pc = (A3DUTF8Char*) malloc(size_t(uiSize * uiFormat) * sizeof(A3DUTF8Char));
|
||||
pc[0] = 0;
|
||||
gnAllocatedStrings++;
|
||||
}
|
||||
else
|
||||
pc = gbigstring;
|
||||
|
||||
size_t uiNext = 0;
|
||||
for(ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
const A3DVoid* p = pp[ui];
|
||||
int iwritten = sprintf(pc+uiNext, "%p ", (void*) p);
|
||||
uiNext += size_t(iwritten);
|
||||
}
|
||||
pc[uiNext]=0;
|
||||
|
||||
uints->SetAttribute("data", pc);
|
||||
setting->LinkEndChild(uints);
|
||||
|
||||
if(uiFormat*uiSize > READMAXBIGSTRING)
|
||||
free(pc);
|
||||
}
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traversePoint(const A3DUTF8Char* name, const A3DVector3dData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* pt = new _TiXmlElement(name);
|
||||
_SetDoubleAttribute(pt, "m_dX", sData.m_dX);
|
||||
_SetDoubleAttribute(pt, "m_dY", sData.m_dY);
|
||||
_SetDoubleAttribute(pt, "m_dZ", sData.m_dZ);
|
||||
setting->LinkEndChild(pt);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traversePoint2d(const A3DUTF8Char* name, const A3DVector2dData& sData, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* pt = new _TiXmlElement(name);
|
||||
_SetDoubleAttribute(pt, "m_dX", sData.m_dX);
|
||||
_SetDoubleAttribute(pt, "m_dY", sData.m_dY);
|
||||
setting->LinkEndChild(pt);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traversePoints(const A3DUTF8Char* name, const A3DUns32 uiSize, const A3DVector3dData* pv, _TiXmlElement* setting)
|
||||
{
|
||||
if(uiSize > 0)
|
||||
{
|
||||
A3DDouble* pd = (A3DDouble*) malloc(size_t(uiSize) * 3 * sizeof(A3DDouble));
|
||||
if(pd == NULL)
|
||||
return A3D_ALLOC_FATAL_ERROR;
|
||||
|
||||
for(A3DUns32 ui = 0; ui < uiSize; ++ui)
|
||||
{
|
||||
pd[3*ui] = pv[ui].m_dX;
|
||||
pd[3*ui+1] = pv[ui].m_dY;
|
||||
pd[3*ui+2] = pv[ui].m_dZ;
|
||||
}
|
||||
traverseDoubles(name, 3*uiSize, pd, setting);
|
||||
free(pd);
|
||||
}
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseInterval(const A3DIntervalData* pData, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* extent1d = new _TiXmlElement("A3DIntervalData");
|
||||
_SetDoubleAttribute(extent1d, "m_dMin", pData->m_dMin);
|
||||
_SetDoubleAttribute(extent1d, "m_dMax", pData->m_dMax);
|
||||
setting->LinkEndChild(extent1d);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseDomain(const A3DDomainData* pData, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* extent2d = new _TiXmlElement("A3DDomainData");
|
||||
_SetDoubleAttribute(extent2d, "m_sMin.m_dX", pData->m_sMin.m_dX);
|
||||
_SetDoubleAttribute(extent2d, "m_sMin.m_dY", pData->m_sMin.m_dY);
|
||||
_SetDoubleAttribute(extent2d, "m_sMax.m_dX", pData->m_sMax.m_dX);
|
||||
_SetDoubleAttribute(extent2d, "m_sMax.m_dY", pData->m_sMax.m_dY);
|
||||
setting->LinkEndChild(extent2d);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseBoundingBox(const A3DBoundingBoxData* pData, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* extent3d = new _TiXmlElement("A3DBoundingBoxData");
|
||||
_SetDoubleAttribute(extent3d, "m_sMin.m_dX", pData->m_sMin.m_dX);
|
||||
_SetDoubleAttribute(extent3d, "m_sMin.m_dY", pData->m_sMin.m_dY);
|
||||
_SetDoubleAttribute(extent3d, "m_sMin.m_dZ", pData->m_sMin.m_dZ);
|
||||
_SetDoubleAttribute(extent3d, "m_sMax.m_dX", pData->m_sMax.m_dX);
|
||||
_SetDoubleAttribute(extent3d, "m_sMax.m_dY", pData->m_sMax.m_dY);
|
||||
_SetDoubleAttribute(extent3d, "m_sMax.m_dZ", pData->m_sMax.m_dZ);
|
||||
setting->LinkEndChild(extent3d);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseParam(const A3DParameterizationData* pData, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* param = new _TiXmlElement("A3DParameterizationData");
|
||||
_SetDoubleAttribute(param, "m_sInterval.m_dMin", pData->m_sInterval.m_dMin);
|
||||
_SetDoubleAttribute(param, "m_sInterval.m_dMax", pData->m_sInterval.m_dMax);
|
||||
_SetDoubleAttribute(param, "m_dCoeffA", pData->m_dCoeffA);
|
||||
_SetDoubleAttribute(param, "m_dCoeffB", pData->m_dCoeffB);
|
||||
setting->LinkEndChild(param);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseUVParam(const A3DUVParameterizationData* pData, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* param = new _TiXmlElement("A3DUVParameterizationData");
|
||||
traverseDomain(&pData->m_sUVDomain, param);
|
||||
_SetDoubleAttribute(param, "m_dUCoeffA", pData->m_dUCoeffA);
|
||||
_SetDoubleAttribute(param, "m_dUCoeffB", pData->m_dUCoeffB);
|
||||
_SetDoubleAttribute(param, "m_dVCoeffA", pData->m_dVCoeffA);
|
||||
_SetDoubleAttribute(param, "m_dVCoeffB", pData->m_dVCoeffB);
|
||||
_SetDoubleAttribute(param, "m_bSwapUV", (int)pData->m_bSwapUV);
|
||||
setting->LinkEndChild(param);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
A3DStatus traverseCartesianTransformationData(const A3DMiscCartesianTransformationData& oTrsf, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* trsf = new _TiXmlElement("A3DMiscCartesianTransformationData");
|
||||
trsf->SetAttribute("m_ucBehaviour", (int)(oTrsf.m_ucBehaviour));
|
||||
traversePoint("m_sOrigin" , oTrsf.m_sOrigin , trsf);
|
||||
traversePoint("m_sXVector", oTrsf.m_sXVector, trsf);
|
||||
traversePoint("m_sYVector", oTrsf.m_sYVector, trsf);
|
||||
traversePoint("m_sScale" , oTrsf.m_sScale , trsf);
|
||||
setting->LinkEndChild(trsf);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
A3DStatus traverseCartesianTransformation(const A3DMiscCartesianTransformation* pTrsf, _TiXmlElement* setting)
|
||||
{
|
||||
if (pTrsf)
|
||||
{
|
||||
A3DMiscCartesianTransformationData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMiscCartesianTransformationData, sData);
|
||||
A3DStatus iRet = A3DMiscCartesianTransformationGet(pTrsf, &sData);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseCartesianTransformationData(sData, setting);
|
||||
A3DMiscCartesianTransformationGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
setting->SetAttribute("error", iRet);
|
||||
}
|
||||
}
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
A3DStatus traverseGeneralTransformation(const A3DMiscGeneralTransformation* pTrsf, _TiXmlElement* setting)
|
||||
{
|
||||
_TiXmlElement* trsf = new _TiXmlElement("A3DMiscGeneralTransformationData");
|
||||
A3DMiscGeneralTransformationData sData;
|
||||
A3D_INITIALIZE_DATA(A3DMiscGeneralTransformationData, sData);
|
||||
A3DStatus iRet = A3DMiscGeneralTransformationGet(pTrsf, &sData);
|
||||
if (iRet == A3D_SUCCESS)
|
||||
{
|
||||
traverseDoubles("m_adCoeff", 16, sData.m_adCoeff, trsf);
|
||||
A3DMiscGeneralTransformationGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
trsf->SetAttribute("error", iRet);
|
||||
}
|
||||
setting->LinkEndChild(trsf);
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
A3DStatus traverseTransformation(const A3DMiscTransformation* pTransfo3d, _TiXmlElement* setting)
|
||||
{
|
||||
if(pTransfo3d == NULL)
|
||||
return A3D_SUCCESS;
|
||||
|
||||
A3DStatus iRet;
|
||||
_TiXmlElement* trsf = new _TiXmlElement("A3DMiscTransformation");
|
||||
traverseSource(pTransfo3d, trsf);
|
||||
A3DEEntityType eType = kA3DTypeUnknown;
|
||||
iRet = A3DEntityGetType(pTransfo3d, &eType);
|
||||
if (eType == kA3DTypeMiscCartesianTransformation)
|
||||
{
|
||||
iRet = traverseCartesianTransformation(pTransfo3d, trsf);
|
||||
}
|
||||
else if (eType == kA3DTypeMiscGeneralTransformation)
|
||||
{
|
||||
iRet = traverseGeneralTransformation(pTransfo3d, trsf);
|
||||
}
|
||||
else
|
||||
{
|
||||
trsf->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(trsf);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
417
exchange/exchangesource/PRC2XML/PRC2XMLTopology.cpp
Normal file
417
exchange/exchangesource/PRC2XML/PRC2XMLTopology.cpp
Normal file
@@ -0,0 +1,417 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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 <A3DSDKIncludes.h>
|
||||
#include "PRC2XML.h"
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseMultipleVertex(const A3DTopoMultipleVertex* pVertex, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoMultipleVertexData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoMultipleVertexData, sData);
|
||||
|
||||
_TiXmlElement* vertex = new _TiXmlElement("A3DTopoMultipleVertexData");
|
||||
traverseSource(pVertex, vertex);
|
||||
|
||||
A3DInt32 iRet = A3DTopoMultipleVertexGet(pVertex, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traversePoints("m_pPts",sData.m_uiSize, sData.m_pPts, vertex);
|
||||
A3DTopoMultipleVertexGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
vertex->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(vertex);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseUniqueVertex(const A3DTopoUniqueVertex* pVertex, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoUniqueVertexData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoUniqueVertexData, sData);
|
||||
|
||||
_TiXmlElement* vertex = new _TiXmlElement("A3DTopoUniqueVertexData");
|
||||
traverseSource(pVertex, vertex);
|
||||
|
||||
A3DInt32 iRet = A3DTopoUniqueVertexGet(pVertex, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
traversePoint("m_sPoint", sData.m_sPoint, vertex);
|
||||
_SetDoubleAttribute(vertex, "m_dTolerance", sData.m_dTolerance);
|
||||
A3DTopoUniqueVertexGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
vertex->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(vertex);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseVertex(const A3DTopoVertex* pVertex, _TiXmlElement* setting)
|
||||
{
|
||||
A3DEEntityType eType;
|
||||
A3DInt32 iRet = A3DEntityGetType(pVertex, &eType);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
switch(eType)
|
||||
{
|
||||
case kA3DTypeTopoMultipleVertex:
|
||||
iRet = sttraverseMultipleVertex(pVertex, setting);
|
||||
break;
|
||||
case kA3DTypeTopoUniqueVertex:
|
||||
iRet = sttraverseUniqueVertex(pVertex, setting);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseEdge(const A3DTopoEdge* pEdge, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoEdgeData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoEdgeData, sData);
|
||||
|
||||
_TiXmlElement* edge = new _TiXmlElement("A3DTopoEdgeData");
|
||||
traverseSource(pEdge, edge);
|
||||
|
||||
A3DInt32 iRet = A3DTopoEdgeGet(pEdge, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
_SetDoubleAttribute(edge, "m_dTolerance", sData.m_dTolerance);
|
||||
edge->SetAttribute("m_bHasTrimDomain", (int) sData.m_bHasTrimDomain);
|
||||
|
||||
if(sData.m_p3dCurve)
|
||||
traverseCurve(sData.m_p3dCurve, edge);
|
||||
if(sData.m_bHasTrimDomain)
|
||||
traverseInterval(&sData.m_sInterval, edge);
|
||||
|
||||
if(sData.m_pStartVertex)
|
||||
sttraverseVertex(sData.m_pStartVertex, edge);
|
||||
if(sData.m_pEndVertex)
|
||||
sttraverseVertex(sData.m_pEndVertex, edge);
|
||||
|
||||
A3DTopoEdgeGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
edge->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(edge);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseCoEdge(const A3DTopoCoEdge* pCoEdge, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoCoEdgeData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoCoEdgeData, sData);
|
||||
|
||||
_TiXmlElement* coedge = new _TiXmlElement("A3DTopoCoEdgeData");
|
||||
traverseSource(pCoEdge, coedge);
|
||||
|
||||
A3DInt32 iRet = A3DTopoCoEdgeGet(pCoEdge, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
if(sData.m_pEdge)
|
||||
sttraverseEdge(sData.m_pEdge, coedge);
|
||||
if(sData.m_pUVCurve)
|
||||
traverseCurve(sData.m_pUVCurve, coedge);
|
||||
|
||||
//_SetAttributePtr(coedge, "m_pNeighbor", sData.m_pNeighbor);
|
||||
coedge->SetAttribute("m_pNeighbor", sData.m_pNeighbor ? "true" : "false");
|
||||
coedge->SetAttribute("m_ucOrientationUVWithLoop", (int) sData.m_ucOrientationUVWithLoop);
|
||||
coedge->SetAttribute("m_ucOrientationWithLoop", (int) sData.m_ucOrientationWithLoop);
|
||||
A3DTopoCoEdgeGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
coedge->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(coedge);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseLoop(const A3DTopoLoop* pLoop, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoLoopData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoLoopData, sData);
|
||||
|
||||
_TiXmlElement* loop = new _TiXmlElement("A3DTopoLoopData");
|
||||
traverseSource(pLoop, loop);
|
||||
|
||||
A3DInt32 iRet = A3DTopoLoopGet(pLoop, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
loop->SetAttribute("m_ucOrientationWithSurface", (int)(sData.m_ucOrientationWithSurface));
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiCoEdgeSize; ++ui)
|
||||
iRet = sttraverseCoEdge(sData.m_ppCoEdges[ui], loop);
|
||||
A3DTopoLoopGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
loop->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(loop);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseFace(const A3DTopoFace* pFace, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoFaceData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoFaceData, sData);
|
||||
|
||||
_TiXmlElement* face = new _TiXmlElement("A3DTopoFaceData");
|
||||
traverseSource(pFace, face);
|
||||
|
||||
A3DInt32 iRet = A3DTopoFaceGet(pFace, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
face->SetAttribute("m_bHasTrimDomain", (int)(sData.m_bHasTrimDomain));
|
||||
face->SetAttribute("m_uiOuterLoopIndex", (int)(sData.m_uiOuterLoopIndex));
|
||||
_SetDoubleAttribute(face, "m_dTolerance", sData.m_dTolerance);
|
||||
|
||||
traverseSurface(sData.m_pSurface, face);
|
||||
|
||||
if(sData.m_bHasTrimDomain)
|
||||
traverseDomain(&sData.m_sSurfaceDomain, face);
|
||||
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiLoopSize; ++ui)
|
||||
iRet = sttraverseLoop(sData.m_ppLoops[ui], face);
|
||||
|
||||
A3DTopoFaceGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
face->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(face);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseShell(const A3DTopoShell* pShell, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoShellData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoShellData, sData);
|
||||
|
||||
_TiXmlElement* shell = new _TiXmlElement("A3DTopoShellData");
|
||||
traverseSource(pShell, shell);
|
||||
|
||||
A3DInt32 iRet = A3DTopoShellGet(pShell, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
shell->SetAttribute("closed", (int)(sData.m_bClosed));
|
||||
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiFaceSize; ++ui)
|
||||
iRet = sttraverseFace(sData.m_ppFaces[ui], shell);
|
||||
|
||||
traverseUChars("m_pucOrientationWithShell",sData.m_uiFaceSize,sData.m_pucOrientationWithShell,shell);
|
||||
|
||||
A3DTopoShellGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(shell);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseConnex(const A3DTopoConnex* pConnex, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoConnexData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoConnexData, sData);
|
||||
|
||||
_TiXmlElement* connex = new _TiXmlElement("A3DTopoConnexData");
|
||||
traverseSource(pConnex, connex);
|
||||
|
||||
A3DInt32 iRet = A3DTopoConnexGet(pConnex, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiShellSize; ++ui)
|
||||
iRet = sttraverseShell(sData.m_ppShells[ui], connex);
|
||||
A3DTopoConnexGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
connex->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(connex);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseBrepData(const A3DTopoBrepData* pBrepData, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoBrepDataData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoBrepDataData, sData);
|
||||
|
||||
_TiXmlElement* brepdata = new _TiXmlElement("A3DTopoBrepDataData");
|
||||
traverseSource(pBrepData, brepdata);
|
||||
unsigned char ucBehavior;
|
||||
traverseBodyContent(pBrepData, brepdata,ucBehavior);
|
||||
|
||||
A3DInt32 iRet = A3DTopoBrepDataGet(pBrepData, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
for(A3DUns32 ui = 0; ui < sData.m_uiConnexSize; ++ui)
|
||||
iRet = sttraverseConnex(sData.m_ppConnexes[ui], brepdata);
|
||||
|
||||
if(ucBehavior !=0)
|
||||
iRet = traverseBoundingBox(&sData.m_sBoundingBox, brepdata);
|
||||
|
||||
A3DTopoBrepDataGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
brepdata->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(brepdata);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
static int sttraverseWireEdge(const A3DTopoWireEdge* pWireEdge, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoWireEdgeData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoWireEdgeData, sData);
|
||||
|
||||
_TiXmlElement* wireedge = new _TiXmlElement("A3DTopoWireEdgeData");
|
||||
traverseSource(pWireEdge, wireedge);
|
||||
|
||||
A3DInt32 iRet = A3DTopoWireEdgeGet(pWireEdge, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
wireedge->SetAttribute("m_bHasTrimDomain", (int) sData.m_bHasTrimDomain);
|
||||
|
||||
if(sData.m_p3dCurve)
|
||||
traverseCurve(sData.m_p3dCurve, wireedge);
|
||||
|
||||
if(sData.m_bHasTrimDomain)
|
||||
traverseInterval(&sData.m_sInterval, wireedge);
|
||||
|
||||
A3DTopoWireEdgeGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
wireedge->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(wireedge);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseSingleWireBody(const A3DTopoSingleWireBody* pSingleWireBody, _TiXmlElement* setting)
|
||||
{
|
||||
A3DTopoSingleWireBodyData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoSingleWireBodyData, sData);
|
||||
|
||||
_TiXmlElement* singlewirebody = new _TiXmlElement("A3DTopoSingleWireBodyData");
|
||||
traverseSource(pSingleWireBody, singlewirebody);
|
||||
unsigned char ucBehavior;
|
||||
traverseBodyContent(pSingleWireBody, singlewirebody, ucBehavior);
|
||||
|
||||
A3DInt32 iRet = A3DTopoSingleWireBodyGet(pSingleWireBody, &sData);
|
||||
if(iRet == A3D_SUCCESS)
|
||||
{
|
||||
iRet = sttraverseWireEdge(sData.m_pWireEdge, singlewirebody);
|
||||
A3DTopoSingleWireBodyGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
singlewirebody->SetAttribute("error", iRet);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(singlewirebody);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseBodyContent(const A3DTopoBody* pBody, _TiXmlElement* setting, unsigned char &ucBehavior)
|
||||
{
|
||||
A3DInt32 iErr = A3D_SUCCESS;
|
||||
A3DTopoBodyData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoBodyData, sData);
|
||||
|
||||
iErr = A3DTopoBodyGet(pBody, &sData);
|
||||
if(iErr == A3D_SUCCESS)
|
||||
{
|
||||
_TiXmlElement* bodydata = new _TiXmlElement("A3DTopoBodyData");
|
||||
|
||||
ucBehavior = (unsigned char) sData.m_ucBehaviour;
|
||||
bodydata->SetAttribute("m_ucBehaviour", (int) sData.m_ucBehaviour);
|
||||
|
||||
if(sData.m_pContext)
|
||||
{
|
||||
traverseTopoContext(sData.m_pContext, bodydata);
|
||||
setting->LinkEndChild(bodydata);
|
||||
}
|
||||
|
||||
A3DTopoBodyGet(NULL, &sData);
|
||||
}
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
int traverseTopoContext(const A3DTopoContext* pContext, _TiXmlElement* setting)
|
||||
{
|
||||
A3DInt32 iErr = A3D_SUCCESS;
|
||||
A3DTopoContextData sData;
|
||||
A3D_INITIALIZE_DATA(A3DTopoContextData, sData);
|
||||
|
||||
_TiXmlElement* topocontext = new _TiXmlElement("A3DTopoContextData");
|
||||
traverseSource(pContext, topocontext);
|
||||
|
||||
iErr = A3DTopoContextGet(pContext, &sData);
|
||||
if(iErr == A3D_SUCCESS)
|
||||
{
|
||||
topocontext->SetAttribute("m_ucBehaviour", sData.m_ucBehaviour);
|
||||
topocontext->SetDoubleAttribute("m_dGranularity", sData.m_dGranularity);
|
||||
topocontext->SetDoubleAttribute("m_dTolerance", sData.m_dTolerance);
|
||||
topocontext->SetAttribute("m_bHaveSmallestFaceThickness", sData.m_bHaveSmallestFaceThickness ? "true" : "false");
|
||||
topocontext->SetDoubleAttribute("m_dSmallestThickness", sData.m_dSmallestThickness);
|
||||
topocontext->SetAttribute("m_bHaveScale", sData.m_bHaveScale ? "true" : "false");
|
||||
topocontext->SetDoubleAttribute("m_dScale", sData.m_dScale);
|
||||
|
||||
A3DTopoContextGet(NULL, &sData);
|
||||
}
|
||||
else
|
||||
{
|
||||
topocontext->SetAttribute("error", iErr);
|
||||
}
|
||||
|
||||
setting->LinkEndChild(topocontext);
|
||||
return iErr;
|
||||
}
|
||||
111
exchange/exchangesource/PRC2XML/TinyXML/tinystr.cpp
Normal file
111
exchange/exchangesource/PRC2XML/TinyXML/tinystr.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TIXML_USE_STL
|
||||
|
||||
#include "tinystr.h"
|
||||
|
||||
// Error value for find primitive
|
||||
const _TiXmlString::size_type _TiXmlString::npos = static_cast< _TiXmlString::size_type >(-1);
|
||||
|
||||
|
||||
// Null rep.
|
||||
_TiXmlString::Rep _TiXmlString::nullrep_ = { 0, 0, { '\0' } };
|
||||
|
||||
|
||||
void _TiXmlString::reserve (size_type cap)
|
||||
{
|
||||
if (cap > capacity())
|
||||
{
|
||||
_TiXmlString tmp;
|
||||
tmp.init(length(), cap);
|
||||
memcpy(tmp.start(), data(), length());
|
||||
swap(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_TiXmlString& _TiXmlString::assign(const char* str, size_type len)
|
||||
{
|
||||
size_type cap = capacity();
|
||||
if (len > cap || cap > 3*(len + 8))
|
||||
{
|
||||
_TiXmlString tmp;
|
||||
tmp.init(len);
|
||||
memcpy(tmp.start(), str, len);
|
||||
swap(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
memmove(start(), str, len);
|
||||
set_size(len);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
_TiXmlString& _TiXmlString::append(const char* str, size_type len)
|
||||
{
|
||||
size_type newsize = length() + len;
|
||||
if (newsize > capacity())
|
||||
{
|
||||
reserve (newsize + capacity());
|
||||
}
|
||||
memmove(finish(), str, len);
|
||||
set_size(newsize);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
_TiXmlString operator + (const _TiXmlString & a, const _TiXmlString & b)
|
||||
{
|
||||
_TiXmlString tmp;
|
||||
tmp.reserve(a.length() + b.length());
|
||||
tmp += a;
|
||||
tmp += b;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
_TiXmlString operator + (const _TiXmlString & a, const char* b)
|
||||
{
|
||||
_TiXmlString tmp;
|
||||
_TiXmlString::size_type b_len = static_cast<_TiXmlString::size_type>( strlen(b) );
|
||||
tmp.reserve(a.length() + b_len);
|
||||
tmp += a;
|
||||
tmp.append(b, b_len);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
_TiXmlString operator + (const char* a, const _TiXmlString & b)
|
||||
{
|
||||
_TiXmlString tmp;
|
||||
_TiXmlString::size_type a_len = static_cast<_TiXmlString::size_type>( strlen(a) );
|
||||
tmp.reserve(a_len + b.length());
|
||||
tmp.append(a, a_len);
|
||||
tmp += b;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
#endif // TIXML_USE_STL
|
||||
305
exchange/exchangesource/PRC2XML/TinyXML/tinystr.h
Normal file
305
exchange/exchangesource/PRC2XML/TinyXML/tinystr.h
Normal file
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TIXML_USE_STL
|
||||
|
||||
#ifndef TIXML_STRING_INCLUDED
|
||||
#define TIXML_STRING_INCLUDED
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
/* The support for explicit isn't that universal, and it isn't really
|
||||
required - it is used to check that the TiXmlString class isn't incorrectly
|
||||
used. Be nice to old compilers and macro it here:
|
||||
*/
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
|
||||
// Microsoft visual studio, version 6 and higher.
|
||||
#define TIXML_EXPLICIT explicit
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 3 )
|
||||
// GCC version 3 and higher.s
|
||||
#define TIXML_EXPLICIT explicit
|
||||
#else
|
||||
#define TIXML_EXPLICIT
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
TiXmlString is an emulation of a subset of the std::string template.
|
||||
Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
|
||||
Only the member functions relevant to the TinyXML project have been implemented.
|
||||
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
|
||||
a string and there's no more room, we allocate a buffer twice as big as we need.
|
||||
*/
|
||||
class _TiXmlString
|
||||
{
|
||||
public :
|
||||
// The size type used
|
||||
typedef size_t size_type;
|
||||
|
||||
// Error value for find primitive
|
||||
static const size_type npos; // = -1;
|
||||
|
||||
|
||||
// TiXmlString empty constructor
|
||||
_TiXmlString () : rep_(&nullrep_)
|
||||
{
|
||||
}
|
||||
|
||||
// TiXmlString copy constructor
|
||||
_TiXmlString ( const _TiXmlString & copy) : rep_(0)
|
||||
{
|
||||
init(copy.length());
|
||||
memcpy(start(), copy.data(), length());
|
||||
}
|
||||
|
||||
// TiXmlString constructor, based on a string
|
||||
TIXML_EXPLICIT _TiXmlString ( const char * copy) : rep_(0)
|
||||
{
|
||||
init( static_cast<size_type>( strlen(copy) ));
|
||||
memcpy(start(), copy, length());
|
||||
}
|
||||
|
||||
// TiXmlString constructor, based on a string
|
||||
TIXML_EXPLICIT _TiXmlString ( const char * str, size_type len) : rep_(0)
|
||||
{
|
||||
init(len);
|
||||
memcpy(start(), str, len);
|
||||
}
|
||||
|
||||
// TiXmlString destructor
|
||||
~_TiXmlString ()
|
||||
{
|
||||
quit();
|
||||
}
|
||||
|
||||
_TiXmlString& operator = (const char * copy)
|
||||
{
|
||||
return assign( copy, (size_type)strlen(copy));
|
||||
}
|
||||
|
||||
_TiXmlString& operator = (const _TiXmlString & copy)
|
||||
{
|
||||
return assign(copy.start(), copy.length());
|
||||
}
|
||||
|
||||
|
||||
// += operator. Maps to append
|
||||
_TiXmlString& operator += (const char * suffix)
|
||||
{
|
||||
return append(suffix, static_cast<size_type>( strlen(suffix) ));
|
||||
}
|
||||
|
||||
// += operator. Maps to append
|
||||
_TiXmlString& operator += (char single)
|
||||
{
|
||||
return append(&single, 1);
|
||||
}
|
||||
|
||||
// += operator. Maps to append
|
||||
_TiXmlString& operator += (const _TiXmlString & suffix)
|
||||
{
|
||||
return append(suffix.data(), suffix.length());
|
||||
}
|
||||
|
||||
|
||||
// Convert a TiXmlString into a null-terminated char *
|
||||
const char * c_str () const { return rep_->str; }
|
||||
|
||||
// Convert a TiXmlString into a char * (need not be null terminated).
|
||||
const char * data () const { return rep_->str; }
|
||||
|
||||
// Return the length of a TiXmlString
|
||||
size_type length () const { return rep_->size; }
|
||||
|
||||
// Alias for length()
|
||||
size_type size () const { return rep_->size; }
|
||||
|
||||
// Checks if a TiXmlString is empty
|
||||
bool empty () const { return rep_->size == 0; }
|
||||
|
||||
// Return capacity of string
|
||||
size_type capacity () const { return rep_->capacity; }
|
||||
|
||||
|
||||
// single char extraction
|
||||
const char& at (size_type index) const
|
||||
{
|
||||
assert( index < length() );
|
||||
return rep_->str[ index ];
|
||||
}
|
||||
|
||||
// [] operator
|
||||
char& operator [] (size_type index) const
|
||||
{
|
||||
assert( index < length() );
|
||||
return rep_->str[ index ];
|
||||
}
|
||||
|
||||
// find a char in a string. Return TiXmlString::npos if not found
|
||||
size_type find (char lookup) const
|
||||
{
|
||||
return find(lookup, 0);
|
||||
}
|
||||
|
||||
// find a char in a string from an offset. Return TiXmlString::npos if not found
|
||||
size_type find (char tofind, size_type offset) const
|
||||
{
|
||||
if (offset >= length()) return npos;
|
||||
|
||||
for (const char* p = c_str() + offset; *p != '\0'; ++p)
|
||||
{
|
||||
if (*p == tofind) return static_cast< size_type >( p - c_str() );
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
void clear ()
|
||||
{
|
||||
//Lee:
|
||||
//The original was just too strange, though correct:
|
||||
// TiXmlString().swap(*this);
|
||||
//Instead use the quit & re-init:
|
||||
quit();
|
||||
init(0,0);
|
||||
}
|
||||
|
||||
/* Function to reserve a big amount of data when we know we'll need it. Be aware that this
|
||||
function DOES NOT clear the content of the TiXmlString if any exists.
|
||||
*/
|
||||
void reserve (size_type cap);
|
||||
|
||||
_TiXmlString& assign (const char* str, size_type len);
|
||||
|
||||
_TiXmlString& append (const char* str, size_type len);
|
||||
|
||||
void swap (_TiXmlString& other)
|
||||
{
|
||||
Rep* r = rep_;
|
||||
rep_ = other.rep_;
|
||||
other.rep_ = r;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void init(size_type sz) { init(sz, sz); }
|
||||
void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
|
||||
char* start() const { return rep_->str; }
|
||||
char* finish() const { return rep_->str + rep_->size; }
|
||||
|
||||
struct Rep
|
||||
{
|
||||
size_type size, capacity;
|
||||
char str[1];
|
||||
};
|
||||
|
||||
void init(size_type sz, size_type cap)
|
||||
{
|
||||
if (cap)
|
||||
{
|
||||
// Lee: the original form:
|
||||
// rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
|
||||
// doesn't work in some cases of new being overloaded. Switching
|
||||
// to the normal allocation, although use an 'int' for systems
|
||||
// that are overly picky about structure alignment.
|
||||
const size_type bytesNeeded = sizeof(Rep) + cap;
|
||||
const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
|
||||
rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
|
||||
|
||||
rep_->str[ rep_->size = sz ] = '\0';
|
||||
rep_->capacity = cap;
|
||||
}
|
||||
else
|
||||
{
|
||||
rep_ = &nullrep_;
|
||||
}
|
||||
}
|
||||
|
||||
void quit()
|
||||
{
|
||||
if (rep_ != &nullrep_)
|
||||
{
|
||||
// The rep_ is really an array of ints. (see the allocator, above).
|
||||
// Cast it back before delete, so the compiler won't incorrectly call destructors.
|
||||
delete [] ( reinterpret_cast<int*>( rep_ ) );
|
||||
}
|
||||
}
|
||||
|
||||
Rep * rep_;
|
||||
static Rep nullrep_;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
inline bool operator == (const _TiXmlString & a, const _TiXmlString & b)
|
||||
{
|
||||
return ( a.length() == b.length() ) // optimization on some platforms
|
||||
&& ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare
|
||||
}
|
||||
inline bool operator < (const _TiXmlString & a, const _TiXmlString & b)
|
||||
{
|
||||
return strcmp(a.c_str(), b.c_str()) < 0;
|
||||
}
|
||||
|
||||
inline bool operator != (const _TiXmlString & a, const _TiXmlString & b) { return !(a == b); }
|
||||
inline bool operator > (const _TiXmlString & a, const _TiXmlString & b) { return b < a; }
|
||||
inline bool operator <= (const _TiXmlString & a, const _TiXmlString & b) { return !(b < a); }
|
||||
inline bool operator >= (const _TiXmlString & a, const _TiXmlString & b) { return !(a < b); }
|
||||
|
||||
inline bool operator == (const _TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
|
||||
inline bool operator == (const char* a, const _TiXmlString & b) { return b == a; }
|
||||
inline bool operator != (const _TiXmlString & a, const char* b) { return !(a == b); }
|
||||
inline bool operator != (const char* a, const _TiXmlString & b) { return !(b == a); }
|
||||
|
||||
_TiXmlString operator + (const _TiXmlString & a, const _TiXmlString & b);
|
||||
_TiXmlString operator + (const _TiXmlString & a, const char* b);
|
||||
_TiXmlString operator + (const char* a, const _TiXmlString & b);
|
||||
|
||||
|
||||
/*
|
||||
TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
|
||||
Only the operators that we need for TinyXML have been developped.
|
||||
*/
|
||||
class TiXmlOutStream : public _TiXmlString
|
||||
{
|
||||
public :
|
||||
|
||||
// TiXmlOutStream << operator.
|
||||
TiXmlOutStream & operator << (const _TiXmlString & in)
|
||||
{
|
||||
*this += in;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// TiXmlOutStream << operator.
|
||||
TiXmlOutStream & operator << (const char * in)
|
||||
{
|
||||
*this += in;
|
||||
return *this;
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
#endif // TIXML_STRING_INCLUDED
|
||||
#endif // TIXML_USE_STL
|
||||
1886
exchange/exchangesource/PRC2XML/TinyXML/tinyxml.cpp
Normal file
1886
exchange/exchangesource/PRC2XML/TinyXML/tinyxml.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1805
exchange/exchangesource/PRC2XML/TinyXML/tinyxml.h
Normal file
1805
exchange/exchangesource/PRC2XML/TinyXML/tinyxml.h
Normal file
File diff suppressed because it is too large
Load Diff
52
exchange/exchangesource/PRC2XML/TinyXML/tinyxmlerror.cpp
Normal file
52
exchange/exchangesource/PRC2XML/TinyXML/tinyxmlerror.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
// The goal of the seperate error file is to make the first
|
||||
// step towards localization. tinyxml (currently) only supports
|
||||
// english error messages, but the could now be translated.
|
||||
//
|
||||
// It also cleans up the code a bit.
|
||||
//
|
||||
|
||||
const char* _TiXmlBase::errorString[ _TiXmlBase::TIXML_ERROR_STRING_COUNT ] =
|
||||
{
|
||||
"No error",
|
||||
"Error",
|
||||
"Failed to open file",
|
||||
"Error parsing Element.",
|
||||
"Failed to read Element name",
|
||||
"Error reading Element value.",
|
||||
"Error reading Attributes.",
|
||||
"Error: empty tag.",
|
||||
"Error reading end tag.",
|
||||
"Error parsing Unknown.",
|
||||
"Error parsing Comment.",
|
||||
"Error parsing Declaration.",
|
||||
"Error document empty.",
|
||||
"Error null (0) or unexpected EOF found in input stream.",
|
||||
"Error parsing CDATA.",
|
||||
"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
|
||||
};
|
||||
1638
exchange/exchangesource/PRC2XML/TinyXML/tinyxmlparser.cpp
Normal file
1638
exchange/exchangesource/PRC2XML/TinyXML/tinyxmlparser.cpp
Normal file
File diff suppressed because it is too large
Load Diff
82
exchange/exchangesource/PRC2XML/main.cpp
Normal file
82
exchange/exchangesource/PRC2XML/main.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 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.
|
||||
*
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#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);
|
||||
|
||||
//######################################################################################################################
|
||||
// Main function
|
||||
#ifdef _MSC_VER
|
||||
int wmain(A3DInt32 iArgc, wchar_t** ppcArgv)
|
||||
#else
|
||||
int main(A3DInt32 iArgc, A3DUTF8Char** ppcArgv)
|
||||
#endif
|
||||
{
|
||||
// ### COMMAND LINE ARGUMENTS
|
||||
//
|
||||
|
||||
if (iArgc > 4)
|
||||
{
|
||||
MY_PRINTF2("Usage:\n %s [input CAD file] [output XML file] [output LOG file]\n", ppcArgv[0]);
|
||||
MY_PRINTF(" Default output XML file is [input CAD file].xml\n");
|
||||
MY_PRINTF(" Default output LOG file is [output XML file]_Log.txt\n\n");
|
||||
return A3D_ERROR;
|
||||
}
|
||||
|
||||
MY_CHAR acSrcFileName[_MAX_PATH * 2];
|
||||
MY_CHAR acDstFileName[_MAX_PATH * 2];
|
||||
MY_CHAR acLogFileName[_MAX_PATH * 2];
|
||||
|
||||
if (iArgc > 1) MY_STRCPY(acSrcFileName, ppcArgv[1]);
|
||||
else MY_STRCPY(acSrcFileName, DEFAULT_INPUT_CAD);
|
||||
if (iArgc > 2) MY_STRCPY(acDstFileName, ppcArgv[2]);
|
||||
else MY_SPRINTF(acDstFileName, "%s.xml", acSrcFileName);
|
||||
if (iArgc > 3) MY_STRCPY(acLogFileName, ppcArgv[3]);
|
||||
else MY_SPRINTF(acLogFileName, "%s_Log.txt", acDstFileName);
|
||||
GetLogFile(acLogFileName); // Initialize log file
|
||||
|
||||
//
|
||||
// ### INITIALIZE HOOPS EXCHANGE
|
||||
//
|
||||
|
||||
A3DSDKHOOPSExchangeLoader sHoopsExchangeLoader(_T(HOOPS_BINARY_DIRECTORY));
|
||||
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
|
||||
|
||||
ProcessFile(sHoopsExchangeLoader, sImport, acSrcFileName, acDstFileName);
|
||||
|
||||
//
|
||||
// ### TERMINATE HOOPS EXCHANGE
|
||||
//
|
||||
|
||||
// Check memory allocations
|
||||
return (int)ListLeaks();
|
||||
}
|
||||
9
exchange/exchangesource/PRC2XML/read_me.txt
Normal file
9
exchange/exchangesource/PRC2XML/read_me.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
sdumont@techsoft3d.com - 2019-01-08
|
||||
-----------------------------------
|
||||
|
||||
From now the source code for the Windows/Linux/MacOS version of PRC2XML will be shared with the Android and iOS versions.
|
||||
The main.cpp file is used exclusively by the former.
|
||||
The ExchangeManagement.cpp and .h files are used exclusively by the latters.
|
||||
The source code files are copied to the Android and iOS-specific projets when creating their packages.
|
||||
|
||||
Please do not forget to update the Android and iOS projects when making changes to the Windows/Linux/MacOS one (files added or removed, compilation flags).
|
||||
Reference in New Issue
Block a user