Add publish

This commit is contained in:
ninja
2025-12-15 22:10:55 +08:00
parent 2b56cf87a8
commit c06fe95a1e
285 changed files with 69398 additions and 1 deletions

View 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();
}