EASY-ROB™ Application Programming Interface  v9.301
Static Public Member Functions | List of all members
ER_CAPI_USER_IO_3DPDF Class Reference

Method class for 3D Pdf Export. More...

#include <ER_CAPI.H>

Inheritance diagram for ER_CAPI_USER_IO_3DPDF:
ER_CAPI_USER_IO ER_CAPI

Static Public Member Functions

static ER_DllExport char * U3DPdf_ExportVer (void)
 3D Export Version More...
 
static ER_DllExport int U3DPdf_ExportAPI (int pdf_flag, char *s=NULL)
 Control 3D PDF and HTML Export
To open the created 3D Pdf file, Adobe Reader up to version XI is required.
To open the created 3D Html (WebGL) file, a suitable browser (Edge, Firefox, Chrome) is required.
see also U3DHtml_ExportAPI() method to define a Html Template file with user defined placeholder.
Parameter pdf_flag is one of
_3DPDF_EXPORT_GET_MODE, _3DPDF_EXPORT_ACTIVATE, _3DPDF_EXPORT_DEACTIVATE, _3DPDF_EXPORT_INIT, _3DPDF_EXPORT_START, _3DPDF_EXPORT_PAUSE, _3DPDF_EXPORT_STOP, _3DPDF_EXPORT_SAVE, _3DPDF_EXPORT_EXPORT, _3DPDF_EXPORT_SHOW, _3DPDF_EXPORT_RESTART, _3DPDF_EXPORT_GET_LIC_OPTIONS, _3DPDF_EXPORT_GET_LICENSE_TEXT, _3DPDF_EXPORT_SET_FILE, _3DPDF_EXPORT_SET_PASSWORD or _3DPDF_EXPORT_SET_LABEL _3DPDF_EXPORT_SET_KEYFRAMES_MAX _3DPDF_EXPORT_GET_KEYFRAMES _3DPDF_EXPORT_RESET_LAYOUT _3DPDF_EXPORT_LOAD_LAYOUT_FILE _3DPDF_EXPORT_SAVE_LAYOUT_FILE
Parameter s is an individual string, depending on pdf_flag
Explanations
Before using the 3D Export, make sure that the "EASY-ROB PlugIn Dialog 3D Export" is closed. This can be verified with _3DPDF_EXPORT_GET_MODE.
The return value is one of
_3DPDF_EXPORT_MODE_FREE - 3D Export currently not in use, does mean it is ready to for API usage
_3DPDF_EXPORT_MODE_ERROR - 3D Export currently on error
_3DPDF_EXPORT_MODE_DLG - PlugIn Dialog for 3D Export is open
_3DPDF_EXPORT_MODE_API - already in API usage

Step_I
If _3DPDF_EXPORT_GET_MODE returns _3DPDF_EXPORT_MODE_FREE, you can activate and initialize the 3D Export with _3DPDF_EXPORT_ACTIVATE and _3DPDF_EXPORT_INIT.
In the next step, define all necessary callback function, see
U3DPdf_ExportAPI_SetCallbackMsg() for feedback messages
U3DPdf_ExportAPI_SetCallbackSaveStatus() for status messages when saving the 3D file
U3DPdf_ExportAPI_SetCallbackProgress() for ExportU3DScene and Generate3DPdf progress messages when saving the 3D file
U3DPdf_ExportAPI_SetCallbackProgressExportU3DScene() for ExportU3DScene progress messages when saving the 3D file
U3DPdf_ExportAPI_SetCallbackProgressGenerate3DPdf() for Generate3DPdf progress messages when saving the 3D file

Step_II
The API for 3D Export is ready to use now.
To start the recording, use _3DPDF_EXPORT_START
Everytime EASY-ROB causes a grafical update, an additional key frame is recorded.
During recording you can set labels with _3DPDF_EXPORT_SET_LABEL
Use _3DPDF_EXPORT_PAUSE to pause and continue the recording.
Before you stop and save the recording you should define a file name for the created pdf or html (WebGL) file.
If you want to save the 3D capture as an HTML (WebGL) file, use the U3DHtml_ExportAPI() method to specify the html template file and define the custom placeholder.
Option: The password protecting the pdf file and allows it to open only for certain users.

Step_III
Finally use _3DPDF_EXPORT_SAVE or _3DPDF_EXPORT_STOP to create the 3D file and wait until _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE, see U3DPdf_ExportAPI_SetCallbackSaveStatus().
Use _3DPDF_EXPORT_DEACTIVATE to terminate the API usage. This sets the 3D Export back to _3DPDF_EXPORT_MODE_FREE and will free the complete used memory.
Remarks
Use _3DPDF_EXPORT_EXPORT directly after Step_I to save the 3D Scene without animation.
After Step_III you can immediately continue with Step_II , it is not necessary to activate the 3D Export API several times. More...
 
