(*
 * $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 non planar design view - EXPRESS ARM
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)

SCHEMA Physical_unit_non_planar_design_view_xim;
  
USE FROM Physical_unit_design_view_xim;  

USE FROM Manifold_subsurface_xim;

REFERENCE FROM support_resource_schema   -- ISO 10303-41
  (bag_to_set);

	
  ENTITY Assembly_component_non_planar_shape_model
    (* CONNOTATIONAL *) SUBTYPE OF (Manifold_subsurface_shape_representation);
      shape_characterized_component : SET[1:?] OF Assembly_component_armx;
    DERIVE
      equivalent_reference_shape_model : SET [0:1] OF Shape_representation_relationship :=
        bag_to_set(QUERY( gmr <* USEDIN(SELF, 'PRODUCT_PROPERTY_REPRESENTATION_SCHEMA.SHAPE_REPRESENTATION_RELATIONSHIP.REP_2') |
        (gmr\Representation_relationship.relation_type = 'equivalent reference shape model')));      
    WHERE
      WR1 : SIZEOF(equivalent_reference_shape_model) < 2;         
  END_ENTITY;

RULE unique_assembly_component_non_planar_shape_model FOR (Assembly_component_non_planar_shape_model);
   LOCAL
     ac : BAG OF Assembly_component_armx := [];
   END_LOCAL;
   REPEAT i := 1 to SIZEOF(Assembly_component_non_planar_shape_model) by 1;
     ac  := ac + Assembly_component_non_planar_shape_model[i].shape_characterized_component;
   END_REPEAT;  
  WHERE
   WR1 : SIZEOF(ac) = SIZEOF(bag_to_set(ac));
  END_RULE;

END_SCHEMA;

