ProDrawingView2DSectionSet() returning PRO_TK_BAD_INPUTS (-2) for HALF section even with manual plan
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:
Does the section name (
sec_name_out) need to already exist in the model before callingProDrawingView2DSectionSet?For HALF sections, does the plane selection need to be from the model window rather than the drawing?
Is there any additional requirement (like creating the section definition first) before applying a half section?
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)
