Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Part Creation

David_Hyper

New member
Hey guys,

I know we can programmatically create parts through ProSolidCreate or even copy it from an already existing part with the ProMdlCopy function, but i'd like to know, how do wecreate a part from a template file ?

Because when we call ProSolidCreate, the defaults datum planes (FRONT, TOP, RIGHT) and the CSys aren't presents ?

Thx in advance

David
Edited by: David_Hyper
 
I found a way to do that
====================================================



// load the template for part creations
ProSolid SolidTemplate;
if(ProMdlRetrieve(L"nlbs_part_solid", PRO_MDL_PART, (ProMdl * &SolidTemplate) != PRO_TK_NO_ERROR) {
AfxMessageBox(L"Retrieving a template not working");
return;
}


// copy the template in the new part
ProSolid Solid;
if(ProMdlCopy(SolidTemplate, L"Test", (ProMdl*)&Solid) != PRO_TK_NO_ERROR) {
AfxMessageBox(L"copy not working");
return;
}


// remove the template from memory
if(ProMdlErase(SolidTemplate) != PRO_TK_NO_ERROR) {
AfxMessageBox(L"Removing template from memory not working");
return;
}


// create a window for the new part
int w_id;
if(ProObjectwindowCreate(L"Test", PRO_PART, &w_id) != PRO_TK_NO_ERROR) {
AfxMessageBox(L"ProObjectwindowCreate not working");
return;
}


// display it and activate it
ProSolidDisplay(Solid);
ProWindowCurrentSet(w_id);
ProWindowActivate(w_id);



====================================================


And thats to retrieve the template from disk, copying in your new part before working with it, and erasing the template from memory. You just have to activate your new model to make it the current model in ProE and then you can work with it.
Edited by: David_Hyper
 

Sponsor

Back
Top