/*********************************************************************************************************************** * * 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. * ***********************************************************************************************************************/ /** \file DemoLayers.cpp Sample DemoLayers / Data model definition ***********************************************************************************************************************/ // Do not define INITIALIZE_A3D_API here. It should be only included once in a project. #define HOOPS_PRODUCT_PUBLISH_ADVANCED #include #include "../common.hpp" #include #include #include #include #include #include //###################################################################################################################### A3DVoid mallocAndSetString(const A3DUTF8Char* srcString, A3DUTF8Char*& destString) { // we return empty strings rather than NULL because some strings usages crash with NULL values // (for example std::string xx = NULL crashes !) unsigned int uiSize = (unsigned int)(srcString ? strlen(srcString) : 0); destString = (A3DUTF8Char*)malloc((uiSize + 1) * sizeof(A3DUTF8Char)); if (uiSize > 0) { strcpy(destString, srcString); } destString[uiSize] = 0; } //###################################################################################################################### // cleaning functions void stFreeTable(A3DPDFDataTableData &sTableData) { for (A3DUns32 ir = 0; ir < sTableData.m_iNbRows ; ir++) { for(A3DUns32 ic = 0; ic < sTableData.m_iNbCols ; ic++) free(sTableData.m_ppcTexts[ir*sTableData.m_iNbCols+ic]); } free(sTableData.m_ppcTexts); } void stFreeTable3DViews(A3DPDFTable3DViewsData &sTable3DViewsData) { if (sTable3DViewsData.m_piViewIndexes) free(sTable3DViewsData.m_piViewIndexes); if (sTable3DViewsData.m_ppcViewLabels) { for(A3DUns32 ic = 0; ic < sTable3DViewsData.m_iNbViews ; ic++) if (sTable3DViewsData.m_ppcViewLabels[ic]) free(sTable3DViewsData.m_ppcViewLabels[ic]); free(sTable3DViewsData.m_ppcViewLabels); } if (sTable3DViewsData.m_ppImages) free(sTable3DViewsData.m_ppImages); if (sTable3DViewsData.m_pDataTableData) { for (A3DUns32 ir = 0; ir < sTable3DViewsData.m_pDataTableData->m_iNbRows ; ir++) { for(A3DUns32 ic = 0; ic < sTable3DViewsData.m_pDataTableData->m_iNbCols ; ic++) free(sTable3DViewsData.m_pDataTableData->m_ppcTexts[ir*sTable3DViewsData.m_pDataTableData->m_iNbCols+ic]); } } } void stFreeRelationship(A3DPDFDataRelationshipData &sRelationshipData) { free(sRelationshipData.m_pMapIndexes); } //###################################################################################################################### A3DStatus stCreateTable(A3DPDFDocument* pDoc, const std::vector > &aRows, A3DPDFDataTable*& pDataTable) { A3DStatus iRet = A3D_SUCCESS; A3DUns32 iNbRows = (A3DUns32)aRows.size(); A3DUns32 iNbCols = (A3DUns32)aRows[0].size(); A3DPDFDataTableData sTableData; A3D_INITIALIZE_DATA(A3DPDFDataTableData, sTableData); sTableData.m_iNbRows = iNbRows; sTableData.m_iNbCols = iNbCols; sTableData.m_ppcTexts = (A3DUTF8Char**)malloc(iNbRows * iNbCols * A3DUns32(sizeof(A3DUTF8Char*))); for (A3DUns32 ir = 0; ir < iNbRows; ir++) { for (A3DUns32 ic = 0; ic < iNbCols; ic++) mallocAndSetString( aRows[ir][ic].c_str(), // src sTableData.m_ppcTexts[ir*iNbCols + ic]); // dest } CHECK_RET(A3DPDFDataTableCreate(pDoc, &sTableData, &pDataTable)); stFreeTable(sTableData); return iRet; } A3DStatus stCreateRelationship(A3DPDFDocument* pDoc, std::vector< std::pair > &aMapIndexes, A3DPDFDataTable* pDataTableSource, A3DPDFDataTable* pDataTableTarget) { A3DStatus iRet = A3D_SUCCESS; A3DUns32 iNbRows = (A3DUns32)aMapIndexes.size(); A3DPDFDataRelationshipData sRelationshipData; A3D_INITIALIZE_DATA(A3DPDFDataRelationshipData, sRelationshipData); sRelationshipData.m_iSizeMap = iNbRows; sRelationshipData.m_pDataTableSource = pDataTableSource; sRelationshipData.m_pDataTableTarget = pDataTableTarget; sRelationshipData.m_pMapIndexes = (A3DPDFMapIndexData *)malloc(iNbRows * sizeof(A3DPDFMapIndexData)); memset(sRelationshipData.m_pMapIndexes, 0, iNbRows * sizeof(A3DPDFMapIndexData)); for (A3DUns32 ir = 0; ir < iNbRows; ir++) { sRelationshipData.m_pMapIndexes[ir].m_aiIndexes[0] = (A3DInt32)(aMapIndexes[ir].first); sRelationshipData.m_pMapIndexes[ir].m_aiIndexes[1] = (A3DInt32)(aMapIndexes[ir].second); } CHECK_RET(A3DPDFDataRelationshipCreate(pDoc, &sRelationshipData)); stFreeRelationship(sRelationshipData); return iRet; } A3DStatus CreateTable_3DViews_Simple(A3DPDFDocument* pDoc, A3DPDF3DArtwork* p3DArtwork, A3DAsmModelFile* pModelFile, A3DPDFDataTable3DViews*& pDataTable) { A3DStatus iRet = A3D_SUCCESS; A3DUns32 uiNbViews = 0; A3DPDFView** ppViews = NULL; pDataTable = NULL; // first get views from the 3D model: do we really need a carousel iRet = A3DPDF3DArtworkGetViews(p3DArtwork, &uiNbViews, &ppViews); // the last view is the automatic view, automatically created by HOOPS Publish to be the default view. // we consider in this sample that this view is not in the CAD tool, so we don't want it in the carousel if(uiNbViews > 0) uiNbViews--; // if no views after that, no use to write a carousel ! if (uiNbViews == 0) return A3D_ERROR; // HARD CODED : just keep the 2 last ones uiNbViews = 2; int iFirstView=2; A3DInt32 *piViewIndexes = (A3DInt32 *)malloc(uiNbViews*sizeof(A3DInt32)); A3DUTF8Char* *ppcViewLabels = (A3DUTF8Char* *)malloc(uiNbViews*sizeof(A3DUTF8Char*)); A3DPDFImage* *ppImages = (A3DPDFImage* *)malloc(uiNbViews*sizeof(A3DPDFImage*)); for (unsigned int ir = iFirstView; ir < iFirstView+uiNbViews; ir++) { piViewIndexes[ir-iFirstView] = ir;// index in list view, ordered as in A3DPDF3DArtworkGetViews //optional: labels for carousel buttons. if null, view name are used. ppcViewLabels[ir-iFirstView] = NULL; ppImages[ir-iFirstView] = NULL; // icon for view. if kA3DPDFTableFor3DViewsComputePosters, the image is automatically generated if needed for carousel. } A3DPDFTable3DViewsData sTable3DViewsData; A3D_INITIALIZE_DATA(A3DPDFTable3DViewsData, sTable3DViewsData); sTable3DViewsData.m_iNbViews = uiNbViews; sTable3DViewsData.m_piViewIndexes = piViewIndexes; sTable3DViewsData.m_ppcViewLabels = ppcViewLabels; sTable3DViewsData.m_ppImages = ppImages; // not useful if kA3DPDFTableFor3DViewsComputePosters is specified CHECK_RET(A3DPDFDataTable3DViewsCreate(pDoc, p3DArtwork,pModelFile, kA3DPDFTableFor3DViewsCustom , // kA3DPDFTableFor3DViewsComputePosters to automatically compute posters for all views specified &sTable3DViewsData, &pDataTable)); // clean stFreeTable3DViews(sTable3DViewsData); iRet = A3DPDF3DArtworkGetViews(NULL, NULL, &ppViews); return iRet; } A3DStatus CreateTable_ViewNames(A3DPDFDocument* pDoc, A3DPDFDataTable*& pDataTable) { // structure for Tables definitions std::vector > aRows; std::vector aOneRow; aRows.clear(); aOneRow.clear(); aOneRow.push_back("Face View"); aRows.push_back(aOneRow); aOneRow.clear(); aOneRow.push_back("Bracket View"); aRows.push_back(aOneRow); return stCreateTable(pDoc, aRows, pDataTable); } A3DStatus CreateRelationship_ViewNames_To_Views(A3DPDFDocument* pDoc, A3DPDFDataTable* pDataTable_Source, A3DPDFDataTable* pDataTable_Target) { // structure for Relationships definitions std::vector< std::pair > aMapIndexes; aMapIndexes.push_back( std::make_pair (0, 0) ); aMapIndexes.push_back( std::make_pair (1, 1) ); return stCreateRelationship(pDoc, aMapIndexes, pDataTable_Source, pDataTable_Target); } //int stAddPmiItem(std::vector > &aTablePmiRows, const std::string& sItem) int stPushItemsAndRship_3d_PmiNotes( std::vector > &aTable3DRows, const A3DPDFNodeData* const nodeInfos, int& iKeyNode3dUID, std::vector > &aTablePmiRows, const std::string& sItem, std::vector< std::pair > &aMapIndexes_3dToPmiNotes, std::vector< std::pair > &aMapIndexes_PmiNotesTo3d) { std::vector aOneRow3d; aOneRow3d.push_back(nodeInfos->m_pcNodeUid); iKeyNode3dUID = (int)aOneRow3d.size()-1; aOneRow3d.push_back(nodeInfos->m_pcName); aTable3DRows.push_back(aOneRow3d); std::vector aOneRowPmi; aOneRowPmi.push_back(sItem); aTablePmiRows.push_back(aOneRowPmi); // create relationship between 3d node and pminotes entry size_t idxinpminotes = aTablePmiRows.size()-1; size_t idxin3dnodes = aTable3DRows.size()-1; aMapIndexes_3dToPmiNotes.push_back( std::make_pair (idxin3dnodes, idxinpminotes) ); aMapIndexes_PmiNotesTo3d.push_back( std::make_pair (idxinpminotes, idxin3dnodes) ); return 0; } int stPushItemsAndRship_PmiDetails( std::vector > &aTablePmiRows, std::vector > &aTablePMIDetailsRows, const std::string& sItem, std::vector< std::pair > &aMapIndexes_PmiNotesToPmiDetails) { std::vector aOneRowPmiDetail; aOneRowPmiDetail.clear(); aOneRowPmiDetail.push_back(sItem); //... aTablePMIDetailsRows.push_back(aOneRowPmiDetail); aMapIndexes_PmiNotesToPmiDetails.push_back( std::make_pair (aTablePmiRows.size()-1, aTablePMIDetailsRows.size()-1) ); return 0; } A3DStatus CreateTable_3DModel(A3DPDFDocument* pDoc, A3DAsmModelFile* pModelFile, A3DRWParamsPrcWriteHelper* pA3DRWParamsPrcWriteHelper, int& iKeyNode3dUID, A3DPDFDataTable*& pDataTable3D, A3DPDFDataTable*& pDataTable_PmiNotes, A3DPDFDataTable*& pDataTable_PMIDetailsSlot, A3DPDFDataTable*& pDataTable_PMIDetailsHole, A3DPDFDataTable*& pDataTable_PMIDetailsFlat ) { A3DStatus iRet = A3D_SUCCESS; // structure for Tables definitions std::vector > aTable3DRows; std::vector > aTablePmiRows; std::vector > aTablePMIDetailsSlotRows; std::vector > aTablePMIDetailsHoleRows; std::vector > aTablePMIDetailsFlatRows; // structure for Relationships definitions std::vector< std::pair > aMapIndexes_3dToPmiNotes; std::vector< std::pair > aMapIndexes_PmiNotesTo3d; std::vector< std::pair > aMapIndexes_PmiNotesToPmiDetailsSlot; std::vector< std::pair > aMapIndexes_PmiNotesToPmiDetailsHole; std::vector< std::pair > aMapIndexes_PmiNotesToPmiDetailsFlat; // parse the 3D PDF nodes A3DPDFModelFileNodesData* pModelFileNodesInfo = NULL; CHECK_RET(A3DPDFGetModelFileNodes(pModelFile, pA3DRWParamsPrcWriteHelper, &pModelFileNodesInfo)); for (int inodein3d = 0; inodein3d < pModelFileNodesInfo->m_iNbNodes; inodein3d++) { A3DPDFNodeData* nodeInfos = pModelFileNodesInfo->m_ppNodes[inodein3d]; // we write 3D table only for PMI nodes that we wxant to highlight if (nodeInfos->m_eNodeType==kA3DPDFNodePMI) { if (strcmp(nodeInfos->m_pcName, "Text.1")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Slot 2", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsSlotRows, "0.05197", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsSlot); } else if (strcmp(nodeInfos->m_pcName, "Text.2")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 1", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.10845", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.3")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 2", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.00894", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.4")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 3", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.11540", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.5")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 4", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.20458", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.6")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Slot 1", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsSlotRows, "0.00951", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsSlot); } else if (strcmp(nodeInfos->m_pcName, "Text.7")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 5", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.20481", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.8")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 6", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.20841", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.9")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 7", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.30450", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.10")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 8", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.00815", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.11")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 9", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.120540", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.12")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 10", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.0651", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.13")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 11", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.0842", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.14")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 12", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.20674", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.15")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 13", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.30541", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.16")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 15", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.00410", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.17")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Hole 14", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsHoleRows, "0.8405", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsHole); } else if (strcmp(nodeInfos->m_pcName, "Text.18")==0) { stPushItemsAndRship_3d_PmiNotes(aTable3DRows, nodeInfos, iKeyNode3dUID, aTablePmiRows, "Flatness", aMapIndexes_3dToPmiNotes, aMapIndexes_PmiNotesTo3d); stPushItemsAndRship_PmiDetails(aTablePmiRows, aTablePMIDetailsFlatRows, "0.9040", // + add other rows or columns if needed aMapIndexes_PmiNotesToPmiDetailsFlat); } } } iRet = stCreateTable(pDoc, aTable3DRows, pDataTable3D); iRet = stCreateTable(pDoc, aTablePmiRows, pDataTable_PmiNotes); iRet = stCreateTable(pDoc, aTablePMIDetailsSlotRows, pDataTable_PMIDetailsSlot); iRet = stCreateTable(pDoc, aTablePMIDetailsHoleRows, pDataTable_PMIDetailsHole); iRet = stCreateTable(pDoc, aTablePMIDetailsFlatRows, pDataTable_PMIDetailsFlat); iRet = stCreateRelationship(pDoc, aMapIndexes_PmiNotesToPmiDetailsSlot, pDataTable_PmiNotes, pDataTable_PMIDetailsSlot); iRet = stCreateRelationship(pDoc, aMapIndexes_PmiNotesToPmiDetailsHole, pDataTable_PmiNotes, pDataTable_PMIDetailsHole); iRet = stCreateRelationship(pDoc, aMapIndexes_PmiNotesToPmiDetailsFlat, pDataTable_PmiNotes, pDataTable_PMIDetailsFlat); iRet = stCreateRelationship(pDoc, aMapIndexes_PmiNotesTo3d, pDataTable_PmiNotes, pDataTable3D); iRet = stCreateRelationship(pDoc, aMapIndexes_3dToPmiNotes, pDataTable3D, pDataTable_PmiNotes); A3DPDFGetModelFileNodes(nullptr, nullptr, &pModelFileNodesInfo); return iRet; } A3DStatus CreateRelationship_ViewNames_To_Pmis(A3DPDFDocument* pDoc, A3DPDFDataTable* pDataTable_Source, A3DPDFDataTable* pDataTable_Target) { // structure for Relationships definitions std::vector< std::pair > aMapIndexes; aMapIndexes.push_back( std::make_pair (0, 0) ); aMapIndexes.push_back( std::make_pair (0, 1) ); aMapIndexes.push_back( std::make_pair (0, 2) ); aMapIndexes.push_back( std::make_pair (0, 3) ); aMapIndexes.push_back( std::make_pair (0, 4) ); aMapIndexes.push_back( std::make_pair (0, 5) ); aMapIndexes.push_back( std::make_pair (0, 6) ); aMapIndexes.push_back( std::make_pair (0, 7) ); aMapIndexes.push_back( std::make_pair (0, 8) ); aMapIndexes.push_back( std::make_pair (0, 9) ); aMapIndexes.push_back( std::make_pair (0, 10) ); aMapIndexes.push_back( std::make_pair (0, 11) ); aMapIndexes.push_back( std::make_pair (1, 12) ); aMapIndexes.push_back( std::make_pair (1, 13) ); aMapIndexes.push_back( std::make_pair (1, 14) ); aMapIndexes.push_back( std::make_pair (1, 15) ); aMapIndexes.push_back( std::make_pair (1, 16) ); aMapIndexes.push_back( std::make_pair (1, 17) ); return stCreateRelationship(pDoc, aMapIndexes, pDataTable_Source, pDataTable_Target); }