/*
Copyright (c) 2019 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved.
*/
/*====================================================================*\
FILE : PTMechExCopy.c
PURPOSE : Test Pro/TOOLKIT functions for Mechanica
\*====================================================================*/
/*--------------------------------------------------------------------*\
Pro/Toolkit includes -- include this first
\*--------------------------------------------------------------------*/
#include <ProMechItem.h>
#include <ProUtil.h>
#include <ProMessage.h>
#include <PTMechExamples.h>
/*=============================================================*\
FUNCTION: PTMechExDelete
PURPOSE: Deletes the mech item
\*=============================================================*/
ProError PTMechExDelete ()
{
ProSelection* sels;
ProMechItem mech_item;
int n_sels, i;
ProMdl constraint_part;
status = ProMdlCurrentGet(&constraint_part);
PT_TEST_LOG_SUCC ("ProMdlCurrentGet");
/*--------------------------------------------------------------------*\
Select the item to delete
\*--------------------------------------------------------------------*/
status = ProMessageDisplay(msgfile, "PTMechEx Select the item to delete");
PT_TEST_LOG_SUCC("ProMessageDisplay()");
status =ProSelect ("sim_beam,sim_spring,sim_gap,sim_mass,sim_shell,sim_mc,sim_shlpair,sim_weld,sim_connect",
PRO_VALUE_UNUSED,
NULL,
NULL,
NULL,
NULL,
&sels,
&n_sels);
PT_TEST_LOG_SUCC ("ProSelect()");
for (i = 0; i < n_sels; i++)
{
status = ProSelectionModelitemGet (sels[i], (ProModelitem*)&mech_item);
PT_TEST_LOG_SUCC ("ProSelectionModelitemGet()");
/*--------------------------------------------------------------------*\
Remove the mech item
\*--------------------------------------------------------------------*/
status = ProMechitemRemove (&mech_item);
PT_TEST_LOG_SUCC ("ProMechitemRemove");
}
/*--------------------------------------------------------------------*\
Print Message from the result
\*--------------------------------------------------------------------*/
if (status == PRO_TK_NO_ERROR)
{
status = ProMessageDisplay(msgfile, "PTMechEx Item deleted successfully");
PT_TEST_LOG_SUCC("ProMessageDisplay()");
}
else
{
status = ProMessageDisplay(msgfile, "PTMechEx Item deletion failed");
PT_TEST_LOG_SUCC("ProMessageDisplay()");
}
return PRO_TK_NO_ERROR;
}