Home > User Guide > Modeling Operations > Surfacing Techniques > Sweeping
C++ Examples Using Sweeping
This section includes examples to help you get started working with sweeping. These examples show first how to call the sweep API function doing a simple extrude, and then an example for how to use the sweep options to perform more complicated sweeping operations. The examples are C++ code snippets for illustrating how to use the functionality. They are not intended to be complete, compilable, or runnable programs.
Using Function api_sweep_with_options
Assume a planar FACE named prof, to be used as the profile for the sweep. Define the objects for the API arguments:
sweep_options *options = ACIS_NEW sweep_options();
BODY *new_body = NULL;Specify the path as a SPAvector:
SPAvector path_dir(&,&,&); The call to the sweeping functionality can be performed with the following:
outcome result = api_sweep_with_options(prof,path_dir,options,new_body); The profile sent into the sweep determines how the resulting body is returned. One way to handle the behavior is to check if the new_body argument is NULL. If it is not NULL, it is the result of the sweep, otherwise the owner of the profile is the result of the sweep.
ENTITY *sweep_result = NULL;
if(new_body)
{
sweep_result = new_body;
}
else
{
check_outcome( api_get_owner(prof,sweep_result));
}Using the Sweep Options
Suppose you have a wire-body profile, an EDGE path, and a BODY new_body. There is also an e-shaped BODY ebody, that the sweep will intersect. The following example sets a few options to demonstrate how selective booleans can be used with sweeping.
sweep_options *options = ACIS_NEW sweep_options();
options->set_sweep_to_body(ebody);
options->set_bool_type(LIMIT);
char keep_str[11] = "X<2 OR X=Y";
law *keep_law = NULL;
check_outcome(api_str_to_law(keep_str,&keep_law));
options->set_keep_law(keep_law);
outcome result = api_sweep_with_options(profile,path,options,new_body);[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.