All Frameworks  Class Hierarchy  This Framework  Indexes

SPAkern Global Function api_pattern_create_on_curve


outcome api_pattern_create_on_curve(pattern*& pat,
const curve& in_curve,
const SPAinterval& param_range,
int num_elements,
const SPAposition& root,
logical on_endpoints= FALSE,
law* rail_law= NULL,
const SPAvector& rail_dir= *(SPAvector*)NULL_REF,
const SPAvector& tangent_dir= *(SPAvector*)NULL_REF,
const SPAtransf& in_trans= *(SPAtransf*)NULL_REF,
AcisOptions* ao= NULL)
Creates a pattern parallel to a curve.

Role: Creates a one-dimensional pattern of num_elements elements, equally spaced in parameter space, along the curve specified by the in_curve argument, over the interval given by param_range. The argument root specifies the position (which can be on or off the pattern seed entity, as desired) to be mapped to the pattern sites. The pattern can be extended to the endpoints of the edge by setting on_endpoints to TRUE. By default, pattern members are oriented identically to one another. They will follow a rail law if rail_law is provided. In that case, the vectors rail_dir and tangent_dir specify the directions, relative to the seed entity, that are mapped to the rail law and tangent directions of the edge.

The following code snippet gives an example of using this API.
 // Create a spiral curve
 EDGE* edge = NULL;
 SPAposition center(0, 0, 0);
 SPAvector normal(0, 0, 1);
 SPAposition start_position(3, 0, 0);
 double width = 3.0;
 double angle = 6.0 * M_PI;
 check_outcome(result = api_edge_spiral(center, normal,
     start_position, width, angle, edge));
 const curve& crv = edge->geometry()->equation();
 SPAinterval param_range = edge->param_range();
 
 if (edge->sense() == REVERSED)
     param_range.negate();

 // Create a pattern
 pattern* pat = NULL;
 int number = 36;
 SPAposition root(0, 0, 0);
 check_outcome(result = api_pattern_create_on_curve(pat, crv, 
     param_range, number, root));

 // Create a prism
 double height = 1.0;
 double maj_rad = 1.0;
 double min_rad = 0.5;
 int num_sides = 3;
 BODY* prism = NULL;
 check_outcome(result = api_make_prism(height, maj_rad, 
     min_rad, num_sides, prism));

 // Apply the pattern to the prism
 check_outcome(result = api_pattern_apply_to_entity(prism, pat));

 // Clean up
 check_outcome(result = api_pattern_destroy(pat));
 check_outcome(result = api_del_entity(edge));
Errors: The number of elements is less than one, or the rail direction was specified without specifying a tangent direction.

Effect: Changes model.

Journal: Not Available

Parameters:
pat
pattern returned.
in_curve
guiding curve.
param_range
range.
num_elements
number of elements in the pattern.
root
position mapped to the pattern sites.
on_endpoints
flag for beginning and ending on endpoints.
rail_law
rail law to follow.
rail_dir
direction mapped to rail direction.
tangent_dir
direction mapped to tangent direction.
in_trans
check for transform.
ao
acis options.

This object is included in the file: pattern_api.hxx

Copyright (c) 1989-2007 by Spatial Corp. All rights reserved.