api_edge_pattern
List of: Functions
Subjects: Patterns
Contents: Kernel

Action: Creates a pattern parallel to an edge.

Prototype: outcome api_edge_pattern (


pattern*& pat, // created pattern


COEDGE* in_coedge, // coedge


int number, // number of elements


const SPAposition& root, // start position


logical on_endpoints // extend to endpoints



= FALSE, // or not


const SPAvector& normal_dir// use normal to



=*(SPAvector*)NULL_REF,// edge face


const SPAvector& tangent_dir// for rail law



=*(SPAvector*)NULL_REF,


AcisOptions* ao = NULL // acis options


);


outcome api_edge_pattern (


pattern*& pat, // created pattern


EDGE* in_edge, // edge


FACE* in_face, // face


int number, // number of elements


const SPAposition& root, // start position


logical on_endpoints // extend to endpoints



= FALSE, // or not


const SPAvector& normal_dir// use normal to



=*(SPAvector*)NULL_REF,// edge face


const SPAvector& tangent_dir// for rail law



=*(SPAvector*)NULL_REF,


AcisOptions* ao = NULL // acis options


);


outcome api_edge_pattern (


pattern*& pat, // created pattern


EDGE* in_edge, // edge


int number, // number of elements


const SPAposition& root, // start position


logical on_endpoints // extend to endpoints



= FALSE, // or not


const SPAvector& rail_dir// for rail law



=*(SPAvector*)NULL_REF,


const SPAvector& tangent_dir// for rail law



=*(SPAvector*)NULL_REF,


AcisOptions* ao = NULL // acis options


);

Includes: #include "kernel/acis.hxx"

#include "baseutil/logical.h"

#include "baseutil/vector/position.hxx"

#include "baseutil/vector/vector.hxx"

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

#include "kernel/kerndata/top/coedge.hxx"

#include "kernel/kerndata/top/edge.hxx"

#include "kernel/kerndata/top/face.hxx"

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

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

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

Description: Creates a one-dimensional pattern of number elements, equally spaced in parameter space, parallel to the edge or coedge specified by the in_edge or in_coedge argument. 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, the orientations of pattern members are identical. If in_edge alone is given, they will instead follow the edge's rail law if rail_dir and tangent_dir are specified; if in_face is also furnished, or if in_coedge is specified instead, they will follow the normal to the edge's face if normal_dir and tangent_dir are given.


The following code snippet shows an example of how this API can be used.


// Create a spline edge

EDGE* edge = NULL;

SPAposition pts[7];

pts[0] = SPAposition(0, 0, 0);

pts[1] = SPAposition(10, 5, 0);

pts[2] = SPAposition(20, 2, 0);

pts[3] = SPAposition(30, 8, 0);

pts[4] = SPAposition(40, 2, 0);

pts[5] = SPAposition(50, 5, 0);

pts[6] = SPAposition(60, 0, 0);

SPAunit_vector dir_start(0, 1, 0);

SPAunit_vector dir_end(0, -1, 0);

check_outcome(result = api_curve_spline(7, pts,



&dir_start, &dir_end, edge));


// Create a pattern

pattern* pat = NULL;

int number = 20;

SPAposition root(0, 0, 0);

check_outcome(result = api_edge_pattern(pat, edge,



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 normal (or rail) direction was specified without specifying a tangent direction, or a NULL entity was specified.

Library: kernel

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

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