(*
 * $Id$
 *
 * JSDAI(TM), a way to implement STEP, ISO 10303
 * Copyright (C) 1997-2008, LKSoftWare GmbH, Germany
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License
 * version 3 as published by the Free Software Foundation (AGPL v3).
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * JSDAI is a registered trademark of LKSoftWare GmbH, Germany
 * This software is also available under commercial licenses.
 * See also http://www.jsdai.net/
 *)

(*
   Derived from ISO TC184/SC4/WG12 N - ISO/CD-TS 10303-xxxx Physical unit 3d shape - EXPRESS ARM
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)

SCHEMA Physical_unit_3d_shape_xim;

USE FROM Non_feature_shape_element_xim;

REFERENCE FROM Requirement_decomposition_xim(get_rvd);

	TYPE pu3ds_view_shape_model_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON view_shape_select WITH 
	    (Physical_unit_shape_model);
	END_TYPE; 

  TYPE predefined_3d_purpose = ENUMERATION OF
    (analysis_input,
     analysis_output,
     shock_analysis_input,
     shock_analysis_output,
     design,
     vibration_analysis_input,
     vibration_analysis_output,
     electromagnetic_compatibility_analysis_input,
     electromagnetic_compatibility_analysis_output,
     thermal_analysis_input,
     thermal_analysis_output);
  END_TYPE;

	TYPE pu3ds_physical_unit_shape_model_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON physical_unit_shape_model_select WITH 
	    (Physical_unit_3d_shape_model);
  	END_TYPE;

  TYPE shape_class = ENUMERATION OF
    (extrusion,
     manhattan_block,
     other,
     is_unknown);
  END_TYPE;

  TYPE pu3ds_shape_location = ENUMERATION OF
    (above,
     below);
  END_TYPE;

  TYPE pu3ds_shape_side = ENUMERATION OF
    (same_side,
     opposite_side,
     both_sides);
  END_TYPE;

  TYPE pu3ds_component_application = ENUMERATION OF
    (compliant_components_permitted,
     no_components_permitted);
  END_TYPE;

  ENTITY Physical_unit_3d_keepout_shape_model   
    (* CONNOTATIONAL *) SUBTYPE OF (Usage_view_level_non_feature_shape_model, Physical_unit_keepout_shape_model);
      shape_classification               : shape_class;
      SELF\Usage_view_level_non_feature_shape_model.model_shape : Physical_unit_3d_shape_model;
      component_application                                    : pu3ds_component_application;
      shape_distance_from_seating_plane                        : OPTIONAL Length_tolerance_characteristic;
      shape_location_with_respect_to_seating_plane             : OPTIONAL pu3ds_shape_location;
      side                                                     : OPTIONAL pu3ds_shape_side;      
	DERIVE
  		application_technology_constraint: SET[0:?] OF Requirement_view_definition :=
  		  get_rvd(SELF, 'application technology constraint');
  		SELF\Representation.name : label := '3d bound volume shape';
  		SELF\Representation.description : text := 'pu3dksm';
	WHERE
   		WR1 : SIZEOF(application_technology_constraint) <= 1;
        WR4 : NOT (EXISTS(shape_distance_from_seating_plane) XOR EXISTS(shape_location_with_respect_to_seating_plane));
   	    WR5 : NOT ('PACKAGE_XIM.PACKAGE_ARMX' IN TYPEOF(model_shape.shape_characterized_definition)) OR
   	        EXISTS(shape_distance_from_seating_plane);
        WR6 : NOT EXISTS(side) OR ('PACKAGE_XIM.PACKAGE_ARMX' IN TYPEOF(model_shape.shape_characterized_definition));   		
  END_ENTITY;

  ENTITY Physical_unit_3d_shape_model
    (* CONNOTATIONAL *) SUBTYPE OF (Physical_unit_shape_model);
      shape_purpose                     : OPTIONAL predefined_3d_purpose;
      shape_classification              : shape_class;
	DERIVE
  		application_technology_constraint: SET[0:?] OF Requirement_view_definition :=
		  get_rvd(SELF, 'application technology constraint');
		SELF\Representation.name : label := '3d bound volume shape';
    INVERSE
	  external_shape_purpose : SET [0:1] OF External_source_identification FOR items;      
	WHERE
	  WR1: (EXISTS (shape_purpose)) XOR ((SIZEOF(external_shape_purpose)) = 1);
   	  WR2: SIZEOF(application_technology_constraint) <= 1;
  END_ENTITY;

END_SCHEMA;

