Skip to main content
13-Aquamarine
June 18, 2021
Question

Error with ProDrawingFromTemplate ()

  • June 18, 2021
  • 2 replies
  • 2697 views

Hello Friends, 

I am new in Creo Customization , I am struck in creating of drawing template from ProDrawingFromTemplate function , I passed all valid arguments but still it returns error of PRO_TK_E_NOT_FOUND , I need help to create drawing template , I have attached code screenshot for your reference 

2 replies

15-Moonstone
June 18, 2021

I don't see where you are setting the value of  template name,  line 56 and 57.   The actual name of the template.   You are probably using the sample code like I did, and in the sample (and in my code)  I call UsrDrawingCreate passing the actual name.   also see that TEMPLATE_NAME is the argument for my function. 

 

another thing:   see that your template.drw actually exists, in your start model directory, and the the config.pro option start_model_dir is set to the correct place.

 

code example: 
UsrDrawingCreate("ppart_vr");
return(0);
}

 

*==================================================================*\
FUNCTION: UserDrawingCreate()
PURPOSE: Creates a drawing for the current model.
\*==================================================================*/

int UsrDrawingCreate(char TEMPLATE_NAME[40])
{
ProError err, status;

13-Aquamarine
June 19, 2021

I have declared template name global which is "c_drawing" , still it giving error.

RPN
18-Opal
June 20, 2021

I guess the “model” handle is invalid, try “solid_mdl” for testing in the function call to create the drawing via template, this must work if your current model is a solid.

 

Or use ProSolidMdlnameInit (ProSolidInit is depri) to init a valid solid handle. I thought a function for testing like IsSolid is available, but I’m not sure ( not at my desk😵💫).  In you case you need to extract the int type of the model on top, to feed that function and to get a valid result.

13-Aquamarine
June 22, 2021

Thank you , it is working , successfully created drawing template , but primary views are not created , it giving error of PRO_TK_E_General  at ProDrawingFromTemplate , If you have sample code , please share with me