THIKEN   

Equivalent PK functions: PK_BODY_thicken

THIKEN ( body, front, back, check, tol, mxflts, oldtop, newtop, badtag, state, 
===============================================================================
         ifail )
         =======

  Thickens a sheet body into a solid

Receives:
  KI_tag_body              *body           --- body to be thickened
 <KI_dbl>                  *front          --- thickness on front of faces
 <KI_dbl>                  *back           --- thickness on back of faces
  KI_cod_logical           *check          --- level of checking required
 <KI_dbl_distance>         *tol            --- tol of SP curve conversions
 <KI_int_nitems>           *mxflts         --- maximum number of entities in badtag

Returns:
 <KI_tag_list_entity>      *oldtop         --- original topology
 <KI_tag_list_entity>      *newtop         --- new topology
 <KI_tag_list_entity>      *badtag         --- entities which caused problems
  KI_cod_rtof              *state          --- state of body after offset
  KI_cod_error             *ifail          --- failure code

Specific errors:
  KI_cant_thicken           thickening failure
  KI_unsuitable_entity      Mixed body
  KI_bad_tolerance          proposed edge tolerance is too small
  KI_not_sheet              body is not sheet
  KI_bad_thickness          total thickness zero

Description:
  The sheet 'body' is thickened by 'front' outwards (i.e. in the direction of
  the face normal) and 'back' inwards.  Either 'front' or 'back' may be
  negative, but the total thickness must be non-zero.

  Only manifold sheet bodies can be thickened.

  Some edge geometry on the sheet boundary may have to be approximated by
  SP-curves in order to generate a boundary curve on the offset faces. If this
  is necessary, such edges will have a tolerance less than or equal to the
  tolerance supplied through the 'tol' argument.

  Two situations can give rise to changes in the topology :

      1) Dealing with geometry which fails to offset. If it is known that the
         offset surface of a face would be self-intersecting an attemp is made
         to remove the face. For example, a blend may be removed from an edge.
         The investigation of self-intersection is not exhaustive, however,
         and it can occur that instances are not trapped.

      2) Dealing with configurations which can be repaired. For instance an
         edge may offset to a point or a face become absorbed into the body.

  The extent to which cheking is applied to the body is specified by the
  'check' argument. If 'check' is true then face-face checks are done on
  the body  in addition to default checks. For most applications setting
  'check' false will give an adequate level of checking.

  Thickening which would lead to a self-intersecting or non-manifold solid is
  not allowed. Some of these cases will not be detected when face-face checks
  are not done, in this case the resulting body will be invalid.

  Boundary edges with the following curves on these surfaces will be treated
  exactly :

      Surface           | Curve
      -----------------------------------------
      Plane             | Line, Circle, Ellipse or B-curve
      Cylinder          | Line, Circle or B-curve equivalent
      Cone              | Line, Circle or B-curve equivalent
      Sphere            | Circle
      Torus             | Circle
      Swept Surface or  | Line, Profile curve or B-curve equivalent
      B-surface equiv   |
      Spun Surface or   | Circle, Profile curve or B-curve equivalent
      B-surface equiv   |

  Thickening only handles the cases where each vertex on the boundary of the
  sheet meets one of the following requirements.  Either the vertex is smooth
  (surface normals constant on all adjoining faces) or both adjoining boundary
  edges must have curves of the types treated exactly (see table above) or the
  thickening is into the angle of the edge (i.e. convex edges inwards only and
  concave edges outwards only).

  Each new face in the resulting body will have been generated by either
  a face, an exterior edge or vertex in the original sheet. The pairs of
  original faces, edges or vertices and corresponding new faces are
  returned in the 'oldtop' and 'newtop' arguments. Both lists may
  contain null tags where faces have vanished. If the total thickness is
  positive the tag of a face in the original body will remain on the
  front of the resulting body with the same sense otherwise it will be
  on the back with the opposite sense.
  The error reporting scheme comprises the three arguments 'badtag', 'state'
  and 'ifail'. A non-zero 'ifail' is reserved for reporting unsuitable arguments
  to the function and system errors.

  Algorithmic failures where the item causing the failure can be identified
  result in a zero 'ifail' and more specific information being returned in the
  'state' argument and 'badtag'. For example, a thickness so large that any of
  the surfaces could not be offset will return 'state' RTOFSO and the tags of
  faces whose surfaces could not be offset in the 'badtag' list.

  'state' refers to the validity of the item after modification and not to its
  original validity. After such a failure 'body' may be corrupt and a rollback
  should be performed.  For this reason tags of new topology cannot be returned
  in 'badtag' and the tags will refer to adjacent faces in the original body
  supplied. For example if a new edge cannot be modified a 'state' RTOFEM is
  returned and 'badtag' will contain the tag of a list of the two faces whose
  offsets are to be used to find the new curve.

  Possible values of 'state' and the contents of 'badtag' are :

      Token  | Tag(s) in  |     Meaning
             | badtag     |
      -------|------------|-----------------------------------
      RTOFOK | null       | Body is OK
      RTOFSO | face(s)    | Surface failed to offset or face could not be deleted
      RTOFVM | vertex     | Failed to find new geometry for vertex
             | list faces | Failed to find geometry for new vertex
      RTOFEM | edge       | Failed to find new geometry for edge
             | list faces | Failed to find geometry for new edge
      RTOFSS | edge       | Failed to find side surface
      RTOFSC | vertex     | Failed to find side curve
      RTOFVT | edge       | Edge should have disappeared
      RTOFFA | face       | Face failed checks
      RTOFSX | faces      | Face-face inconsistency found

  Notice that a successful execution of the thickening operation is indicated
  by :

        ifail returning KI_no_errors
        state returning RTOFOK