api_surface_pattern
List of: Functions
Subjects: Patterns
Contents: Kernel

Action: Creates a pattern parallel to a surface.

Prototype: outcome api_surface_pattern (


pattern*& pat, // created pattern


FACE* in_face, // guide face


int num_u, // u-direction elements


int num_v, // v-direction elements


const SPAposition& root, // position mapped




// to the pattern sites


logical on_boundary // flag to begin and end



= FALSE, // on face boundary


const SPAvector& u_dir // direction mapped to



=*(SPAvector*)NULL_REF,// u-direction


const SPAvector& v_dir // direction mapped to



=*(SPAvector*)NULL_REF,// v-direction


AcisOptions* ao = NULL // acis options


);


outcome api_surface_pattern (


pattern*& pat, // created pattern


const surface& in_surf, // guide surface


const SPApar_box& face_range,// range of surface


int num_u, // u-direction elements


int num_v, // v-direction elements


const SPAposition& root, // position mapped




// to the pattern sites


logical on_boundary // flag to begin and end



= FALSE, // on face boundary


const SPAvector& u_dir // direction mapped to



=*(SPAvector*)NULL_REF,// u-direction


const SPAvector& v_dir // direction mapped to



=*(SPAvector*)NULL_REF,// v-direction


const SPAtransf& in_trans// input



=*(SPAtransf*)NULL_REF,// transform


AcisOptions* ao = NULL // acis options


);

Includes: #include "kernel/acis.hxx"

#include "baseutil/logical.h"

#include "baseutil/vector/param.hxx"

#include "baseutil/vector/position.hxx"

#include "baseutil/vector/transf.hxx"

#include "baseutil/vector/vector.hxx"

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

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

#include "kernel/kerngeom/surface/surdef.hxx"

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

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

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

Description: Creates a two-dimensional pattern of num_u by num_v elements, equally spaced in parameter space, upon the surface and parameter range indicated either by in_surf and param_range or by in_face. 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 face boundary by setting on_boundary to TRUE. By default, pattern members are oriented identically to one another, but will follow the surface normal if u_dir and v_dir are given. In that case, these vectors specify the directions, relative to the seed entity, that are mapped to the u- and v-directions of the face.


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


// Create a hemispherical surface

FACE* face = NULL;

SPAposition origin(0, 0, 0);

double radius = 20.0;

double lo_start = 0.0;

double lo_end = 90.0;

double la_start = -360.0;

double la_end = 360.0;

SPAvector normal(0, 1, 1);

check_outcome(result = api_face_sphere(origin, radius, lo_start, lo_end, la_start, la_end, &normal, face));

const surface& surf = face->geometry()->equation();

SPApar_box param_range;

sg_get_face_par_box(face, param_range);


// Create a pattern

pattern* pat = NULL;

int u_num = 8;

int v_num = 6;

SPAposition root(0, 0, 0);

check_outcome(result = api_surface_pattern(pat, surf, param_range, u_num, v_num, 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(face));

Errors: The number of u- or v-values is less than one, or u_dir is specified without specifying v_dir (or vice-versa), or a NULL face is given.

Library: kernel

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

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