static ER_DllExport int U3DHtml_ExportAPI (int html_flag, char *sn=NULL, char *sv=NULL)
 Control 3D HTML Export
To open the created 3D Html file, a suitable browser (Edge, Firefox, Chrome) is required.
see also U3DPdf_ExportAPI() method
Parameter html_flag is one of
_3DHTML_EXPORT_CLEAR_PARAMETER_USR _3DHTML_EXPORT_SET_PARAMETER_USR _3DHTML_EXPORT_SET_PARAMETER_DEFAULT _3DHTML_EXPORT_SET_PARAMETER_TITLE _3DHTML_EXPORT_SET_PARAMETER_HEADER _3DHTML_EXPORT_SET_PARAMETER_IMAGELINK _3DHTML_EXPORT_LOAD_TEMPLATE_FILE
Parameter sn and sv are an individual strings, depending on html_flag
Explanations
Before using the 3D Export, make sure that the "EASY-ROB PlugIn Dialog 3D Export" is closed. This can be verified with _3DPDF_EXPORT_GET_MODE.
The return value is one of
_3DPDF_EXPORT_MODE_FREE - 3D Export currently not in use, does mean it is ready to for API usage
_3DPDF_EXPORT_MODE_ERROR - 3D Export currently on error
_3DPDF_EXPORT_MODE_DLG - PlugIn Dialog for 3D Export is open
_3DPDF_EXPORT_MODE_API - already in API usage
Step_I,Step_II,Step_III
see description of Step_I, II an III' in method U3DPdf_ExportAPI()
Remarks
Use html_flag _3DHTML_EXPORT_LOAD_TEMPLATE_FILE to set an existing template file name. If no Html template file is set, the predefined html template file '3D-WebGL-HTML-Template.html' is used.
This template file should be located in the current folder of your work cell, in the application folder or in the user folder, see ER_CAPI_SYS_STATUS::get_system_folder_file()
The Html template file can be customized using Cascading Style Sheets (CSS)
Example:
3D WebGL Export showing the 'AutoPath' - Collision-free path planning functionality for collision free path planning. '3D-WebGL-AutoPath.html' More...
 
static ER_DllExport int U3DPdf_ExportAPI_SetCallbackMsg (int callback_fct_id, void(*ptr_MsgFct)(char *))
 Defines a callback function for output messages during 3D PDF file Export
Parameter callback_fct_id is 1 or 2 for two different output streams. More...
 
static ER_DllExport int U3DPdf_ExportAPI_SetCallbackSaveStatus (void(*ptr_SaveStatusFct)(int))
 Defines a callback function for status messages when saving the 3D PDF file
Parameter save_status in Callback_API_SaveStatus(int save_status) is one of _3DPDF_EXPORT_SAVE_STATUS_UNDEF, _3DPDF_EXPORT_SAVE_STATUS_RECORD, _3DPDF_EXPORT_SAVE_STATUS_SAVE_BEGIN, _3DPDF_EXPORT_SAVE_STATUS_SAVE_BEGIN_THREAD, _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE, _3DPDF_EXPORT_SAVE_STATUS_SAVE_ABORT, _3DPDF_EXPORT_SAVE_STATUS_SAVE_ERROR or _3DPDF_EXPORT_SAVE_STATUS_KEYFRAMES_MAX
Remarks
save_status _3DPDF_EXPORT_SAVE_STATUS_RECORD confirmed that the recording is started
A pdf_flag _3DPDF_EXPORT_STOP, see U3DPdf_ExportAPI() causes _3DPDF_EXPORT_SAVE_STATUS_SAVE_BEGIN or _3DPDF_EXPORT_SAVE_STATUS_SAVE_BEGIN_THREAD to confirm that the 3D Pdf Export is started directly or running in a Thread.
If the 3D Pdf file was created successfully, it will be confirmed with _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE.
In other cases the save_status is _3DPDF_EXPORT_SAVE_STATUS_SAVE_ABORT or _3DPDF_EXPORT_SAVE_STATUS_SAVE_ERROR
Make sure that 3D Pdf file is not open in the Adobe Reader. More...
 
static ER_DllExport int U3DPdf_ExportAPI_SetCallbackProgress (void(*ptr_ProgressFct)(double))
 Defines one single callback function for ExportU3DScene progress and Generate3DPdf progress messages when saving the 3D PDF file
Parameter progress in Callback_API_Progress(double progress) is between 0 and 1 for 100%
Define U3DPdf_ExportAPI_SetCallbackSaveStatus() to receive _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE when saving the 3D PDF file is completed.
Remarks
To define one callback function for ExportU3DScene progress (Save Step A) and one for Generate3DPdf progress (Save Step B),
use U3DPdf_ExportAPI_SetCallbackProgressExportU3DScene() and U3DPdf_ExportAPI_SetCallbackProgressGenerate3DPdf() More...
 
