Skip to main content
10-Marble
March 3, 2026
Question

ProDrawingView2DSectionSet() returning PRO_TK_BAD_INPUTS (-2) for HALF section even with manual plan

  • March 3, 2026
  • 1 reply
  • 58 views

Hi everyone,

I am working in Creo Parametric using Pro/Toolkit (classic C API).

I am trying to programmatically apply a HALF section to an existing drawing view using:

ProDrawingView2DSectionSet()

The plane selection is done interactively using ProSelect(), and the selection succeeds.

Here is the relevant code:

Questions:

  1. Does the section name (sec_name_out) need to already exist in the model before calling ProDrawingView2DSectionSet?

  2. For HALF sections, does the plane selection need to be from the model window rather than the drawing?

  3. Is there any additional requirement (like creating the section definition first) before applying a half section?

  4. Does the view need to be a specific type (e.g., general view only)?

Manually, I can create the half section using the same reference plane without any issue. But programmatically it is not accepting the plane.

Any guidance on the correct workflow for creating or assigning a HALF section via Toolkit would be greatly appreciated.

Thank you.

ProSelection* sel_array = NULL;
int n_sels = 0;

status = ProSelect(
 "datum",
 1,
 NULL,
 NULL,
 NULL,
 NULL,
 &sel_array,
 &n_sels);

error_utils::CheckError(status, "ProSelect");

if (status != PRO_TK_NO_ERROR || n_sels == 0)
{
 logger::log_info("Plane selection failed.");
 return status;
}

ProSelection plane_sel = sel_array[0];

status = ProDrawingView2DSectionSet(
 current_drw,
 general_view,
 sec_name_out,
 PRO_VIEW_SECTION_AREA_HALF,
 plane_sel,
 NULL,
 NULL);

error_utils::CheckError(status, "ProDrawingView2DSectionSet");

ProSelect succeeds, but
ProDrawingView2DSectionSet returns:

PRO_TK_BAD_INPUTS (-2)

1 reply

Catalina
Community Moderator
March 10, 2026

Hi @VP_14440689 

Thank you for your post. 

Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.

Also, feel free to add any additional information you think might be relevant.

 

Best regards,

Catalina | PTC Community Moderator