| Application module: Constructive solid geometry 2D | ISO/TS 10303-1731:2019(E) © ISO | 
         (*
ISO/TC 184/SC 4/WG 12 N9749 - ISO/TS 10303-1731 Constructive solid geometry 2D - EXPRESS MIM
Supersedes 
         ISO/TC 184/SC 4/WG 12 N7973
*)
         
SCHEMA Constructive_solid_geometry_2d_mim;
         USE FROM
         Area_2d_mim;
            -- ISO/TS 10303-1631
         USE FROM
         Basic_curve_mim;
            -- ISO/TS 10303-1651
         USE FROM
         geometric_model_schema   -- ISO 10303-42
  (area_with_outer_boundary,
           
         boolean_result,
           
         bounded_primitive_2d,
           
         csg_solid,
           
         half_space_2d);
         
         USE FROM
         geometry_schema   -- ISO 10303-42
  (composite_curve);
         
         USE FROM
         representation_schema   -- ISO 10303-43
  (compound_representation_item,
           
         mapped_item,
           
         set_representation_item);
         
TYPE boolean_operand_2d =
         
         
         SELECT
            (bounded_primitive_2d, 
    boolean_result_2d);
         END_TYPE; 
         
TYPE compound_inner_area_boundary =
         
         
         SELECT
            (set_inner_area_boundary);
         END_TYPE; 
         
TYPE csg2d_bounded_primitive_2d =
         
         
         SELECT
         BASED_ON
         bounded_primitive_2d
         WITH 
         
            (path_area_with_parameters);
         END_TYPE; 
         
TYPE csg_2d_area_select =
         
         
         SELECT
            (axis2_placement_2d, 
    csg_primitive_solid_2d);
         END_TYPE; 
         
TYPE csg_2d_shape_select =
         
         
         SELECT
            (mapped_item, 
    axis2_placement_2d, 
    csg_solid_2d);
         END_TYPE; 
         
TYPE csg_select_2d =
         
         
         SELECT
            (bounded_primitive_2d, 
    boolean_result_2d);
         END_TYPE; 
         
TYPE set_inner_area_boundary =
         SET[1:?] OF bounded_primitive_2d;
         END_TYPE; 
         
ENTITY boolean_result_2d
           SUBTYPE OF (boolean_result);
           SELF\boolean_result.first_operand : boolean_operand_2d;
           SELF\boolean_result.second_operand : boolean_operand_2d;
         
         END_ENTITY;
ENTITY closed_curve_style_parameters
           SUBTYPE OF (curve_style_parameters_representation);
         
         END_ENTITY;
ENTITY complex_area
           ABSTRACT SUPERTYPE
         
         OF (path_area_with_parameters
                         ANDOR primitive_2d_with_inner_boundary)
           SUBTYPE OF (primitive_2d);
         
         END_ENTITY;
ENTITY csg_2d_shape_representation
           SUBTYPE OF (shape_representation);
           SELF\representation.items : SET[1:?] OF csg_2d_shape_select;
WHERE
           WR1: SELF.context_of_items\geometric_representation_context.coordinate_space_dimension = 2;
           WR2: SIZEOF(QUERY ( it <* SELF.items | 
            (SIZEOF(['GEOMETRIC_MODEL_SCHEMA.CSG_SOLID']
            	   * TYPEOF(it)) = 1) 
            	   OR 
            	   (('REPRESENTATION_SCHEMA.MAPPED_ITEM' 
            	   IN TYPEOF(it)) AND
            	   ('CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.' +
            	   'CSG_2D_SHAPE_REPRESENTATION' 
            	   IN TYPEOF(it\mapped_item.mapping_source.mapped_representation))) 
            )) >= 1;
           WR3: SIZEOF(QUERY ( it <* SELF.items | 
            (('REPRESENTATION_SCHEMA.MAPPED_ITEM' 
            IN TYPEOF(it)) AND (NOT (( 
            'CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.' +
            'CSG_2D_SHAPE_REPRESENTATION') 
            IN TYPEOF(it\mapped_item.mapping_source.mapped_representation)))) )) = 0;
         
         END_ENTITY;
ENTITY csg_primitive_solid_2d
           SUBTYPE OF (csg_solid_2d);
           SELF\csg_solid.tree_root_expression : bounded_primitive_2d;
         
         END_ENTITY;
ENTITY csg_solid_2d
           SUBTYPE OF (csg_solid);
           SELF\csg_solid.tree_root_expression : csg_select_2d;
WHERE
           WR1: valid_csg_2d_primitives(SELF);
         
         END_ENTITY;
ENTITY curve_style_parameters_representation
           SUBTYPE OF (representation);
         
         END_ENTITY;
ENTITY curve_style_parameters_with_ends
           SUBTYPE OF (curve_style_parameters_representation);
         
         END_ENTITY;
ENTITY path_area_with_parameters
           SUBTYPE OF (complex_area, mapped_item);
WHERE
           WR1: 'GEOMETRY_SCHEMA.CURVE' IN TYPEOF(SELF\mapped_item.mapping_target);
           WR2: 'CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.CURVE_STYLE_PARAMETERS_REPRESENTATION' IN TYPEOF(SELF\mapped_item.mapping_source\representation_map.mapped_representation);
           WR3: SELF\mapped_item.mapping_source\representation_map.mapping_origin\representation_item.name = 'curve width';
         
         END_ENTITY;