static ER_DllExport int U3DPdf_ExportAPI_SetCallbackProgressExportU3DScene (void(*ptr_ProgressFctExportU3DScene)(double))
 Defines a callback function for ExportU3DScene progress messages when saving the 3D PDF file
Parameter progress in Callback_API_ProgressExportU3DScene(double progress) is between 0 and 1 for 100%
Define U3DPdf_ExportAPI_SetCallbackSaveStatus() to receive _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE when saving the 3D PDF file is completed.
Remarks
When saving the 3D PDF file, ExportU3DScene is Save Step A.
Save Step B generates the 3DPdf file, use U3DPdf_ExportAPI_SetCallbackProgressGenerate3DPdf()
Use U3DPdf_ExportAPI_SetCallbackProgress() to define one single callback function for both Save Steps. More...
 
static ER_DllExport int U3DPdf_ExportAPI_SetCallbackProgressGenerate3DPdf (void(*ptr_ProgressFctGenerate3DPdf)(double))
 Defines a callback function for Generate3DPdf progress messages when saving the 3D PDF file
Parameter progress in Callback_API_ProgressGenerate3DPdf(double progress) is between 0 and 1 for 100%
Define U3DPdf_ExportAPI_SetCallbackSaveStatus() to receive _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE when saving the 3D PDF file is completed.
Remarks
When saving the 3D PDF file, ExportU3DScene is Save Step A and Generate3DPdf is Save Step B.
For Save Step A use U3DPdf_ExportAPI_SetCallbackProgressExportU3DScene()
Use U3DPdf_ExportAPI_SetCallbackProgress() to define one single callback function for both Save Steps. More...
 

Additional Inherited Members

- Static Public Attributes inherited from ER_CAPI_USER_IO
static ER_CAPI_USER_IO_FILE er_capi_user_io_file
 Method class to load and save work cells-, robots-, tool-files, etc. More...
 
static ER_CAPI_USER_IO_DIALOG er_capi_user_io_dialog
 Method class, supplies dialogs, i.e. to enter and show values. More...
 
static ER_CAPI_USER_IO_PICK er_capi_user_io_pick
 Method class to "pick" objects such as devices, tags, polygon, vertices, measure distances, ... More...
 
static ER_CAPI_USER_IO_CRUISE er_capi_user_io_cruise
 Method class to manipulate the 3D Scene. More...
 
static ER_CAPI_USER_IO_3DPDF er_capi_user_io_3dpdf
 Method class for 3D Pdf Export. More...
 
- Static Public Attributes inherited from ER_CAPI
static ER_CAPI_USER_IO er_capi_user_io
 Method class for interaction with EASY-ROB. More...
 
static ER_CAPI_DEVICES er_capi_devices
 Method class to create, attach, update devices, for kinematics calculations and for trajectory planning and -execution. More...
 
static ER_CAPI_SIM er_capi_sim
 Method class for simulation settings. More...
 
static ER_CAPI_TARGETS er_capi_targets
 Method class for paths and tags. More...
 
static ER_CAPI_CAD er_capi_cad
 Method class for for 3D CAD Data import and -export, changing attributes and positions. More...
 
static ER_CAPI_SYS er_capi_sys
 Method class for mathematical calculations, simulation status, units. More...
 

Detailed Description

Method class for 3D Pdf Export.

Member Function Documentation

◆ U3DHtml_ExportAPI()

static ER_DllExport int ER_CAPI_USER_IO_3DPDF::U3DHtml_ExportAPI ( int  html_flag,
char *  sn = NULL,
char *  sv = NULL 
)
static

Control 3D HTML Export
To open the created 3D Html file, a suitable browser (Edge, Firefox, Chrome) is required.
see also U3DPdf_ExportAPI() method
Parameter html_flag is one of
_3DHTML_EXPORT_CLEAR_PARAMETER_USR _3DHTML_EXPORT_SET_PARAMETER_USR _3DHTML_EXPORT_SET_PARAMETER_DEFAULT _3DHTML_EXPORT_SET_PARAMETER_TITLE _3DHTML_EXPORT_SET_PARAMETER_HEADER _3DHTML_EXPORT_SET_PARAMETER_IMAGELINK _3DHTML_EXPORT_LOAD_TEMPLATE_FILE
Parameter sn and sv are an individual strings, depending on html_flag
Explanations
Before using the 3D Export, make sure that the "EASY-ROB PlugIn Dialog 3D Export" is closed. This can be verified with _3DPDF_EXPORT_GET_MODE.
The return value is one of
_3DPDF_EXPORT_MODE_FREE - 3D Export currently not in use, does mean it is ready to for API usage
_3DPDF_EXPORT_MODE_ERROR - 3D Export currently on error
_3DPDF_EXPORT_MODE_DLG - PlugIn Dialog for 3D Export is open
_3DPDF_EXPORT_MODE_API - already in API usage
Step_I,Step_II,Step_III
see description of Step_I, II an III' in method U3DPdf_ExportAPI()
Remarks
Use html_flag _3DHTML_EXPORT_LOAD_TEMPLATE_FILE to set an existing template file name. If no Html template file is set, the predefined html template file '3D-WebGL-HTML-Template.html' is used.
This template file should be located in the current folder of your work cell, in the application folder or in the user folder, see ER_CAPI_SYS_STATUS::get_system_folder_file()
The Html template file can be customized using Cascading Style Sheets (CSS)
Example:
3D WebGL Export showing the 'AutoPath' - Collision-free path planning functionality for collision free path planning. '3D-WebGL-AutoPath.html'

