Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi!
I have an assembly with a flattened cable harness and I'm trying to use the code below to get the tessellated mesh for the flattened cables. The problem is that I'm only getting the 3D version.
In the real application code we're also retrieving several parts (connectors, etc.), and those are in the correct, flattened positions when we open the _mfg file.
This assembly came from a customer, and they gave us "12345_flat.asm.1", "12345_mfg.asm.1", "12345_rout.asm.1", as well as .prt and .asm files for the connectors. When I open the "12345_mfg.asm.1" in Creo, I see the flattened cable harness.
My questions are:
//ProConfigoptSet(L"allow_mfg_in_assem_mode", L"yes");
//ProConfigoptSet(L"allow_harn_mfg_assy_retrieval", L"yes");
ProConfigoptSet(L"display_thick_cables", L"yes");
char* proeFilepath = ".\\12345_mfg.asm.1";
ProPath w_proefilePath;
ProStringToWstring(w_proefilePath, proeFilepath);
ProMdl currMdl = nullptr;
try {
ProCable* p_cables;
int n_harness;
err = ProMdlFiletypeLoad(w_proefilePath, PRO_MDLFILE_ASSEMBLY, PRO_B_FALSE, &currMdl);
printf("ProMdlFiletypeLoad returns %d\n", err);
ProAssembly assembly = nullptr;
err = ProMfgAssemGet((ProMfg)currMdl, &assembly);
printf("ProMfgAssemGet returns %d\n", err);
ProHarness* harnesses = NULL;
err = ProAssemblyHarnessesCollect(assembly, &harnesses);
err = ProArraySizeGet(harnesses, &n_harness);
printf("Number of Harness: %d\n", n_harness);
ProSurfaceTessellationInput tessInput;
ProSurfacetessellationinputAlloc(&tessInput);
for (int i = 0; i < n_harness; i++) {
int n_cbls = 0;
ProHarnessCablesCollect(harnesses[i], &p_cables);
err = ProArraySizeGet(p_cables, &n_cbls);
printf("Number of Cables: %d\n", n_cbls);
for (int j=0; j<n_cbls; j++)
{
ProCable *cable = &p_cables[j];
ProName cableName;
ProCableNameGet(cable, cableName);
printf("Got cable %s\n", ProNameToString(cableName).c_str());
ProTessellation tessellation;
err = ProCableTessellationGet(cable, tessInput, &tessellation);
Pro3dPnt* vertices;
ProTessellationVerticesGet(tessellation, &vertices);
int arraySize;
ProArraySizeGet(vertices, &arraySize);
printf("Got %d vertices in cable.\n", arraySize);
ProArrayFree((ProArray*)&vertices);
}
ProArrayFree((ProArray*)&p_cables);
}
ProMdlErase(currMdl);
}