Sweeping Basics
List of: Discussion Topic
Subjects: Sweeping
Contents: Sweeping

The function api_sweep_with_options and the associated Scheme extension sweep:law encompass the sweeping functionality.

The api_sweep_with_options function is used to simplify sweeping in C++. Various options to control sweeping may be specified through the sweep_options class and the associated Scheme extension sweep:options. The function api_sweep_with_options has four overloaded instances:

Sweep along a path The API arguments are: profile, a pointer to a path entity, sweep options, and a pointer to the new body (if applicable).

Sweep a distance The API arguments are: profile, distance (in the direction of the profile face normal), sweep options, and a pointer to the new body (if applicable).

Sweep along a vector The API arguments are: profile, vector (to sweep along), sweep options, and a pointer to the new body (if applicable).

Sweep around an axis The API arguments are: profile, position (of the root of the sweep axis), vector (of the direction of the sweep axis), sweep options, and a pointer to the new body (if applicable).

The first argument to the api_sweep_with_options function is a profile in the form of a pointer to an entity. For example, an edge, a wire body, a face, or a planar sheet body with nonadjacent faces, which may or may not belong to a body, could form the sweeping profile.

The next argument is a path. The path may take the form of an EDGE or WIREBODY pointer. The path may be specified as a distance if the profile is a planar face or a planar sheet body with non-adjacent faces. A vector or an axis to sweep around (in the form of a position and a vector) may also be provided as the path. However, defining vector or axis as paths requires the use of the default rail law (without twist).

All other inputs are passed to the API through an instance of the sweep_options class. The sweep options are explained in detail in the next section.

The returned body depends on the profile type:

Face belonging to a body When the profile is a face that belongs to a body, that owning body is altered, and the new body points to NULL.

Face not belonging to a body When the profile is a face not already belonging to a body, a new body is created and returned. The original face remains separate and available for further independent manipulation or deletion.

Wire body When the profile is a wire body, the owning body is altered and the new body points to NULL. The altered body can be a solid or a sheet body depending on whether or not the option to make a solid has been set, and whether or not the wire body is closed. It is not necessary or desirable to cover the wires. The default is to make a solid if the wire body is closed.

Edge not belonging to a body When the profile is an edge or set of independent edges, a new body is created. The original edge remains available for further independent manipulation or deletion. If the edge is closed, by default it makes a solid body; otherwise it makes a sheet body. It is not necessary or desired that the edges be covered.

Locating the profile at the beginning of the sweep path is not always practical and is not a requirement when using sweeping. The profile's location is determined in the following manner:

Planar profile The profile is located at the nearest intersection point on the path, within the profile plane.

Linear profile The profile is always located at the beginning of the path.

The plane of the profile must intersect the path in the intended location. If the plane of the profile does not intersect the path at all, the relationship is ambiguous and sweeping may not complete, or may create unintended results. If the plane of the profile intersects the path at an unintended location, this location is used in determining the relationship of profile and the path.

These rules work well when the profile is perpendicular to the path. However, if the given profile is not perpendicular to the path, the path location may not be unique. Applications should move the profile to the beginning of the path and use the AS_IS argument for the portion sweep option.

The most basic sweep activities are sweeping a planar face, a solid face, a wire, along a path or vector, and revolving a face or wire body. The following examples demonstrate those capabilities.
PDF/SWP/01CMP.PDF
HTM/DATA/SWP/SWP/01CMP/0001.HTM