Holdline Blending Sample


This section contains snippets of C++ code to illustrate how to use the API, api_blend_holdline to perform blending using a holdline. These snippets are designed to be very simple starting points for developing your own code - they are not complete, compiling and runtime programs.

// Define some variables.

BODY *b1 = NULL, *b2 = NULL;
ENTITY_LIST edges_to_blend, hl_edge, tmp;
double* ray_params = NULL;
EDGE *holdline_edge;

// Build some geometry to blend.
// Make a block.

check_outcome(result = api_make_cuboid (50,50,10, b1));

// Make a cylinder that intersects the block.

check_outcome(result = api_make_frustum(50, 5, 5, 5, b2));

// Rotate the cylinder a little.

check_outcome(result = api_apply_transf(b2, rotate_transf(.349, SPAvector(1,0,0))));

// Unite the cylinder and block.

check_outcome(result = api_unite( b2, b1 ));

// Pick the edge where the cylinder intersects the block. This edge will be blended.

check_outcome( result = api_get_ents(SPAposition(0,0,5), SPAunit_vector(-1,0,0),
                                                            0.01, EDGE_TYPE, b1, tmp, ray_params));

// Make the list of edges to blend (just one in this case).

edges_to_blend.add(tmp.next());

// Define the center of the holdline curve.

SPAposition center(0,-1.819,5);

// Make a circular edge for the holdline.

check_outcome(result = api_curve_arc(center, 10, -M_PI, M_PI, holdline_edge));

// Add the holdline edge to an entity list.

hl_edge.add(holdline_edge);

// Call the API to blend using the holdline.

api_blend_holdline(edges_to_blend, hl_edge);

// Clean up memory as necessary

[Top]