void _3dhtml_SetTemplate_and_Parameter()
//
{
//----------------------------------------
// 1. Set Html template
//----------------------------------------
char html_template_file[LS_MAXSTR];
sprintf(html_template_file, "%s", "my_WebGL_Template.html"); // contain two placeholder 'mytitle' and 'myheader'
if (ret)
return; // template file does not exist
//----------------------------------------
// 2. Set 'value' for two Placeholder names, for 'mytitle' and 'myheader'
//----------------------------------------
// clear all user defined Parameter first.
ret = er_user_io_3dpdf.U3DHtml_ExportAPI(_3DHTML_EXPORT_CLEAR_PARAMETER_USR); // Clear all HTML user defined Parameter
// 1st Placeholder: User defined placeholder in template file for example: <title>@@@mytitle@@@</title>
ret = er_user_io_3dpdf.U3DHtml_ExportAPI(_3DHTML_EXPORT_SET_PARAMETER_USR,"mytitle", "my WebGL"); // Add a HTML user defined Parameter
// 2nd Placeholder: User defined placeholder in template file for example: <title>@@@myheader@@@</title>
ret = er_user_io_3dpdf.U3DHtml_ExportAPI(_3DHTML_EXPORT_SET_PARAMETER_USR,"myheader", "This is my WebGL export"); // Add a HTML user defined Parameter
//----------------------------------------
// User predefined placeholder in standard html template '3D-WebGL-HTML-Template.html'
//----------------------------------------
// If the predefined html template file '3D-WebGL-HTML-Template.html' is used,
// the three predefined placeholder 'title', 'header'and 'image_link' can be used.
ret = er_user_io_3dpdf.U3DHtml_ExportAPI(_3DHTML_EXPORT_SET_PARAMETER_DEFAULT); // Set default predefined Parameters
char s[LS_MAXSTR];
// placeholder @@@title@@@
s = "WebGL-Animation"
ret = er_user_io_3dpdf.U3DHtml_ExportAPI(_3DHTML_EXPORT_SET_PARAMETER_TITLE,s); // Add a HTML predefined Parameters value for name 'title'
// placeholder @@@header@@@
s = ": EASY-ROB 3D WebGL Export with Animation"
ret = er_user_io_3dpdf.U3DHtml_ExportAPI(_3DHTML_EXPORT_SET_PARAMETER_HEADER,s); // Add a HTML predefined Parameters value for name 'header'
// placeholder @@@image_link@@@
s = "<a href=\"https://easy-rob.com/module/3d-pdf-export/\" target=\"_blank\"><img src=\"https://easy-rob.com/wp-content/themes/easy-rob/assets/img/easy-rob-logo.svg\" alt=\"EASY-ROB Software GmbH\"></a>"
ret = er_user_io_3dpdf.U3DHtml_ExportAPI(_3DHTML_EXPORT_SET_PARAMETER_IMAGELINK,s); // Add a HTML predefined Parameters value for name 'image_link'
}
Parameters
[in]html_flag
[in]snindividual string or name of parameter, depending on html_flag
[in]svvalue of parameter, depending on html_flag
Return values
0- _3DHTML_EXPORT_OK
1- _3DHTML_EXPORT_ERROR
-1- _3DHTML_EXPORT_VALUES, Error

◆ U3DPdf_ExportAPI()

static ER_DllExport int ER_CAPI_USER_IO_3DPDF::U3DPdf_ExportAPI ( int  pdf_flag,
char *  s = NULL 
)
static

