(* Genenerated from: ../../irs/wg12n548.exp *)

SCHEMA shape_tolerance_schema;
REFERENCE FROM product_property_definition_schema
    (shape_aspect,
     shape_aspect_relationship);
REFERENCE FROM measure_schema
   (derive_dimensional_exponents,
    dimensional_exponents,
    measure_with_unit,
    measure_value);
REFERENCE FROM representation_schema
    (representation);
REFERENCE FROM support_resource_schema
    (label,
     text);
REFERENCE FROM shape_aspect_definition_schema
    (datum_reference,
     limit_condition);
REFERENCE FROM shape_dimension_schema
    (dimensional_characteristic,
     dimensional_location);

TYPE tolerance_method_definition = SELECT
  (tolerance_value,
   limits_and_fits);
END_TYPE;

TYPE  shape_tolerance_select = SELECT
     (geometric_tolerance,
      plus_minus_tolerance);
END_TYPE;

ENTITY dimension_related_tolerance_zone_element;
  related_dimension : dimensional_location; 
  related_element   : tolerance_zone_definition;
END_ENTITY;

ENTITY geometric_tolerance;
  name                    : label;
  description             : text;
  magnitude               : measure_with_unit; 
  toleranced_shape_aspect : shape_aspect; 
WHERE
  WR1: ('NUMBER' IN TYPEOF
       (magnitude\measure_with_unit.value_component)) AND
       (magnitude\measure_with_unit.value_component >= 0.0);
END_ENTITY;

ENTITY geometric_tolerance_relationship;
                                   name                         :label;
                                   description                  :text;
                                   relating_geometric_tolerance : geometric_tolerance; 
                                   related_geometric_tolerance  : geometric_tolerance; 
END_ENTITY;

ENTITY geometric_tolerance_with_datum_reference
   SUBTYPE OF (geometric_tolerance);
   datum_system : SET [1:?] OF  datum_reference;
END_ENTITY;

ENTITY geometric_tolerance_with_defined_unit
  SUBTYPE OF (geometric_tolerance);
  unit_size : measure_with_unit;
WHERE
  WR1: ('NUMBER' IN TYPEOF
       (unit_size\measure_with_unit.value_component)) AND
       (unit_size\measure_with_unit.value_component > 0.0);
END_ENTITY;

ENTITY modified_geometric_tolerance
  SUBTYPE OF (geometric_tolerance);
  modifier : limit_condition;
END_ENTITY;

ENTITY projected_zone_definition 
  SUBTYPE OF (tolerance_zone_definition);  
  projection_end   : shape_aspect; 
  projected_length : measure_with_unit;
WHERE 
  WR1: ('NUMBER' IN TYPEOF
       (projected_length\measure_with_unit.value_component)) AND
       (projected_length\measure_with_unit.value_component > 0.0);
  WR2: (derive_dimensional_exponents
       (projected_length\measure_with_unit.unit_component)=
        dimensional_exponents(1,0,0,0,0,0,0));
END_ENTITY;

ENTITY runout_zone_definition
  SUBTYPE OF (tolerance_zone_definition); 
  orientation  : runout_zone_orientation;
END_ENTITY;

ENTITY runout_zone_orientation;
  angle : measure_with_unit;
END_ENTITY;

ENTITY runout_zone_orientation_reference_direction
  SUBTYPE OF (runout_zone_orientation); 
  orientation_defining_relationship: shape_aspect_relationship;
END_ENTITY;

ENTITY statistical_distribution_for_tolerance
  SUBTYPE OF (representation);
WHERE
  WR1: SIZEOF (QUERY (item <* SELF\representation.items |
       NOT ('QUALIFIED_MEASURE_SCHEMA.MEASURE_REPRESENTATION_ITEM' 
       IN TYPEOF (item)))) = 0;
END_ENTITY;

ENTITY tolerance_with_statistical_distribution;
   associated_tolerance : shape_tolerance_select;
   tolerance_allocation : statistical_distribution_for_tolerance;
END_ENTITY;

ENTITY tolerance_zone
  SUBTYPE OF (shape_aspect);
  defining_tolerance : SET [1:?] OF geometric_tolerance; 
  form               : tolerance_zone_form;
END_ENTITY;

ENTITY tolerance_zone_form;
  name : label;
END_ENTITY;

ENTITY tolerance_zone_definition
  SUPERTYPE OF (ONEOF (projected_zone_definition,
                       runout_zone_definition));
  zone : tolerance_zone;
  boundaries: SET [1:?] OF shape_aspect;
END_ENTITY;

ENTITY limits_and_fits;
  form_variance   : label;
  zone_variance   : label;
  grade           : label;
  source          : text;
END_ENTITY;

ENTITY  plus_minus_tolerance;
  range                : tolerance_method_definition; 
  toleranced_dimension : dimensional_characteristic;
UNIQUE
  UR1: toleranced_dimension;
END_ENTITY;

ENTITY tolerance_value; 
   lower_bound : measure_with_unit; 
   upper_bound : measure_with_unit;
 DERIVE
  a : REAL := upper_bound\measure_with_unit.value_component;
  b : REAL := lower_bound\measure_with_unit.value_component;
 WHERE 
   WR1: a > b;  
   WR2: upper_bound\measure_with_unit.unit_component =
        lower_bound\measure_with_unit.unit_component;
END_ENTITY;

END_SCHEMA;   -- End of shape_tolerance_schema
