cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve model in toolkit

SOLVED

Re: Retrieve model in toolkit

Doc suggests that file UgUnicodeTranscoding.c is located at <creo_
toolkit_loadpoint>/protk_appls/pt_userguide/ptu_main.

 

But could not find the same with Creo 4.0 M030

Re: Retrieve model in toolkit

@Ketan_Lalcheta  its available in Creo2. 

Re: Retrieve model in toolkit

I don't believe that this is the problem, because you provide the input string.

 

str_type_table[] =
{
{(char *)"sec", PRO_2DSECTION},
{(char *)"prt", PRO_PART},
{(char *)"asm", PRO_ASSEMBLY},
{(char *)"drw", PRO_DRAWING},
{(char *)"mfg", PRO_MFG},
{(char *)"lay", PRO_LAYOUT},
{(char *)"frm", PRO_DWGFORM},
{(char *)"rep", PRO_REPORT},
{(char *)"mrk", PRO_MARKUP},
{(char *)"dgm", PRO_DIAGRAM},
{(char *)"???", PRO_TYPE_INVALID}
};

 

// You parse your file name

ProFilenameParse(sel_path, def_path, w_name, w_type, &version);

//Get the type (based on table above)

ProWstringToString(str, def_path);

ProUtilConfirmNameType(str, line, &type)

 

//Open the model you may need to change the dir 

ProMdlRetrieve(w_name, (ProMdlType)type, (ProMdl*)&comp);

 

Search at the sample folder.

 

In Tcl this is done in 2 min, check the section Files - Open, save, erase Creo files or the Windchill Section

 

 

Re: Retrieve model in toolkit

@RPN  in this case w_name if retrieved from Creo interface there wont be an issue, where as if its been retrieved from any other interface ex. text file then creo shows error. 

Re: Retrieve model in toolkit

You can’t directly compare the Creo Interface with Toolkit. All model types are handled in one table without the need to have the 4 chars for the extension, instead you have an integer for the type.

Re: Retrieve model in toolkit

@RPN  

I have list of files(File Name) to be retrieved in session in a text file.

Now creo have to read the text file and pass it to function ProMdlRetrieve.

I learnt that there should be  conversion using ProNativewstringToWstring

 

 

Re: Retrieve model in toolkit

How is you input file encoded? UTF? Use notepad and encode as ANSI.

 

If you use 'test.prt' than I can't believe your story, you need only to convert to wchar (2 bytes per char max).

 

Tcl Section Files - Open ...

 

#
# read the file
# 
set fp [open models.txt]
set models [split [read $fp] \n]
close $fp

#
# Open the models in session
# if already in session skip to open the model
#
foreach model $models {
        if {![ps_model exist $model]}
                ps_file open $model
        }
}

Re: Retrieve model in toolkit

@RPN  is TCL related to Toolkit.If no, kindly try the same using toolkit. I got the error also I have attached the screen shot of the error message in earlier post.

 

Re: Retrieve model in toolkit

It is based on Toolkit, how do you thing you can archive this without 🙂

 

 

Re: Retrieve model in toolkit

int
ps_test_Open_File (

)

{
	ProName       		w_modelname;
	ProMdl       		Model;
	ProError			tk_status;

	ProStringToWstring(w_modelname,"TEST");
	tk_status = ProMdlRetrieve(w_modelname,PRO_MDL_PART,&Model);

	return tk_status;

}

Compile and try. It is working for me!