Control 3D PDF and HTML Export
To open the created 3D Pdf file, Adobe Reader up to version XI is required.
To open the created 3D Html (WebGL) file, a suitable browser (Edge, Firefox, Chrome) is required.
see also U3DHtml_ExportAPI() method to define a Html Template file with user defined placeholder.
Parameter pdf_flag is one of
_3DPDF_EXPORT_GET_MODE, _3DPDF_EXPORT_ACTIVATE, _3DPDF_EXPORT_DEACTIVATE, _3DPDF_EXPORT_INIT, _3DPDF_EXPORT_START, _3DPDF_EXPORT_PAUSE, _3DPDF_EXPORT_STOP, _3DPDF_EXPORT_SAVE, _3DPDF_EXPORT_EXPORT, _3DPDF_EXPORT_SHOW, _3DPDF_EXPORT_RESTART, _3DPDF_EXPORT_GET_LIC_OPTIONS, _3DPDF_EXPORT_GET_LICENSE_TEXT, _3DPDF_EXPORT_SET_FILE, _3DPDF_EXPORT_SET_PASSWORD or _3DPDF_EXPORT_SET_LABEL _3DPDF_EXPORT_SET_KEYFRAMES_MAX _3DPDF_EXPORT_GET_KEYFRAMES _3DPDF_EXPORT_RESET_LAYOUT _3DPDF_EXPORT_LOAD_LAYOUT_FILE _3DPDF_EXPORT_SAVE_LAYOUT_FILE
Parameter s is an individual string, depending on pdf_flag
Explanations
Before using the 3D Export, make sure that the "EASY-ROB PlugIn Dialog 3D Export" is closed. This can be verified with _3DPDF_EXPORT_GET_MODE.
The return value is one of
_3DPDF_EXPORT_MODE_FREE - 3D Export currently not in use, does mean it is ready to for API usage
_3DPDF_EXPORT_MODE_ERROR - 3D Export currently on error
_3DPDF_EXPORT_MODE_DLG - PlugIn Dialog for 3D Export is open
_3DPDF_EXPORT_MODE_API - already in API usage

Step_I
If _3DPDF_EXPORT_GET_MODE returns _3DPDF_EXPORT_MODE_FREE, you can activate and initialize the 3D Export with _3DPDF_EXPORT_ACTIVATE and _3DPDF_EXPORT_INIT.
In the next step, define all necessary callback function, see
U3DPdf_ExportAPI_SetCallbackMsg() for feedback messages
U3DPdf_ExportAPI_SetCallbackSaveStatus() for status messages when saving the 3D file
U3DPdf_ExportAPI_SetCallbackProgress() for ExportU3DScene and Generate3DPdf progress messages when saving the 3D file
U3DPdf_ExportAPI_SetCallbackProgressExportU3DScene() for ExportU3DScene progress messages when saving the 3D file
U3DPdf_ExportAPI_SetCallbackProgressGenerate3DPdf() for Generate3DPdf progress messages when saving the 3D file

Step_II
The API for 3D Export is ready to use now.
To start the recording, use _3DPDF_EXPORT_START
Everytime EASY-ROB causes a grafical update, an additional key frame is recorded.
During recording you can set labels with _3DPDF_EXPORT_SET_LABEL
Use _3DPDF_EXPORT_PAUSE to pause and continue the recording.
Before you stop and save the recording you should define a file name for the created pdf or html (WebGL) file.
If you want to save the 3D capture as an HTML (WebGL) file, use the U3DHtml_ExportAPI() method to specify the html template file and define the custom placeholder.
Option: The password protecting the pdf file and allows it to open only for certain users.

Step_III
Finally use _3DPDF_EXPORT_SAVE or _3DPDF_EXPORT_STOP to create the 3D file and wait until _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE, see U3DPdf_ExportAPI_SetCallbackSaveStatus().
Use _3DPDF_EXPORT_DEACTIVATE to terminate the API usage. This sets the 3D Export back to _3DPDF_EXPORT_MODE_FREE and will free the complete used memory.
Remarks
Use _3DPDF_EXPORT_EXPORT directly after Step_I to save the 3D Scene without animation.
After Step_III you can immediately continue with Step_II , it is not necessary to activate the 3D Export API several times.

