Add publish
This commit is contained in:
483
publish/publishsource/DemoLayers/DemoLayers.cpp
Normal file
483
publish/publishsource/DemoLayers/DemoLayers.cpp
Normal file
@@ -0,0 +1,483 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* 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
|
||||
|
||||
Demonstrates how to create a PDF document with layers automatically handled by datamodel.
|
||||
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#define INITIALIZE_A3D_API
|
||||
#define HOOPS_PRODUCT_PUBLISH_ADVANCED
|
||||
#include <A3DSDKIncludes.h>
|
||||
#include "../common.hpp"
|
||||
#include "../CommonInit.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
// default sample arguments:
|
||||
// in visual c++: the current directory is set through properties to $OutDir, which is $(Platform)\$(Configuration)
|
||||
// in linux: the current directory is supposed to be the same as this cpp file
|
||||
#ifdef _MSC_VER
|
||||
# define IN_3DFILE SAMPLES_DATA_DIRECTORY"\\prc\\viewswithpmis.prc"
|
||||
# define POSTER_PATH SAMPLES_DATA_DIRECTORY"\\images\\pleaseactivate.bmp"
|
||||
# define IMGLAYERSLOT_PATH SAMPLES_DATA_DIRECTORY"\\images\\demolayer_slot.JPG"
|
||||
# define IMGLAYERHOLE_PATH SAMPLES_DATA_DIRECTORY"\\images\\demolayer_hole.JPG"
|
||||
# define IMGLAYERFLAT_PATH SAMPLES_DATA_DIRECTORY"\\images\\demolayer_flatness.JPG"
|
||||
# define OUT_FILE SAMPLES_PUBLISH_GALLERY_DIRECTORY"\\sample_DemoLayers.pdf"
|
||||
#else
|
||||
# define IN_3DFILE SAMPLES_DATA_DIRECTORY"/prc/viewswithpmis.prc"
|
||||
# define POSTER_PATH SAMPLES_DATA_DIRECTORY"/images/pleaseactivate.bmp"
|
||||
# define IMGLAYERSLOT_PATH SAMPLES_DATA_DIRECTORY"/images/demolayer_slot.JPG"
|
||||
# define IMGLAYERHOLE_PATH SAMPLES_DATA_DIRECTORY"/images/demolayer_hole.JPG"
|
||||
# define IMGLAYERFLAT_PATH SAMPLES_DATA_DIRECTORY"/images/demolayer_flatness.JPG"
|
||||
# define OUT_FILE SAMPLES_PUBLISH_GALLERY_DIRECTORY"/sample_DemoLayers.pdf"
|
||||
#endif
|
||||
|
||||
const size_t MAXSZFILENAME = 4096;
|
||||
|
||||
// rgb colors
|
||||
#define COL_RED 1.0, 0.0, 0.0
|
||||
|
||||
|
||||
|
||||
// tools functions
|
||||
A3DVoid mallocAndSetString(const A3DUTF8Char* srcString, A3DUTF8Char*& destString);
|
||||
|
||||
|
||||
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 CreateTable_3DViews_Simple(A3DPDFDocument* pDoc, A3DPDF3DArtwork* p3DArtwork, A3DAsmModelFile* pModelFile,A3DPDFDataTable3DViews*& pDataTable);
|
||||
A3DStatus CreateTable_ViewNames(A3DPDFDocument* pDoc, A3DPDFDataTable*& pDataTable);
|
||||
A3DStatus CreateRelationship_ViewNames_To_Views(A3DPDFDocument* pDoc, A3DPDFDataTable* pDataTable_Source, A3DPDFDataTable* pDataTable_Target);
|
||||
A3DStatus CreateRelationship_ViewNames_To_Pmis(A3DPDFDocument* pDoc, A3DPDFDataTable* pDataTable_Source, A3DPDFDataTable* pDataTable_Target);
|
||||
|
||||
|
||||
|
||||
|
||||
A3DStatus BuildPDFDocument()
|
||||
{
|
||||
A3DStatus iRet = A3D_SUCCESS;
|
||||
|
||||
// create empty document
|
||||
A3DPDFDocument* pDoc = NULL;
|
||||
CHECK_RET(A3DPDFDocumentCreateEmpty(&pDoc));
|
||||
|
||||
if(pDoc != NULL)
|
||||
{
|
||||
// creating a document page from scratch
|
||||
A3DPDFPageData2 sPageData;
|
||||
A3D_INITIALIZE_DATA(A3DPDFPageData2, sPageData);
|
||||
|
||||
sPageData.m_ePageOrientation = kA3DPDFPageLandscape;
|
||||
sPageData.m_ePageSize = kA3DPDFPageLetter; // standard letter format: 612 x 792
|
||||
const int iPageWidth = 792, iPageHeight = 612;
|
||||
A3DPDFPage* pPage = NULL;
|
||||
CHECK_RET(A3DPDFDocumentAppendNewPage2(pDoc, &sPageData, &pPage));
|
||||
|
||||
if(pPage != NULL)
|
||||
{
|
||||
// reading the input file; the file can be disposed of afterwards.
|
||||
A3DPDF3DStream* pStream;
|
||||
A3DAsmModelFile* pModelFile;
|
||||
A3DRWParamsLoadData sReadParam;
|
||||
A3D_INITIALIZE_DATA(A3DRWParamsLoadData, sReadParam);
|
||||
|
||||
sReadParam.m_sGeneral.m_bReadSolids = true;
|
||||
sReadParam.m_sGeneral.m_bReadSurfaces = true;
|
||||
sReadParam.m_sGeneral.m_bReadWireframes = true;
|
||||
sReadParam.m_sGeneral.m_bReadPmis = true;
|
||||
sReadParam.m_sGeneral.m_bReadAttributes = true;
|
||||
sReadParam.m_sGeneral.m_bReadHiddenObjects = false;
|
||||
sReadParam.m_sGeneral.m_bReadConstructionAndReferences = false;
|
||||
sReadParam.m_sGeneral.m_bReadActiveFilter = true;
|
||||
sReadParam.m_sGeneral.m_eReadingMode2D3D = kA3DRead_3D;
|
||||
sReadParam.m_sGeneral.m_eReadGeomTessMode = kA3DReadGeomAndTess;
|
||||
sReadParam.m_sGeneral.m_eDefaultUnit = kA3DUnitUnknown;
|
||||
sReadParam.m_sPmi.m_bAlwaysSubstituteFont = false;
|
||||
sReadParam.m_sPmi.m_pcSubstitutionFont = const_cast<A3DUTF8Char*>("Myriad CAD");
|
||||
sReadParam.m_sTessellation.m_eTessellationLevelOfDetail = kA3DTessLODMedium;
|
||||
sReadParam.m_sMultiEntries.m_bLoadDefault = true;
|
||||
sReadParam.m_sAssembly.m_bUseRootDirectory = true;
|
||||
iRet = A3DAsmModelFileLoadFromFile(IN_3DFILE, &sReadParam, &pModelFile);
|
||||
if(iRet != A3D_SUCCESS && iRet != A3D_LOAD_MISSING_COMPONENTS)
|
||||
{
|
||||
std::cout << "Error number=" << iRet << std::endl;
|
||||
return iRet;
|
||||
}
|
||||
|
||||
if(pModelFile)
|
||||
{
|
||||
// creating the PRC stream from the model file that is going to be inserted into the PDF file
|
||||
A3DRWParamsExportPrcData sParamsExportData;
|
||||
A3D_INITIALIZE_DATA(A3DRWParamsExportPrcData, sParamsExportData);
|
||||
|
||||
// To get unique IDs, we need a A3DRWParamsPrcWriteHelper.
|
||||
// A3DPDF3DStreamCreateFromModelFileAsPRC builds this object.
|
||||
A3DRWParamsPrcWriteHelper* pA3DRWParamsPrcWriteHelper = NULL;
|
||||
CHECK_RET(A3DPDF3DStreamCreateFromModelFileAsPRC(pDoc, pModelFile, &sParamsExportData, &pStream, &pA3DRWParamsPrcWriteHelper));
|
||||
|
||||
// creating a poster image to be used as a poster for 3D.
|
||||
A3DPDFImage* pBlankImage = NULL;
|
||||
A3DPDFImageCreateFromFile(pDoc, POSTER_PATH, kA3DPDFImageFormatUnknown, &pBlankImage);
|
||||
|
||||
|
||||
// creating the 3D artwork
|
||||
A3DPDF3DArtwork* p3DArtwork;
|
||||
A3DPDF3DArtworkData2 s3DArtworkData;
|
||||
A3D_INITIALIZE_DATA(A3DPDF3DArtworkData2, s3DArtworkData);
|
||||
|
||||
s3DArtworkData.m_pStream = pStream;
|
||||
s3DArtworkData.m_bActivatePMICrossHighlight = true;
|
||||
s3DArtworkData.m_bAddPMISemanticInformation = true;
|
||||
s3DArtworkData.m_sDisplaySectionData.m_bAddSectionCaps = true;
|
||||
CHECK_RET(A3DPDF3DArtworkCreate2(pDoc, &s3DArtworkData, &p3DArtwork));
|
||||
|
||||
A3DPDF3DAnnotData sAnnotData;
|
||||
A3D_INITIALIZE_DATA(A3DPDF3DAnnotData, sAnnotData);
|
||||
|
||||
sAnnotData.m_bOpenModelTree = false;
|
||||
sAnnotData.m_bShowToolbar = false;
|
||||
sAnnotData.m_eLighting = kA3DPDFLightHeadlamp;
|
||||
sAnnotData.m_eRenderingStyle = kA3DPDFRenderingSolid;
|
||||
sAnnotData.m_sBackgroundColor.m_dRed = 1.0;
|
||||
sAnnotData.m_sBackgroundColor.m_dGreen = 1.0;
|
||||
sAnnotData.m_sBackgroundColor.m_dBlue = 1.0;
|
||||
sAnnotData.m_bTransparentBackground = false;
|
||||
sAnnotData.m_eActivateWhen = kA3DPDFActivPageOpened;
|
||||
sAnnotData.m_eDesactivateWhen = kA3DPDFActivPageClosed;
|
||||
sAnnotData.m_iAppearanceBorderWidth = 0;
|
||||
sAnnotData.m_pPosterImage = pBlankImage;
|
||||
sAnnotData.m_p3DArtwork = p3DArtwork;
|
||||
A3DPDF3DAnnot* p3DAnnot = NULL;
|
||||
|
||||
CHECK_RET(A3DPDF3DAnnotCreate(pDoc, &sAnnotData, &p3DAnnot));
|
||||
|
||||
const int iPos3DLeft = 16;
|
||||
const int iPos3DTop = iPageHeight - 16;
|
||||
const int iPos3DRight = 604;
|
||||
const int iPos3DBottom = iPageHeight - 400;
|
||||
|
||||
// position the 3D annotation in the page
|
||||
// coordinates are from bottom left of the page
|
||||
A3DPDFRectData sPos;
|
||||
A3D_INITIALIZE_DATA(A3DPDFRectData, sPos);
|
||||
sPos.m_iLeft = iPos3DLeft; // lower left x
|
||||
sPos.m_iBottom = iPos3DBottom; // lower left y
|
||||
sPos.m_iRight = iPos3DRight ; // upper right x
|
||||
sPos.m_iTop = iPos3DTop ; // upper right y
|
||||
CHECK_RET(A3DPDFPageInsert3DAnnot(pPage, p3DAnnot, &sPos));
|
||||
|
||||
|
||||
// --- WIDGETS definitions
|
||||
|
||||
|
||||
// WIDGET LISTBOX VIEWS
|
||||
|
||||
A3DPDFListBoxData sListData;
|
||||
A3D_INITIALIZE_DATA(A3DPDFListBoxData, sListData);
|
||||
sListData.m_pcName = "ListViews";
|
||||
sListData.m_bHasBorder = TRUE;
|
||||
A3DPDFListBox* pListBoxViews = NULL;
|
||||
|
||||
CHECK_RET(A3DPDFListBoxCreate(pDoc, &sListData, &pListBoxViews));
|
||||
|
||||
const int iPosListViewsLeft = iPos3DRight + 16;
|
||||
const int iPosListViewsTop = iPageHeight - 16;
|
||||
const int iPosListViewsRight = iPageWidth - 16;
|
||||
const int iPosListViewsBottom = iPageHeight - 56;
|
||||
|
||||
// position the 3D annotation in the page
|
||||
// coordinates are from bottom left of the page
|
||||
sPos.m_iLeft = iPosListViewsLeft; // lower left x
|
||||
sPos.m_iBottom = iPosListViewsBottom; // lower left y
|
||||
sPos.m_iRight = iPosListViewsRight ; // upper right x
|
||||
sPos.m_iTop = iPosListViewsTop ; // upper right y
|
||||
CHECK_RET(A3DPDFPageInsertListBox(pPage, pListBoxViews, &sPos));
|
||||
|
||||
// WIDGET LISTBOX PMIS
|
||||
|
||||
A3DPDFListBoxData sListData2;
|
||||
A3D_INITIALIZE_DATA(A3DPDFListBoxData, sListData2);
|
||||
sListData2.m_pcName = "ListPmis";
|
||||
sListData2.m_bHasBorder = TRUE;
|
||||
A3DPDFListBox* pListBoxPMIs = NULL;
|
||||
|
||||
CHECK_RET(A3DPDFListBoxCreate(pDoc, &sListData2, &pListBoxPMIs));
|
||||
|
||||
const int iPosListPmisLeft = iPosListViewsLeft;
|
||||
const int iPosListPmisTop = iPosListViewsBottom -16 ;
|
||||
const int iPosListPmisRight = iPosListViewsRight;
|
||||
const int iPosListPmisBottom = iPos3DBottom;
|
||||
|
||||
// position the 3D annotation in the page
|
||||
// coordinates are from bottom left of the page
|
||||
sPos.m_iLeft = iPosListPmisLeft; // lower left x
|
||||
sPos.m_iBottom = iPosListPmisBottom; // lower left y
|
||||
sPos.m_iRight = iPosListPmisRight ; // upper right x
|
||||
sPos.m_iTop = iPosListPmisTop ; // upper right y
|
||||
CHECK_RET(A3DPDFPageInsertListBox(pPage, pListBoxPMIs, &sPos));
|
||||
|
||||
|
||||
// WIDGET LIST 3D NODES
|
||||
A3DPDF3DNodeScene* p3DNodeScene = NULL;
|
||||
CHECK_RET(A3DPDF3DAnnotGet3DNodeScene( p3DAnnot, &p3DNodeScene));
|
||||
|
||||
|
||||
// WIDGET LIST 3D VIEWS
|
||||
A3DPDF3DViewList* p3DViewList = NULL;
|
||||
CHECK_RET(A3DPDF3DAnnotGet3DViewList( p3DAnnot, &p3DViewList));
|
||||
|
||||
|
||||
// WIDGET TEXT FIELDS PMIS + LAYERS
|
||||
|
||||
|
||||
// Create Layers
|
||||
int iNbLayers = 3;
|
||||
A3DPDFLayer** apLayerGroup = (A3DPDFLayer**) malloc(iNbLayers * A3DUns32(sizeof(A3DPDFLayer*)));
|
||||
|
||||
A3DPDFLayer* pLayerPMISlot = NULL;
|
||||
A3DPDFLayerData sLayerData;
|
||||
A3D_INITIALIZE_DATA(A3DPDFLayerData, sLayerData);
|
||||
sLayerData.m_pcName = "LayerSlot";
|
||||
sLayerData.m_bIsVisible = FALSE;
|
||||
CHECK_RET(A3DPDFLayerCreate(pDoc, &sLayerData, &pLayerPMISlot));
|
||||
apLayerGroup[0] = pLayerPMISlot;
|
||||
|
||||
A3DPDFLayer* pLayerPMIFlat = NULL;
|
||||
A3D_INITIALIZE_DATA(A3DPDFLayerData, sLayerData);
|
||||
sLayerData.m_pcName = "LayerFlat";
|
||||
sLayerData.m_bIsVisible = FALSE;
|
||||
CHECK_RET(A3DPDFLayerCreate(pDoc, &sLayerData, &pLayerPMIFlat));
|
||||
apLayerGroup[1] = pLayerPMIFlat;
|
||||
|
||||
A3DPDFLayer* pLayerPMIHole = NULL;
|
||||
A3D_INITIALIZE_DATA(A3DPDFLayerData, sLayerData);
|
||||
sLayerData.m_pcName = "LayerHole";
|
||||
sLayerData.m_bIsVisible = FALSE;
|
||||
CHECK_RET(A3DPDFLayerCreate(pDoc, &sLayerData, &pLayerPMIHole));
|
||||
apLayerGroup[2] = pLayerPMIHole;
|
||||
|
||||
CHECK_RET(A3DPDFDocumentSetLayersRBGroup(pDoc, iNbLayers, apLayerGroup));
|
||||
|
||||
free(apLayerGroup);
|
||||
|
||||
// assign static data to layers
|
||||
|
||||
// background image for layers
|
||||
// create image objects
|
||||
A3DPDFImage* pImageBkLayerSlot = NULL;
|
||||
A3DPDFImage* pImageBkLayerFlat = NULL;
|
||||
A3DPDFImage* pImageBkLayerHole = NULL;
|
||||
CHECK_RET(A3DPDFImageCreateFromFile(pDoc, IMGLAYERSLOT_PATH, kA3DPDFImageFormatUnknown, &pImageBkLayerSlot));
|
||||
CHECK_RET(A3DPDFImageCreateFromFile(pDoc, IMGLAYERFLAT_PATH, kA3DPDFImageFormatUnknown, &pImageBkLayerFlat));
|
||||
CHECK_RET(A3DPDFImageCreateFromFile(pDoc, IMGLAYERHOLE_PATH, kA3DPDFImageFormatUnknown, &pImageBkLayerHole));
|
||||
// position images on the page
|
||||
const int iMargin = 16;
|
||||
A3DPDFRectData sPosImg;
|
||||
A3D_INITIALIZE_DATA(A3DPDFRectData, sPosImg);
|
||||
sPosImg.m_iLeft = iMargin; // lower left x
|
||||
sPosImg.m_iRight = iPageWidth - iMargin; // upper right x
|
||||
sPosImg.m_iTop = iPos3DBottom - iMargin; // upper right y
|
||||
sPosImg.m_iBottom = iMargin; // lower left y
|
||||
|
||||
CHECK_RET(A3DPDFPageInsertImage2(pPage, pImageBkLayerSlot, &sPosImg));
|
||||
CHECK_RET(A3DPDFPageInsertImage2(pPage, pImageBkLayerFlat, &sPosImg));
|
||||
CHECK_RET(A3DPDFPageInsertImage2(pPage, pImageBkLayerHole, &sPosImg));
|
||||
// then assign the images to their specific layer
|
||||
CHECK_RET(A3DPDFImageSetLayer(pImageBkLayerSlot, pLayerPMISlot));
|
||||
CHECK_RET(A3DPDFImageSetLayer(pImageBkLayerFlat, pLayerPMIFlat));
|
||||
CHECK_RET(A3DPDFImageSetLayer(pImageBkLayerHole, pLayerPMIHole));
|
||||
|
||||
|
||||
// Create widgets for pmis contents -> Layers
|
||||
|
||||
std::string sTextFieldName;
|
||||
A3DPDFTextFieldData sTextFieldData;
|
||||
A3D_INITIALIZE_DATA(A3DPDFTextFieldData, sTextFieldData);
|
||||
sTextFieldData.m_pcFontName = const_cast<A3DUTF8Char*>("Helv");
|
||||
sTextFieldData.m_iFontSize = 10;
|
||||
sTextFieldData.m_sTextColor.m_dRed = 0; // black
|
||||
sTextFieldData.m_sTextColor.m_dGreen = 0;
|
||||
sTextFieldData.m_sTextColor.m_dBlue = 0;
|
||||
sTextFieldData.m_eTextAlignment = kA3DPDFLeft;
|
||||
sTextFieldData.m_pcDefaultValue = "";
|
||||
A3DPDFRectData sPosTxt;
|
||||
A3D_INITIALIZE_DATA(A3DPDFRectData, sPosTxt);
|
||||
|
||||
sPosTxt.m_iLeft = 268; // lower left x
|
||||
sPosTxt.m_iRight = sPosTxt.m_iLeft + 50; // upper right x
|
||||
sPosTxt.m_iTop = 152; // upper right y
|
||||
sPosTxt.m_iBottom = sPosTxt.m_iTop - 15; // lower left y
|
||||
sTextFieldData.m_pcDefaultValue = "";
|
||||
sTextFieldData.m_pcName = "Slot.CenterX"; //sTextFieldName.c_str();
|
||||
A3DPDFTextField* pTextSlotCx = NULL;
|
||||
CHECK_RET(A3DPDFTextFieldCreate(pDoc, &sTextFieldData, &pTextSlotCx));
|
||||
CHECK_RET(A3DPDFPageInsertTextField(pPage, pTextSlotCx, &sPosTxt));
|
||||
CHECK_RET(A3DPDFFieldSetLayer(pTextSlotCx, pLayerPMISlot));
|
||||
// TODO: add more text fields for all PMI data
|
||||
|
||||
sPosTxt.m_iLeft = 269; // lower left x
|
||||
sPosTxt.m_iRight = sPosTxt.m_iLeft + 50; // upper right x
|
||||
sPosTxt.m_iTop = 129; // upper right y
|
||||
sPosTxt.m_iBottom = sPosTxt.m_iTop - 15; // lower left y
|
||||
sTextFieldData.m_pcDefaultValue = "";
|
||||
sTextFieldData.m_pcName = "Flat.CenterX"; //sTextFieldName.c_str();
|
||||
A3DPDFTextField* pTextFlatCx = NULL;
|
||||
CHECK_RET(A3DPDFTextFieldCreate(pDoc, &sTextFieldData, &pTextFlatCx));
|
||||
CHECK_RET(A3DPDFPageInsertTextField(pPage, pTextFlatCx, &sPosTxt));
|
||||
CHECK_RET(A3DPDFFieldSetLayer(pTextFlatCx, pLayerPMIFlat));
|
||||
// TODO: add more text fields for all PMI data
|
||||
|
||||
sPosTxt.m_iLeft = 265; // lower left x
|
||||
sPosTxt.m_iRight = sPosTxt.m_iLeft + 50; // upper right x
|
||||
sPosTxt.m_iTop = 143; // upper right y
|
||||
sPosTxt.m_iBottom = sPosTxt.m_iTop - 15; // lower left y
|
||||
sTextFieldData.m_pcDefaultValue = "";
|
||||
sTextFieldData.m_pcName = "Hole.CenterX"; //sTextFieldName.c_str();
|
||||
A3DPDFTextField* pTextHoleCx = NULL;
|
||||
CHECK_RET(A3DPDFTextFieldCreate(pDoc, &sTextFieldData, &pTextHoleCx));
|
||||
CHECK_RET(A3DPDFPageInsertTextField(pPage, pTextHoleCx, &sPosTxt));
|
||||
CHECK_RET(A3DPDFFieldSetLayer(pTextHoleCx, pLayerPMIHole));
|
||||
// TODO: add more text fields for all PMI data
|
||||
|
||||
|
||||
|
||||
// --- DATAMODEL definitions
|
||||
|
||||
|
||||
// TABLE 3D MODEL, PMINOTES + RELATIONSHIPs
|
||||
A3DPDFDataTable* pDataTable_3D = NULL;
|
||||
A3DPDFDataTable* pDataTable_PmiNotes = NULL;
|
||||
A3DPDFDataTable* pDataTable_PmiDetailsSlot = NULL;
|
||||
A3DPDFDataTable* pDataTable_PmiDetailsHole = NULL;
|
||||
A3DPDFDataTable* pDataTable_PmiDetailsFlat = NULL;
|
||||
int iKeyNode3dUID;
|
||||
CHECK_RET(CreateTable_3DModel(pDoc, pModelFile, pA3DRWParamsPrcWriteHelper,
|
||||
iKeyNode3dUID, pDataTable_3D, pDataTable_PmiNotes,
|
||||
pDataTable_PmiDetailsSlot, pDataTable_PmiDetailsHole, pDataTable_PmiDetailsFlat));
|
||||
|
||||
// TABLE 3DVIEWS, VIEW NAMES + RELATIONSHIPs to Views
|
||||
A3DPDFDataTable3DViews* pDataTable_3DViews = NULL;
|
||||
CHECK_RET(CreateTable_3DViews_Simple(pDoc, p3DArtwork, pModelFile, pDataTable_3DViews));
|
||||
A3DPDFDataTable* pDataTable_ViewNames = NULL;
|
||||
CHECK_RET(CreateTable_ViewNames(pDoc, pDataTable_ViewNames));
|
||||
CHECK_RET(CreateRelationship_ViewNames_To_Views(pDoc, pDataTable_ViewNames, pDataTable_3DViews));
|
||||
|
||||
// RELATIONSHIP ViewNames_To_Pmis
|
||||
CHECK_RET(CreateRelationship_ViewNames_To_Pmis(pDoc, pDataTable_ViewNames, pDataTable_PmiNotes));
|
||||
|
||||
|
||||
// --- BINDING AND WIDGETS INTERACTIVIES
|
||||
|
||||
|
||||
// --- widgets binding for Table 3D Views
|
||||
// UI of 3D annot list views
|
||||
CHECK_RET(A3DPDF3DViewListBindToTable(p3DViewList, pDataTable_3DViews));
|
||||
|
||||
// --- widgets binding for Table ViewNames
|
||||
CHECK_RET(A3DPDFListBoxBindToTable(pListBoxViews, pDataTable_ViewNames, 0));
|
||||
|
||||
// --- widgets binding for Table list pmis
|
||||
CHECK_RET(A3DPDFListBoxBindToTable(pListBoxPMIs, pDataTable_PmiNotes, 0));
|
||||
|
||||
// --- widgets binding for Table list pmis details
|
||||
CHECK_RET(A3DPDFTextFieldBindToTable(pTextSlotCx, pDataTable_PmiDetailsSlot, 0));
|
||||
CHECK_RET(A3DPDFTextFieldBindToTable(pTextFlatCx, pDataTable_PmiDetailsFlat, 0));
|
||||
CHECK_RET(A3DPDFTextFieldBindToTable(pTextHoleCx, pDataTable_PmiDetailsHole, 0));
|
||||
//TODO for all supplementary text fields
|
||||
|
||||
|
||||
// --- widgets binding for Table 3D
|
||||
CHECK_RET(A3DPDF3DNodeSceneBindToTable(p3DNodeScene, pDataTable_3D, iKeyNode3dUID));// 3D maps only 1 col : the one with uuid node names
|
||||
|
||||
// selection of a row in list views -> the associated elements of widget (=3d view) is selected
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pListBoxViews, p3DViewList, kA3DPDFDataSelect ));
|
||||
// selection of a row in list views -> the associated elements of widget (=pmis) is filtered
|
||||
// and first item is selected
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pListBoxViews, pListBoxPMIs, kA3DPDFDataIsolateAndSelect ));
|
||||
|
||||
// selection of a row in Pmis -> the associated elements of widget (=3d nodes) are selected
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pListBoxPMIs, p3DNodeScene, kA3DPDFDataSelect ));
|
||||
|
||||
// selection of a 3d node pmi -> the associated elements of Pmis list is selected
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( p3DNodeScene, pListBoxPMIs, kA3DPDFDataSelect ));
|
||||
|
||||
// selection of a row in Pmis -> the text fields in appropriate layer are filtered
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pListBoxPMIs, pTextSlotCx, kA3DPDFDataIsolate ));
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pListBoxPMIs, pTextFlatCx, kA3DPDFDataIsolate ));
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pListBoxPMIs, pTextHoleCx, kA3DPDFDataIsolate ));
|
||||
//TODO for all supplementary text fields
|
||||
|
||||
|
||||
// activate a specific view when the file is opened + all actions on cascading widgets
|
||||
// NULL should be specified on the widget source to select a row at init time
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour(NULL, pListBoxViews, kA3DPDFDataSelect));
|
||||
// This forces the selection on table at init time
|
||||
CHECK_RET(A3DPDFDataTableSetInitIndex(pDataTable_ViewNames, 1));
|
||||
|
||||
|
||||
|
||||
// cleaning up -- WARNING: DO NOT CALL THIS BEFORE A3DPDF3DArtworkCreate!
|
||||
CHECK_RET(A3DAsmModelFileDelete(pModelFile));
|
||||
// free the A3DRWParamsPrcWriteHelper object at the end
|
||||
if (pA3DRWParamsPrcWriteHelper != NULL)
|
||||
A3DRWParamsPrcWriteHelperFree(pA3DRWParamsPrcWriteHelper);
|
||||
|
||||
// saving the document
|
||||
CHECK_RET(A3DPDFDocumentSaveEx(pDoc, kA3DPDFSaveFull | kA3DPDFSaveOptimized, OUT_FILE));
|
||||
|
||||
CHECK_RET(A3DPDFDocumentClose(pDoc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
// Main function
|
||||
#ifdef _MSC_VER
|
||||
int wmain(A3DInt32, A3DUniChar**)
|
||||
#else
|
||||
int main(int, A3DUTF8Char**)
|
||||
#endif
|
||||
{
|
||||
#ifndef _MSC_VER
|
||||
setenv("LC_NUMERIC", "en_US.UTF-8", 1); // Locally force locale
|
||||
#endif
|
||||
|
||||
// init A3DLIB library - automatically handled init/terminate
|
||||
A3DSDKHOOPSPublishLoader sHoopsPublishLoader(_T(HOOPS_BINARY_DIRECTORY));
|
||||
CHECK_RET(sHoopsPublishLoader.m_eSDKStatus);
|
||||
|
||||
CHECK_RET(A3DDllSetCallbacksMemory(CheckMalloc, CheckFree));
|
||||
|
||||
// init HOOPS Publish related PDF library - automatically handled init/terminate
|
||||
// do it only only once during the life of the application
|
||||
CHECK_RET(sHoopsPublishLoader.InitPDFLib());
|
||||
|
||||
// launch PDF treatment
|
||||
A3DStatus iRet = BuildPDFDocument();
|
||||
if (iRet != A3D_SUCCESS)
|
||||
return iRet;
|
||||
|
||||
// Check memory allocations
|
||||
return (int)ListLeaks();
|
||||
}
|
||||
159
publish/publishsource/DemoLayers/DemoLayers.vcxproj
Normal file
159
publish/publishsource/DemoLayers/DemoLayers.vcxproj
Normal file
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.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>{25FD54F8-3AE3-4B07-B918-D1F3232D7C59}</ProjectGuid>
|
||||
<RootNamespace>DemoLayers</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>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v142</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>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<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>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalDependencies>legacy_stdio_float_rounding.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<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>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalDependencies>legacy_stdio_float_rounding.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DemoLayers.cpp" />
|
||||
<ClCompile Include="DemoLayersDataModel.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
25
publish/publishsource/DemoLayers/DemoLayers.vcxproj.filters
Normal file
25
publish/publishsource/DemoLayers/DemoLayers.vcxproj.filters
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</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="DemoLayers.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DemoLayersDataModel.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
524
publish/publishsource/DemoLayers/DemoLayersDataModel.cpp
Normal file
524
publish/publishsource/DemoLayers/DemoLayersDataModel.cpp
Normal file
@@ -0,0 +1,524 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* 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 <A3DSDKIncludes.h>
|
||||
#include "../common.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
|
||||
|
||||
|
||||
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<std::vector<std::string> > &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 <size_t, size_t> > &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<std::vector<std::string> > aRows;
|
||||
std::vector<std::string> 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 <size_t,size_t> > 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<std::vector<std::string> > &aTablePmiRows, const std::string& sItem)
|
||||
int stPushItemsAndRship_3d_PmiNotes(
|
||||
std::vector<std::vector<std::string> > &aTable3DRows, const A3DPDFNodeData* const nodeInfos, int& iKeyNode3dUID,
|
||||
std::vector<std::vector<std::string> > &aTablePmiRows, const std::string& sItem,
|
||||
std::vector< std::pair <size_t,size_t> > &aMapIndexes_3dToPmiNotes,
|
||||
std::vector< std::pair <size_t,size_t> > &aMapIndexes_PmiNotesTo3d)
|
||||
{
|
||||
std::vector<std::string> aOneRow3d;
|
||||
aOneRow3d.push_back(nodeInfos->m_pcNodeUid); iKeyNode3dUID = (int)aOneRow3d.size()-1;
|
||||
aOneRow3d.push_back(nodeInfos->m_pcName);
|
||||
aTable3DRows.push_back(aOneRow3d);
|
||||
|
||||
std::vector<std::string> 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<std::vector<std::string> > &aTablePmiRows,
|
||||
std::vector<std::vector<std::string> > &aTablePMIDetailsRows, const std::string& sItem,
|
||||
std::vector< std::pair <size_t,size_t> > &aMapIndexes_PmiNotesToPmiDetails)
|
||||
{
|
||||
std::vector<std::string> 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<std::vector<std::string> > aTable3DRows;
|
||||
std::vector<std::vector<std::string> > aTablePmiRows;
|
||||
std::vector<std::vector<std::string> > aTablePMIDetailsSlotRows;
|
||||
std::vector<std::vector<std::string> > aTablePMIDetailsHoleRows;
|
||||
std::vector<std::vector<std::string> > aTablePMIDetailsFlatRows;
|
||||
// structure for Relationships definitions
|
||||
std::vector< std::pair <size_t,size_t> > aMapIndexes_3dToPmiNotes;
|
||||
std::vector< std::pair <size_t,size_t> > aMapIndexes_PmiNotesTo3d;
|
||||
std::vector< std::pair <size_t,size_t> > aMapIndexes_PmiNotesToPmiDetailsSlot;
|
||||
std::vector< std::pair <size_t,size_t> > aMapIndexes_PmiNotesToPmiDetailsHole;
|
||||
std::vector< std::pair <size_t,size_t> > 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 <size_t,size_t> > 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user