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
Highlighted
Amethyst

Retrieve model in toolkit

Hi all,

I try to retrieve model to assemble. I try to configure the model name in txt file.

ProStringToWstring(MLinkAToAssemble,MdAPart);
err = ProMdlRetrieve(MLinkAToAssemble,(ProMdlType)PRO_MDL_PART,(ProMdl*)&CompSolid);

I use the above code to retrieve model, but I get error PRO_TK_E_NOT_FOUND

whereas if i uses the model name directly I get the model in session

ProStringToWstring(MLinkAToAssemble,"TEST.PRT");
err = ProMdlRetrieve(MLinkAToAssemble,(ProMdlType)PRO_MDL_PART,(ProMdl*)&CompSolid);

Kindly throw some light

 

Regards,

Manjunath S

 

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Retrieve model in toolkit

@RPN @Ketan_Lalcheta  thanks for your suggestions

I came across few things in documentation. I would like to share with you

<li>This function accepts only strings only in the active 
    encoding of the Creo Parametric TOOLKIT application. Strings
    from other encodings may not be properly converted.

To handle this refer to UgUnicodeTranscoding.c in installation directory.

22 REPLIES 22

Re: Retrieve model in toolkit

check with value of variable once (MDApart in your case). It should not have space or something extra characters. Also check once that wide char name holds proper value after conversion from text file variable value.

Re: Retrieve model in toolkit

@Ketan_Lalcheta  I have cross verified, herewith I have attached the image for reference

Re: Retrieve model in toolkit

I presume model is present into current working dir as it works with hard coded string. I have used this API and it works fine. Which Creo version you are having?

 

Additionally try with value as name only without extension once as you have already passed model type as part in second argument. If you don't wanna change value into text file and keep it as .prt only, use second argument as PRO_MDL_UNUSED.

 

HIH

Ketan

Re: Retrieve model in toolkit

while reading value from text file, make sure you are not changing directory. If so, come back to earlier directory where model are present before using mdlretrive.

Re: Retrieve model in toolkit

@Ketan_Lalcheta we use creo 2, moreover file is been retrived from PDM, do i need to set the working dir again? kindly clarify

Re: Retrieve model in toolkit

@Ketan_Lalcheta I used as suggested but still failed to retrieve model

Re: Retrieve model in toolkit

Get rid of the extension in your string!

Try this:

ProStringToWstring(MLinkAToAssemble,"TEST");

 

ProMdlRetrieve  (ProFamilyName name, 
ProMdlType    type,
                                 ProMdl       *p_handle); 
 
Type is given by ProMdlType!!
 
Windchill should work if you search for and you find it.

Re: Retrieve model in toolkit

@RPN  when I enter file name directly i can retrieve the model, but my requirement is model name have to be red from text file.

Re: Retrieve model in toolkit

@RPN @Ketan_Lalcheta  thanks for your suggestions

I came across few things in documentation. I would like to share with you

<li>This function accepts only strings only in the active 
    encoding of the Creo Parametric TOOLKIT application. Strings
    from other encodings may not be properly converted.

To handle this refer to UgUnicodeTranscoding.c in installation directory.