// Example:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Declaration of callback functions
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static void Callback_API_Msg_1(char *s=NULL)
{
if (s)
SetDlgItemText(IDC_STATIC_API_MSG_1,s);
}
static void Callback_API_Msg_2(char *s=NULL)
{
if (s)
SetDlgItemText(IDC_STATIC_API_MSG_2,s);
}
static void Callback_API_SaveStatus(int save_status)
{
char *s[] = {
"SAVE_STATUS_UNDEF",
"SAVE_STATUS_RECORD",
"SAVE_STATUS_BEGIN",
"SAVE_STATUS_BEGIN_THREAD",
"SAVE_STATUS_DONE",
"SAVE_STATUS_ABORT",
"SAVE_STATUS_ERROR",
"SAVE_STATUS_KEYFRAMES_MAX",
"?","?"
};
er_user_io_dialog._info_line_msg(0,"%s", save_status<=_3DPDF_EXPORT_SAVE_STATUS_LAST ? s[save_status] : "?");
}
static void Callback_API_Progress(double progress)
// Save Step A+B
{
char s[MAXSTR];
sprintf(s,"%3u%%", (unsigned int)(progress*100.0));
}
static void Callback_API_ProgressExportU3DScene(double progress)
// Save Step A
{
char s[MAXSTR];
sprintf(s,"%3u%%", (unsigned int)(progress*100.0));
}
static void Callback_API_ProgressGenerate3DPdf(double progress)
// Save Step B
{
char s[MAXSTR];
sprintf(s,"%3u%%", (unsigned int)(progress*100.0));
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Step I ... activate, initialize, define necessary callback functions
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void _3dpdf_ActDeactivate()
// activate API Control for 3D Export
// requires _3DPDF_EXPORT_MODE_FREE
// or
// deactivate API Control for 3D Export
// requires _3DPDF_EXPORT_MODE_API
{
// 3D Export Version
er_user_io_dialog._info_line_msg(0,"U3DPdf_ExportVer() = %s",s);
// get current status of 3D Export
// it is one of _3DPDF_EXPORT_MODE_ERROR,
// _3DPDF_EXPORT_MODE_FREE ... choice to use DLG or API
// _3DPDF_EXPORT_MODE_DLG ... Dlg is enabled
// _3DPDF_EXPORT_MODE_API ... API is enabled
switch (u3dpdf_mode) {
// fatal ERROR
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_GET_MODE is %s","ERROR");
break;
// activate API usage ... _3DPDF_EXPORT_ACTIVATE
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_GET_MODE is %s ... activate","FREE");
{
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_ACTIVATE ... success");
//
// _3DPDF_EXPORT_INIT immediatly when _3DPDF_EXPORT_ACTIVATE success
//
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_INIT ... %s %d",!ret?"success":"failed",ret);
// Define Callback Functions for Progress and Message Output
// Use Callback_API_Progress for Save Step A+B
// or use Callback_API_ProgressExportU3DScene for Save Step A
// and Callback_API_ProgressGenerate3DPdf for Save Step B
er_user_io_3dpdf.U3DPdf_ExportAPI_SetCallbackMsg(1,Callback_API_Msg_1); // Sim
er_user_io_3dpdf.U3DPdf_ExportAPI_SetCallbackMsg(2,Callback_API_Msg_2); // Aux
er_user_io_3dpdf.U3DPdf_ExportAPI_SetCallbackSaveStatus(Callback_API_SaveStatus); // SaveStatus
}
else
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_ACTIVATE ... failed %d",ret);
break;
// DLG is enabled, do nothing here
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_GET_MODE is %s ... do nothing","DLG");
AfxMessageBox(_T("3D Export currently used by Dialog"),MB_ICONSTOP);
break;
// API is enabled, ask for deactivation
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_GET_MODE is %s","API");
if (er_user_io_dialog.dialog_yes_no("Deactivate 3D Export?"))
{
// Note:
// _3DPDF_EXPORT_DEACTIVATE will free the complete used memory
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_DEACTIVATE ... success");
else
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_DEACTIVATE ... failed %d",ret);
}
break;
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Step II ... start/pause/continue recording, label, password, pdf file
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void _3dpdf_Start()
// Start recording
// requires _3DPDF_EXPORT_ACTIVATE + _3DPDF_EXPORT_INIT
{
if (u3dpdf_mode != _3DPDF_EXPORT_MODE_API)
{
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_GET_MODE ... Error, mode _3DPDF_EXPORT_MODE_API required");
return;
}
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_START ... %s %d",!ret?"success":"failed",ret);
return;
}
void _3dpdf_Pause()
// Pause and continue recording
// requires _3DPDF_EXPORT_START
{
if (u3dpdf_mode != _3DPDF_EXPORT_MODE_API)
{
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_GET_MODE ... Error, mode _3DPDF_EXPORT_MODE_API required");
return;
}
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_PAUSE ... %s %d",!ret?"success":"failed",ret);
return;
}
void _3dpdf_Label()
// set 3D_Pdf label
// requires _3DPDF_EXPORT_START
{
if (u3dpdf_mode != _3DPDF_EXPORT_MODE_API)
{
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_GET_MODE ... Error, mode _3DPDF_EXPORT_MODE_API required");
return;
}
char label[LS_MAXSTR];
sprintf(label,"Label ... t = %.2fs",*er_sim.inq_sim_time());
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_SET_LABEL ... %s Label: '%s'",!ret?"success":"failed",label);
return;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Step III ... save or export
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void _3dpdf_Save()
// Stop recording and Save to 3D Pdf or Html (WebGL) file
// requires _3DPDF_EXPORT_START
{
if (u3dpdf_mode != _3DPDF_EXPORT_MODE_API)
{
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_GET_MODE ... Error, mode _3DPDF_EXPORT_MODE_API required");
return;
}
//----------------------------------------------
// set file name for Pdf or Html (WebGL) file
//----------------------------------------------
char _3D_Pdf_fln[LS_MAXSTR] = { "my_Pdf_file.pdf" }; // extension is '.pdf'
// or
char _3D_Html_fln[LS_MAXSTR] = { "my_Html_file.html" }; // extension is '.html'
//ret = er_user_io_3dpdf.U3DPdf_ExportAPI(_3DPDF_EXPORT_SAVE,"Thread");
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_SAVE ... %s %d",!ret?"success":"failed",ret);
return;
}
void _3dpdf_Export()
// EXPORT to 3D_Pdf without animation
// requires _3DPDF_EXPORT_ACTIVATE + _3DPDF_EXPORT_INIT + callback function
{
if (u3dpdf_mode != _3DPDF_EXPORT_MODE_API)
{
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_GET_MODE ... Error, mode _3DPDF_EXPORT_MODE_API required");
return;
}
//----------------------------------------------
// set file name for Pdf or Html (WebGL) file
//----------------------------------------------
// see _3dpdf_Save()
er_user_io_dialog._info_line_msg(0,"_3DPDF_EXPORT_EXPORT ... %s %d",!ret?"success":"failed",ret);
return;
}
Parameters
[in]pdf_flag
[in]sindividual string, depending on pdf_flag
Return values
0- _3DPDF_EXPORT_OK
1- _3DPDF_EXPORT_ERROR
-1- _3DPDF_EXPORT_VALUE, Error

◆ U3DPdf_ExportAPI_SetCallbackMsg()

static ER_DllExport int ER_CAPI_USER_IO_3DPDF::U3DPdf_ExportAPI_SetCallbackMsg ( int  callback_fct_id,
void(*)(char *)  ptr_MsgFct 
)
static

Defines a callback function for output messages during 3D PDF file Export
Parameter callback_fct_id is 1 or 2 for two different output streams.

// Example:
// Declaration of two callback functions for ouput messages
static void Callback_API_Msg_1(char *s=NULL)
{
if (s)
SetDlgItemText(IDC_STATIC_API_MSG_1,s);
}
static void Callback_API_Msg_2(char *s=NULL)
{
if (s)
SetDlgItemText(IDC_STATIC_API_MSG_2,s);
}
...
// Set callback function pointer
er_user_io_3dpdf.U3DPdf_ExportAPI_SetCallbackMsg(1,Callback_API_Msg_1);
...
Parameters
[in]callback_fct_id
[in]ptr_MsgFct(char *msg) callback function pointer
Return values
0- Ok
1- Error

◆ U3DPdf_ExportAPI_SetCallbackProgress()

static ER_DllExport int ER_CAPI_USER_IO_3DPDF::U3DPdf_ExportAPI_SetCallbackProgress ( void(*)(double)  ptr_ProgressFct)
static

Defines one single callback function for ExportU3DScene progress and Generate3DPdf progress messages when saving the 3D PDF file
Parameter progress in Callback_API_Progress(double progress) is between 0 and 1 for 100%
Define U3DPdf_ExportAPI_SetCallbackSaveStatus() to receive _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE when saving the 3D PDF file is completed.
Remarks
To define one callback function for ExportU3DScene progress (Save Step A) and one for Generate3DPdf progress (Save Step B),
use U3DPdf_ExportAPI_SetCallbackProgressExportU3DScene() and U3DPdf_ExportAPI_SetCallbackProgressGenerate3DPdf()

// Example:
// Declaration of a callback functions for progress messages
static void Callback_API_Progress(double progress)
// Save Step A+B
{
char s[MAXSTR];
sprintf(s,"%3u%%", (unsigned int)(progress*100.0));
}
...
// Set callback function pointer
er_user_io_3dpdf.U3DPdf_ExportAPI_SetCallbackProgress(Callback_API_Progress);
...
Parameters
[in]ptr_ProgressFct(double) callback function pointer
Return values
0- Ok
1- Error

◆ U3DPdf_ExportAPI_SetCallbackProgressExportU3DScene()

static ER_DllExport int ER_CAPI_USER_IO_3DPDF::U3DPdf_ExportAPI_SetCallbackProgressExportU3DScene ( void(*)(double)  ptr_ProgressFctExportU3DScene)
static

Defines a callback function for ExportU3DScene progress messages when saving the 3D PDF file
Parameter progress in Callback_API_ProgressExportU3DScene(double progress) is between 0 and 1 for 100%
Define U3DPdf_ExportAPI_SetCallbackSaveStatus() to receive _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE when saving the 3D PDF file is completed.
Remarks
When saving the 3D PDF file, ExportU3DScene is Save Step A.
Save Step B generates the 3DPdf file, use U3DPdf_ExportAPI_SetCallbackProgressGenerate3DPdf()
Use U3DPdf_ExportAPI_SetCallbackProgress() to define one single callback function for both Save Steps.

// Example:
// Declaration of a callback functions for progress messages
static void Callback_API_ProgressExportU3DScene(double progress)
// Save Step A
{
char s[MAXSTR];
sprintf(s,"%3u%%", (unsigned int)(progress*100.0));
}
...
// Set callback function pointer
er_user_io_3dpdf.U3DPdf_ExportAPI_SetCallbackProgressExportU3DScene(Callback_API_ProgressExportU3DScene);
...
Parameters
[in]ptr_ProgressFctExportU3DScene(double) callback function pointer
Return values
0- Ok
1- Error

◆ U3DPdf_ExportAPI_SetCallbackProgressGenerate3DPdf()

static ER_DllExport int ER_CAPI_USER_IO_3DPDF::U3DPdf_ExportAPI_SetCallbackProgressGenerate3DPdf ( void(*)(double)  ptr_ProgressFctGenerate3DPdf)
static

Defines a callback function for Generate3DPdf progress messages when saving the 3D PDF file
Parameter progress in Callback_API_ProgressGenerate3DPdf(double progress) is between 0 and 1 for 100%
Define U3DPdf_ExportAPI_SetCallbackSaveStatus() to receive _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE when saving the 3D PDF file is completed.
Remarks
When saving the 3D PDF file, ExportU3DScene is Save Step A and Generate3DPdf is Save Step B.
For Save Step A use U3DPdf_ExportAPI_SetCallbackProgressExportU3DScene()
Use U3DPdf_ExportAPI_SetCallbackProgress() to define one single callback function for both Save Steps.

// Example:
// Declaration of a callback functions for progress messages
static void Callback_API_ProgressGenerate3DPdf(double progress)
// Save Step B
{
char s[MAXSTR];
sprintf(s,"%3u%%", (unsigned int)(progress*100.0));
}
...
// Set callback function pointer
er_user_io_3dpdf.U3DPdf_ExportAPI_SetCallbackProgressGenerate3DPdf(Callback_API_ProgressGenerate3DPdf);
...
Parameters
[in]ptr_ProgressFctGenerate3DPdf(double) callback function pointer
Return values
0- Ok
1- Error

◆ U3DPdf_ExportAPI_SetCallbackSaveStatus()

static ER_DllExport int ER_CAPI_USER_IO_3DPDF::U3DPdf_ExportAPI_SetCallbackSaveStatus ( void(*)(int)  ptr_SaveStatusFct)
static

Defines a callback function for status messages when saving the 3D PDF file
Parameter save_status in Callback_API_SaveStatus(int save_status) is one of _3DPDF_EXPORT_SAVE_STATUS_UNDEF, _3DPDF_EXPORT_SAVE_STATUS_RECORD, _3DPDF_EXPORT_SAVE_STATUS_SAVE_BEGIN, _3DPDF_EXPORT_SAVE_STATUS_SAVE_BEGIN_THREAD, _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE, _3DPDF_EXPORT_SAVE_STATUS_SAVE_ABORT, _3DPDF_EXPORT_SAVE_STATUS_SAVE_ERROR or _3DPDF_EXPORT_SAVE_STATUS_KEYFRAMES_MAX
Remarks
save_status _3DPDF_EXPORT_SAVE_STATUS_RECORD confirmed that the recording is started
A pdf_flag _3DPDF_EXPORT_STOP, see U3DPdf_ExportAPI() causes _3DPDF_EXPORT_SAVE_STATUS_SAVE_BEGIN or _3DPDF_EXPORT_SAVE_STATUS_SAVE_BEGIN_THREAD to confirm that the 3D Pdf Export is started directly or running in a Thread.
If the 3D Pdf file was created successfully, it will be confirmed with _3DPDF_EXPORT_SAVE_STATUS_SAVE_DONE.
In other cases the save_status is _3DPDF_EXPORT_SAVE_STATUS_SAVE_ABORT or _3DPDF_EXPORT_SAVE_STATUS_SAVE_ERROR
Make sure that 3D Pdf file is not open in the Adobe Reader.

// Example:
// Declaration of a callback functions for status messages
static void Callback_API_SaveStatus(int save_status)
{
char *s[] = {
"SAVE_STATUS_UNDEF",
"SAVE_STATUS_RECORD",
"SAVE_STATUS_BEGIN",
"SAVE_STATUS_BEGIN_THREAD",
"SAVE_STATUS_DONE",
"SAVE_STATUS_ABORT",
"SAVE_STATUS_ERROR",
"SAVE_STATUS_KEYFRAMES_MAX",
"?","?"
};
er_user_io_dialog._info_line_msg(0,"%s", save_status<=_3DPDF_EXPORT_SAVE_STATUS_LAST ? s[save_status] : "?");
}
...
// Set callback function pointer
er_user_io_3dpdf.U3DPdf_ExportAPI_SetCallbackSaveStatus(Callback_API_SaveStatus);
...
Parameters
[in]ptr_SaveStatusFct(int) callback function pointer
Return values
0- Ok
1- Error

◆ U3DPdf_ExportVer()

static ER_DllExport char* ER_CAPI_USER_IO_3DPDF::U3DPdf_ExportVer ( void  )
static

3D Export Version

Return values
version3DPDF_Export version number

The documentation for this class was generated from the following file: