<DIV =Section1>
All,<?:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" />
I have a part that has several instances. With toolkit I am opening one of those instances and retrieving a simp rep. Then I output an ACIS file and then I want to clear my memory of everything except the generic part that I started with. How do I do this? I am unable to successfully call ProFaminstanceErase I think because I have a simp rep of the instance open. However when I call ProMdlErase on the ProPart simp rep handle it crashes Pro. Can someone give me some advice on activating/retrieving a simp rep of an instance of a part and then erasing it? Here is my code to output the ACIS file. I am not trying to erase the instance in the function. I try and erase the instance in the calling function.
Patrick Williams
Application Engineer
Steelcase Inc.
</DIV>
All,<?:namespace prefix = o ns = "urn:schemas-microsoft-com
I have a part that has several instances. With toolkit I am opening one of those instances and retrieving a simp rep. Then I output an ACIS file and then I want to clear my memory of everything except the generic part that I started with. How do I do this? I am unable to successfully call ProFaminstanceErase I think because I have a simp rep of the instance open. However when I call ProMdlErase on the ProPart simp rep handle it crashes Pro. Can someone give me some advice on activating/retrieving a simp rep of an instance of a part and then erasing it? Here is my code to output the ACIS file. I am not trying to erase the instance in the function. I try and erase the instance in the calling function.
Code:
ProError Model3D::OutputACIS(ProMdl mdlInstance, wstring symbolValue, ProSimprep simpRep) {
char *szFuncName = "OutputACIS()";
ProError pro_error = PRO_TK_NO_ERROR;
ProPart pro_partSimpRep = NULL;
ProFamilyName pro_wszMdlName;
ProName pro_wszSimpRepName;
ProSimprepType pro_simpRepType;
ProIntf3DExportType pro_intf3DExportType = PRO_INTF_EXPORT_SAT;
ProOutputAssemblyConfiguration pro_outputAsmConfig = PRO_OUTPUT_ASSEMBLY_FLAT_FILE;
ProBoolean pro_bIsSupported = PRO_B_FALSE;
ProOutputBrepRepresentation pro_bRep;
ProOutputInclusion pro_outputInclusion;
ProOutputLayerOptions pro_outputLayerOptions;
ProSelection pro_sel;
ProPath pro_wszFileName;
ProGeomitem pro_geomItem;
ProCsys pro_csys;
ProSimprep pro_simpRepMaster;
//Get the name of the simp rep
pro_error = ProModelitemNameGet((ProModelitem*)&simpRep, pro_wszSimpRepName);
PROUTIL_CALL_REPORT("ProModelitemNameGet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Activate the simp rep
if(m_pro_mdlType == PRO_MDL_PART) {
//Get the simp rep type
pro_error = ProSimprepTypeGet(&simpRep, &pro_simpRepType);
PROUTIL_CALL_REPORT("ProSimprepTypeGet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Get the name of the instance
pro_error = ProMdlNameGet(mdlInstance, pro_wszMdlName);
PROUTIL_CALL_REPORT("ProMdlNameGet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Retrieve the simp rep
pro_error = ProPartSimprepRetrieve(pro_wszMdlName, pro_simpRepType, pro_wszSimpRepName, &pro_partSimpRep);
PROUTIL_CALL_REPORT("ProPartSimprepRetrieve()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
}
else if(m_pro_mdlType == PRO_MDL_ASSEMBLY) {
//Activate the simp rep
pro_error = ProSimprepActivate((ProSolid)mdlInstance, &simpRep);
PROUTIL_CALL_REPORT("ProSimprepActivate()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
pro_partSimpRep = (ProPart)mdlInstance;
}
//Display the mdl
pro_error = ProMdlDisplay(pro_partSimpRep);
PROUTIL_CALL_REPORT("ProMdlDisplay()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Build the output filename
swprintf(pro_wszFileName, L"%s_%s_%s", symbolValue.c_str(), m_wstrLayerValue.c_str(), wcsstr(pro_wszSimpRepName, L"_") + 1);
//Verify that the assembly configuration is valid for exporting and IGES file
pro_error = ProOutputAssemblyConfigurationIsSupported(pro_intf3DExportTy pe, pro_outputAsmConfig, &pro_bIsSupported);
PROUTIL_CALL_REPORT("ProOutputAssemblyConfigurationIsSupported()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
if(pro_bIsSupported == PRO_B_FALSE)
return PRO_TK_BAD_INPUTS;
//Allocate geometry flags structure
pro_error = ProOutputBrepRepresentationAlloc(&pro_bRep);
PROUTIL_CALL_REPORT("ProOutputBrepRepresentationAlloc()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Set the geometry flags structure
pro_error = ProOutputBrepRepresentationFlagsSet(pro_bRep, PRO_B_FALSE, PRO_B_FALSE, PRO_B_TRUE, PRO_B_FALSE);
PROUTIL_CALL_REPORT("ProOutputBrepRepresentationFlagsSet ()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Verify that these flags are supported
pro_error = ProOutputBrepRepresentationIsSupported(pro_intf3DExportType, pro_bRep, &pro_bIsSupported);
PROUTIL_CALL_REPORT("ProOutputBrepRepresentationIsSupported()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
if(pro_bIsSupported == PRO_B_FALSE)
return PRO_TK_BAD_INPUTS;
//Allocate inclusion flags structure
pro_error = ProOutputInclusionAlloc(&pro_outputInclusion);
PROUTIL_CALL_REPORT("ProOutputInclusionAlloc()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Set the inclusion flags
pro_error = ProOutputInclusionFlagsSet(pro_outputInclusion, PRO_B_FALSE, PRO_B_FALSE, PRO_B_FALSE);
PROUTIL_CALL_REPORT("ProOutputInclusionFlagsSet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Allocate the layer options structure
pro_error = ProOutputLayerOptionsAlloc(&pro_outputLayerOptions);
PROUTIL_CALL_REPORT("ProOutputLayerOptionsAlloc()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Set the layer options
pro_error = ProOutputLayerOptionsAutoidSet(pro_outputLayerOptions, PRO_B_TRUE);
PROUTIL_CALL_REPORT("ProOutputLayerOptionsAutoidSet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Get the csys for this simp rep
pro_csys = GetCsys(pro_partSimpRep);
//Convert the cys to a geomitem
pro_error = ProCsysToGeomitem((ProSolid)pro_partSimpRep, pro_csys, &pro_geomItem);
PROUTIL_CALL_REPORT("ProCsysToGeomitem()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Allocate a selection object for the csys geomitem
pro_error = ProSelectionAlloc(NULL, (ProModelitem*)&pro_geomItem, &pro_sel);
PROUTIL_CALL_REPORT("ProSelectionAlloc()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Output the IGES file
pro_error = ProIntf3DFileWrite((ProSolid)pro_partSimpRep, pro_intf3DExportType, pro_wszFileName, pro_outputAsmConfig, pro_sel, pro_bRep, pro_outputInclusion, pro_outputLayerOptions);
PROUTIL_CALL_REPORT("ProIntf3DFileWrite()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Free the csys selection object
pro_error = ProSelectionFree(&pro_sel);
PROUTIL_CALL_REPORT("ProSelectionFree()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Free the layer options structure
pro_error = ProOutputLayerOptionsFree(pro_outputLayerOptions);
PROUTIL_CALL_REPORT("ProOutputLayerOptionsFree()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Free the inclusion flags structure
pro_error = ProOutputInclusionFree(pro_outputInclusion);
PROUTIL_CALL_REPORT("ProOutputInclusionFree()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
//Free the geometry flags structure
pro_error = ProOutputBrepRepresentationFree(pro_bRep);
PROUTIL_CALL_REPORT("ProOutputBrepRepresentationFree()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);
return PRO_TK_NO_ERROR;
}
Patrick Williams
Application Engineer
Steelcase Inc.
</DIV>