/**
Update Component modifications from Creo to CyPhy (Creo Update (Export)).

Pre-conditions:
 * MetaLink is running and CyPhy and CAD-assebler are connected
 * Creo is opened in AVM component editing mode.
   - CyPhy switches Creo to AVM component editing mode.
   - CyPhy starts CAD-assembler in component editing mode.
Action:
 * Perform AVM component edits in Creo
   - add a datum
   - modify a parameter
 * Press the “Update Cyphy Component” button.
Post-condition:
 * The updates are reflected in the CyPhy component.

*/
ProError DoUpdateComponent()
{
	ProError status = PRO_TK_NO_ERROR; 
	ProMdlType type;
	wchar_t msg[1000];
	ProMdl mdl;
	*msg = 0;

	if (isis::GlobalModelData::Instance.mode == isis::COMPONENTEDIT)
	{
		ProMdlCurrentGet(&mdl);
	} else {
		mdl = getSelectedMdl();
	}

	if (!mdl)
	{
		ErrorDialog(L"No model has been selected.");
		return status;
	}
	ProMdlTypeGet(mdl, &type);
	if (type != PRO_MDL_PART && type != PRO_MDL_ASSEMBLY)
	{
		ErrorDialog(L"Selected model has to be either part or assembly.");
		return status;
	}

	UpdateComponent(mdl);

	return status;
}
/**
Refresh component instance names in Creo (Creo Refresh).

Pre-conditions:
 * MetaLink is running and CyPhy and CAD-assembler are connected
 * Creo is opened in assembly design editing mode.
   - CyPhy switches Creo to assembly design editing mode.
   - CyPhy starts CAD-assembler in assembly design editing mode.
 * There is an assembly design loaded in Creo.
Action:
 * Press the component name “Refresh” button.
Post-condition:
 * The names are displayed in the tree browser to the right side of the components.
*/
ProError DoResync()
{
	ProMdl mainMdl;
	ProMdlCurrentGet(&mainMdl);
	Resync(mainMdl);
	return PRO_TK_NO_ERROR;
}
Example #3
0
uiCmdAccessState UserAccessDefault(uiCmdAccessMode access_mode)
{
	UNUSED_ALWAYS(access_mode);
	ProMdl curmdl = NULL;
	if (ProMdlCurrentGet(&curmdl) != PRO_TK_NO_ERROR)
		return ACCESS_UNAVAILABLE;
	ProMdlType type;
	ProMdlTypeGet(curmdl, &type);
	if (type == PRO_MDL_PART || type == PRO_ASSEMBLY)
		return ACCESS_AVAILABLE;
	else
		return ACCESS_UNAVAILABLE;
}
Example #4
0
/*====================================================================*\
    FUNCTION :	TestQcrName()
    PURPOSE  :	Generate a name for an output QCR file.
\*====================================================================*/
char *ProTestQcrName(
    ProMdl *model,	/* Input - model */
    char filext[],	/* Input - file extension */
    char filename[])	/* Output - file name */
{
    ProError status;
    char model_name[30], model_type[10];
    char *ProUtilModelnameGet(ProMdl*,char*,char*);

/*--------------------------------------------------------------------*\
    Get the current model
\*--------------------------------------------------------------------*/
    if(model == NULL)
    {
	status = ProMdlCurrentGet(model);

	/* No error check so this code can be used out of mode */
	TEST_CALL_REPORT("ProMdlCurrentGet()", "ProTestQcrName()",
			    status, status != PRO_TK_NO_ERROR);
    }

/*--------------------------------------------------------------------*\
    If there is still no model (so no current mode),
	use the name "nomodel".
\*--------------------------------------------------------------------*/
    if(model == NULL)
	ProUtilstrcpy(filename,"nomodel");
    else
    {
/*--------------------------------------------------------------------*\
	Use the name of the current model as the file name.
\*--------------------------------------------------------------------*/
	ProUtilModelnameGet(model, model_name,  model_type);
	ProUtilstrcpy(filename,(const char *)model_name);
    }

/*--------------------------------------------------------------------*\
    Add the file extension.
\*--------------------------------------------------------------------*/
    ProUtilstrcat(filename,(const char *)filext);

    return(filename);
}