cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Using ProToolkit to Get Tesselation for a Flattened Cable Harness

jl2
4-Participant
4-Participant

Using ProToolkit to Get Tesselation for a Flattened Cable Harness

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:

  1. Is the "12345_mfg.asm.1" the correct assembly to get the flattened harness?
  2. Is there a way to choose between the flattened and 3D version of the cables using the API?
  3. Are there any other config.pro options I may need to get the flattened harness?
  4. And off on a slight tangent...  Inn another place in our application we're passing a ProSolid as the first parameter to ProAssemblyHarnessesCollect, instead of a ProAssembly. It seems to work, but I'm curious if there's any reason to prefer passing a ProAssembly instead of a ProSolid?

 

    //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);
    }

 

0 REPLIES 0
Top Tags