ENTITY primitive_2d_with_inner_boundary
           SUBTYPE OF (complex_area, compound_representation_item);
           SELF\compound_representation_item.item_element RENAMED inner_boundary : compound_inner_area_boundary;
WHERE
           WR1: SIZEOF(['GEOMETRIC_MODEL_SCHEMA.CIRCULAR_AREA', 
            'GEOMETRIC_MODEL_SCHEMA.ELLIPTIC_AREA', 
            'GEOMETRIC_MODEL_SCHEMA.RECTANGULAR_AREA',
            'GEOMETRIC_MODEL_SCHEMA.POLYGONAL_AREA', 
            'GEOMETRIC_MODEL_SCHEMA.AREA_WITH_OUTER_BOUNDARY', 
            'CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.PATH_AREA_WITH_PARAMETERS'] * TYPEOF(SELF)) > 0;
           WR2: SIZEOF(QUERY(inner <* inner_boundary |
            'CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.PRIMITIVE_2D_WITH_INNER_BOUNDARY' IN TYPEOF(inner))) = 0;
           WR3: open_path_based_inner_boundary(inner_boundary);
         
         END_ENTITY;
ENTITY single_area_csg_2d_shape_representation
           SUBTYPE OF (csg_2d_shape_representation);
           SELF\representation.items : SET[1:?] OF csg_2d_area_select;
WHERE
           WR1: SIZEOF (QUERY (it <* SELF.items| 
            ('CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.MAPPED_ITEM' 
            IN TYPEOF(it)) )) = 0;
           WR2: SIZEOF (QUERY (it <* SELF.items| 
            ('CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.CSG_SOLID_2D' 
            IN TYPEOF(it)) )) = 1;
         
         END_ENTITY;
ENTITY single_boundary_csg_2d_shape_representation
           SUBTYPE OF (single_area_csg_2d_shape_representation);
WHERE
           WR1: SIZEOF(QUERY ( it <* SELF.items |
            (('CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.CSG_PRIMITIVE_SOLID_2D' IN TYPEOF(it))
            AND (('CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.PRIMITIVE_2D_WITH_INNER_BOUNDARY') IN
            TYPEOF(it\csg_primitive_solid_2d.tree_root_expression))) )) = 0;
         
         END_ENTITY;
FUNCTION open_path_based_inner_boundary
 (input : SET[0:?] OF primitive_2d) : BOOLEAN;
         LOCAL
   pass : BOOLEAN := TRUE;
  END_LOCAL;
  REPEAT i := 1 TO SIZEOF(input);
      IF ('CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.PATH_AREA_WITH_PARAMETERS' IN TYPEOF(input[i]))
        AND ( 
         ('GEOMETRY_SCHEMA.CIRCLE' IN TYPEOF(input[i]\mapped_item.mapping_source\representation_map.mapping_origin))
          OR
          (('GEOMETRY_SCHEMA.COMPOSITE_CURVE' IN TYPEOF(input[i]\mapped_item.mapping_source\representation_map.mapping_origin))
           AND
            (input[i]\mapped_item.mapping_source\representation_map.mapping_origin\composite_curve.closed_curve = TRUE) 
          )
        )  
      THEN
       pass := FALSE;
      END_IF;
  END_REPEAT;
  RETURN(pass);
         END_FUNCTION;
         
FUNCTION valid_csg_2d_primitives
 (input : csg_solid_2d) : BOOLEAN;
         CASE TRUE OF
  ('GEOMETRIC_MODEL_SCHEMA.PRIMITIVE_2D' IN TYPEOF(input\csg_solid_2d.tree_root_expression)) :
  BEGIN
    IF (SIZEOF(['GEOMETRIC_MODEL_SCHEMA.CIRCULAR_AREA', 
       'CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.COMPLEX_AREA',
       'GEOMETRIC_MODEL_SCHEMA.ELLIPTIC_AREA',
       'GEOMETRIC_MODEL_SCHEMA.HALF_SPACE_2D',
       'GEOMETRIC_MODEL_SCHEMA.POLYGONAL_AREA',
       'CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.PRIMITIVE_2D_WITH_INNER_BOUNDARY',
       'GEOMETRIC_MODEL_SCHEMA.RECTANGULAR_AREA'] * TYPEOF(input\csg_solid_2d.tree_root_expression)) > 0)
    THEN 
           RETURN(TRUE);
    ELSE
           RETURN(FALSE);
    END_IF;
  END;
  ('CONSTRUCTIVE_SOLID_GEOMETRY_2D_MIM.BOOLEAN_RESULT_2D' IN TYPEOF(input\csg_solid_2d.tree_root_expression)) : 
    RETURN (valid_csg_2d_primitives(input\csg_solid_2d.tree_root_expression\boolean_result_2d.first_operand) 
        AND valid_csg_2d_primitives(input\csg_solid_2d.tree_root_expression\boolean_result_2d.second_operand));
  OTHERWISE : RETURN(FALSE);
END_CASE;
         END_FUNCTION;
         
         END_SCHEMA;  -- Constructive_solid_geometry_2d_mim
© ISO 2019 — All rights reserved