/*
	Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved.
*/

#include <ProToolkit.h>
#include <ProGraphic.h>
#include <ProView.h>
#include <ProObjects.h>
#include <TestError.h>
#include <ProMdl.h>
#include <ProSolid.h>

int UserLoadPart()
{
    ProFamilyMdlName name;
    ProMdl part;
    ProFileName msgfil;
    ProError err;
    int status;
    
    ProStringToWstring(msgfil,"msg_ugsolid.txt");
/*---------------------------------------------------------------------*\
    Get the part name from the user
\*---------------------------------------------------------------------*/
    ProMessageDisplay(msgfil,"USER Enter the part name [QUIT] : ");
    err=ProMessageStringRead(PRO_FAMILY_MDLNAME_SIZE,name);
    if (err!=PRO_TK_NO_ERROR)
        return(0);

/*---------------------------------------------------------------------*\
    Retrieve the part from disk
\*---------------------------------------------------------------------*/
    err = ProMdlnameRetrieve(name,(ProMdlfileType)PRO_PART,&part);

/*---------------------------------------------------------------------*\
    Check that the part was retrieved
\*---------------------------------------------------------------------*/
    if(err!=0)
    {
        ProMessageDisplay(msgfil,"USER Failed to retrieve part %0w.prt",name);
        return(0);
    }

/*---------------------------------------------------------------------*\
    Open a window and display the part in it.
\*---------------------------------------------------------------------*/
    ProObjectwindowMdlnameCreate(name,PRO_PART,NULL);
    ProSolidDisplay(part);
}