api_curve_pattern
List of: Functions
Subjects: Patterns
Contents: Kernel

Action: Creates a pattern parallel to a curve.

Prototype: outcome api_curve_pattern (


pattern*& pat, // pattern returned


const curve& in_curve, // guiding curve


const SPAinterval& param_range, // range


int num_elements, // number of elements




// in the pattern


const SPAposition& root, // position mapped




// to the pattern sites


logical on_endpoints // flag for beginning and



= FALSE, // ending on endpoints


law* rail_law // rail law



= NULL, // to follow


const SPAvector& rail_dir// direction mapped



=*(SPAvector*)NULL_REF,// to rail direction


const SPAvector& tangent_dir// direction mapped



=*(SPAvector*)NULL_REF,// to tangent




// direction


const SPAtransf& in_trans// check for



=*(SPAtransf*)NULL_REF,// transform


AcisOptions* ao = NULL // acis options


);

Includes: #include "kernel/acis.hxx"

#include "baseutil/logical.h"

#include "baseutil/vector/interval.hxx"

#include "baseutil/vector/position.hxx"

#include "baseutil/vector/transf.hxx"

#include "baseutil/vector/vector.hxx"

#include "kernel/kernapi/api/api.hxx"

#include "kernel/kerngeom/curve/curdef.hxx"

#include "kernel/kernutil/law/pattern.hxx"

#include "kernel/kernutil/law/pattern_api.hxx"

#include "lawutil/law_base.hxx"

#include "kernel/kernapi/api/acis_options.hxx"

Description: Creates a one-dimensional pattern of number 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_curve_pattern(pat, crv,




param_range, number, root));


// Create a prism

BODY* prism = NULL;

double height = 1.0;

double maj_rad = 1.0;

double min_rad = 0.5;

int num_sides = 3;

check_outcome(result = api_make_prism(height, maj_rad, min_rad, num_sides, prism));


// Apply the pattern to the prism

check_outcome(result = api_set_entity_pattern(prism, pat));


// Clean up

pat->remove();

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.

Library: kernel

Filename: kern/kernel/kernutil/law/pattern_api.hxx

Effect: Changes model
PDF/KERN/16FNA.PDF
HTM/DATA/KERN/KERN/16FNA/0027.HTM