Skip to main content
10-Marble
February 16, 2026
Solved

Regarding Toolkit ProDrawingViewDetailCreate and ProDrawingViewPartialVisibleAreaGet APIs cr

  • February 16, 2026
  • 2 replies
  • 163 views

Hi everyone,

I’m working with Creo 11 and trying to use the APIs ProDrawingViewDetailCreate and ProDrawingViewPartialVisibleAreaGet, both of which require a ref_point of type ProSelection. I’m facing consistent β€œbad input” errors and would appreciate any guidance from someone who has successfully implemented these.

Here’s what I’ve tried so far:

Method 1: Programmatic datum point creation

  • Created a datum point β†’ Success

  • Used ProPointInit β†’ Success

  • Converted using ProPointToGeomitem and Modelitem APIs β†’ Success

  • Attempted ProSelectionAlloc() β†’ Failed to return a valid ProSelection

Method 2: Manual selection approach

  • Created a datum point

  • Selected the point using ProSelection β†’ Success

  • Passed this selection to ProDrawingViewDetailCreate & ProDrawingViewPartialVisibleAreaGet β†’ Both failed with β€œbad inputs”

Method 3: Drawing entity approach

  • Created a point in the drawing using ProDtlEntityCreate

  • Used ProSelectionAlloc() β†’ Success

  • Passed it to ProDrawingViewDetailCreate & ProDrawingViewPartialVisibleAreaGet β†’ Still getting β€œbad input” errors

At this point, I suspect I might be missing something about the expected reference context (model space vs drawing space selection, view ownership, or selection type).

Has anyone successfully passed a valid ref_point selection to these APIs in Creo 11? Any example workflow or clarification on what kind of ProSelection these functions strictly expect would be really helpful.

Thanks in advance!

Best answer by VP_14440689

Hello sir, 
I got the source code from community post and it worked, you were right the real challenge was to get the Curvedata i.e to create the spline

from this code its very clear now and now I am able to deal with all those APIs who need Curedata.
Thank you so much for your time and help.

Link - https://community.ptc.com/t5/Customization/Regarding-Toolkit-ProDrawingViewDetailCreate-and/m-p/1055064

 

2 replies

18-Opal
February 16, 2026

Not a datum, it is just the placement/reference point

set x and y with

ProSelectionPoint3dSet( ProPoint3d point, ProSelection *p_prosel);

Just my 2 Cents πŸ§πŸ˜‚πŸ˜‰

10-Marble
February 17, 2026

Hi, I tried it again but it didn't worked out 😞

I tried your approach of using ProSelectionPoint3dSet() to create the reference point, but in my case it didn’t work and Creo actually crashed when I proceeded with ProDrawingViewDetailCreate(). So I wanted to share what I tested and the behavior I observed.

I am working completely inside a drawing. First I get the current model and create a general view successfully. Then I pick an edge from the drawing view using:

ProSelect("edge", 1, NULL, NULL, NULL, NULL, &sel_array, &n_sel);

From that selection I extract the picked location using:

ProSelectionPoint3dGet(sel_array[0], pt);

This part works fine and I can log the coordinates:
Edge picked at -> X: 10.104 Y: 11.086 Z: 1.000

Then I get the parent view from the selection and transform the point from view space to drawing space using:

  • ProSelectionViewGet()

  • ProDrawingViewTransformGet(..., PRO_B_TRUE, ...)

  • ProPntTrfEval()

After that I use the transformed point to create the circle boundary (ProArcdataInit) and that part also succeeds. My log shows:

[Creo Success] ProDrawingViewTransformGet
[Creo Success] ProPointdataInit
[Creo Success] Pick perimeter
[Creo Success] ProArcdataInit

Finally, I call:

ProDrawingViewDetailCreate(
current_drw,
general_view,
sel_array[0], // ref_point
&crv_data,
location,
&detail_view);

At this stage Creo becomes unstable / crashes. When I tried the alternative approach of manually creating a selection and setting a point using ProSelectionPoint3dSet(), it did not behave as a valid reference point for the detail view either.

So in my case, simply setting X and Y using ProSelectionPoint3dSet() on a manually allocated selection did not produce a stable ref_point for ProDrawingViewDetailCreate(). Using the actual picked selection from the drawing view seems closer to correct, but I’m still hitting a failure/crash at the detail creation step.

If you have a minimal working snippet where ProSelectionPoint3dSet() alone is enough for a detail view ref_point (in a drawing context), I’d really appreciate seeing how that selection is constructed and what object you allocate it against.

here is the code 

 // Get current model
 ProMdl current_mdl;
 ProError status = ProMdlCurrentGet(&current_mdl);
 if (status != PRO_TK_NO_ERROR) {
 log_info("WARNING: No model open. Please open a drawing.");
 return 0;
 }

 log_info("The Model handle is built successfully.");

 // Log model name
 ProMdlName mdl_name;
 ProMdlMdlnameGet(current_mdl, mdl_name);
 char mdl_name_str[PRO_MDLNAME_SIZE];
 ProWstringToString(mdl_name_str, mdl_name);
 log_info("The name of the model is: " + string(mdl_name_str));

 ProDrawing current_drw = (ProDrawing)current_mdl;
 ProSolid drw_solid_mdl;
 ProDrawingCurrentsolidGet(current_drw, &drw_solid_mdl);

 int sheet_id;
 ProDrawingCurrentSheetGet(current_drw, &sheet_id);



 // Bounding box for spacing
 Pro3dPnt bbox[2];
 ProSolidOutlineGet(drw_solid_mdl, bbox);

 double model_w = bbox[1][0] - bbox[0][0];
 double model_h = bbox[1][1] - bbox[0][1];

 double scale = 2.0;
 double view_w = model_w / scale;
 double view_h = model_h / scale;

 ProPoint3d general_pos{ 400.00, 500.00 };

 ProMatrix orientation = {
 {1,0,0,0},
 {0,1,0,0},
 {0,0,1,0},
 {0,0,0,1},
 };

 ProView general_view;


 status = ProDrawingGeneralviewCreate(current_drw, drw_solid_mdl, sheet_id, PRO_B_FALSE, general_pos, scale, orientation, &general_view);

 ProSelection* sel_array = NULL;
 int n_sel = 0;
 ProPoint3d pt;

 ProSelect("edge", 1, NULL, NULL, NULL, NULL, &sel_array, &n_sel);

 if (n_sel > 0)
 {
 status = ProSelectionPoint3dGet(sel_array[0], pt);

 char buffer[200];
 sprintf(buffer, "Edge picked at -> X: %.3f Y: %.3f Z: %.3f",
 pt[0], pt[1], pt[2]);

 log_info(buffer);
 ProView view;
 status = ProSelectionViewGet(sel_array[0], &view);

 ProMatrix matrix;
 status = ProDrawingViewTransformGet(
 current_drw,
 view,
 PRO_B_TRUE, // VIEW DRAWING
 matrix);

 visit_items::CheckError(status, "ProDrawingViewTransformGet");

 ProPoint3d sheet_pt;

 ProPntTrfEval(pt, matrix, sheet_pt);
 



 ProPoint3d center_pnt;
 ProMouseButton btn;
 Pro3dPnt perimeter_pnt;
 //center_pnt[0] = pt[0];
 //center_pnt[1] = pt[1];
 //center_pnt[2] = pt[2];

 center_pnt[0] = sheet_pt[0];
 center_pnt[1] = sheet_pt[1];
 center_pnt[2] = 0.0;


 ProCurvedata crv_data;
 status = ProPointdataInit(center_pnt, &crv_data);
 visit_items::CheckError(status, "ProPointdataInit");

 ProDtlentitydata ent_data;
 ProDtlentity entity;

 status = ProDtlentitydataAlloc(current_drw, &ent_data);
 status = ProDtlentitydataCurveSet(ent_data, &crv_data);

 int sheet;
 //ProView view;
 ProDrawingCurrentSheetGet(current_drw, &sheet);
 ProDrawingBackgroundViewGet(current_drw, sheet, &view);
 ProDtlentitydataViewSet(ent_data, view);

 ProDtlentityCreate(current_drw, NULL, ent_data, &entity);
 ProDtlentityDraw(&entity);

 status = ProMousePickGet(PRO_ANY_BUTTON, &btn, perimeter_pnt);
 visit_items::CheckError(status, "Pick perimeter");

 ProVector diff;
 VectorDiff(perimeter_pnt, center_pnt, diff);
 double radius = VectorLength(diff);


 ProVector vector1 = { 1.0, 0.0, 0.0 };
 ProVector vector2 = { 0.0, 1.0, 0.0 };
 double start_angle = 0.0;
 double end_angle = 2 * M_PI;

 status = ProArcdataInit(vector1, vector2, center_pnt,
 start_angle, end_angle, radius,
 &crv_data);
 visit_items::CheckError(status, "ProArcdataInit");

 status = ProDtlentitydataAlloc(current_drw, &ent_data);
 status = ProDtlentitydataCurveSet(ent_data, &crv_data);

 ProDrawingCurrentSheetGet(current_drw, &sheet);
 ProDrawingBackgroundViewGet(current_drw, sheet, &view);
 ProDtlentitydataViewSet(ent_data, view);

 ProDtlentityCreate(current_drw, NULL, ent_data, &entity);
 ProDtlentityDraw(&entity);

 ProDtlentitydataFree(ent_data);


 ProView detail_view;
 ProPoint3d location = { 500, 500, 0 };
 status = ProDrawingViewDetailCreate(
 current_drw,
 view,
 sel_array[0], // ref_point
 &crv_data,
 location,
 &detail_view);

 visit_items::CheckError(status, "ProDrawingViewDetailCreate");
 if (status != PRO_TK_NO_ERROR) {
 return 0;
 
 }
18-Opal
February 17, 2026

The best is to understand the requirements by creating first a detail view manually.

 

For some drawing functions calls it is important that the drawing is active. For your function calls,  the 3D model is already known by the reference view. The tricky part is to automate the view reference and the spline outline.

The view reference point is used to regen the detailed view. As mentioned in the header file. The reference point must be enclosed by the spline. Maybe first create a spline in the drawing, maybe with 4 points, and check the outcome. You can try first to make the spline manually in the drawing, next read and use it in the function call.


The reference point must be a valid 3D model selection, an endpoint of on edge. 

 

From the header file:

The curve_data spline is in world space, and must enclose the reference point (in world space, on the parent view).

 

Not sure if you can use a simple arc, because if I remember you pick an area for what you would like to see later.

 

The location is just a pick point, and may need to transformed from window to drawing coordinates. 

I can’t proof everything by 100% because I’m not in front of a Creo Toolkit SessionπŸ˜‰

 

Not sure if something like this is required.

 

Next: this may required for spline setupπŸ˜΅β€πŸ’« see the header for more details, there are a couple of other functions as well.

*/

extern ProError ProDrawingViewDetailCurvedataSet (ProDrawing drawing, ProView view, ProCurvedata* curve_data);
/*
Purpose: Set spline for detail view parent

Input Arguments:
drawing - Drawing handle
view - The view handle
curve_data - Spline data (see Notes: below)

 

Community Manager
February 23, 2026

Hello @VP_14440689,

 

It looks like you have some responses from a community expert. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.