(* ISO 10303 TC184/SC4/WG12 N9671 EXPRESS Source: ISO 10303-520 ed3 Associative draughting elements - Aic associative draughting elements The following permission notice and disclaimer shall be included in all copies of this EXPRESS schema ("the Schema"), and derivations of the Schema: Copyright ISO 2017 All rights reserved Permission is hereby granted, free of charge in perpetuity, to any person obtaining a copy of the Schema, to use, copy, modify, merge and distribute free of charge, copies of the Schema for the purposes of developing, implementing, installing and using software based on the Schema, and to permit persons to whom the Schema is furnished to do so, subject to the following conditions: THE SCHEMA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SCHEMA OR THE USE OR OTHER DEALINGS IN THE SCHEMA. In addition, any modified copy of the Schema shall include the following notice: THIS SCHEMA HAS BEEN MODIFIED FROM THE SCHEMA DEFINED IN ISO 10303-520 ed3 Associative draughting elements - Aic associative draughting elements AND SHOULD NOT BE INTERPRETED AS COMPLYING WITH THAT STANDARD *) SCHEMA aic_associative_draughting_elements '{iso standard 10303 part(520) version(3) object(1) aic_associative_draughting_elements(1)}'; USE FROM measure_schema -- ISO 10303-41 (derived_unit, named_unit); USE FROM product_property_definition_schema -- ISO 10303-41 (property_definition, shape_aspect, shape_aspect_relationship); USE FROM product_property_representation_schema -- ISO 10303-41 (shape_definition_representation); REFERENCE FROM support_resource_schema -- ISO 10303-41 (bag_to_set); USE FROM geometry_schema -- ISO 10303-42 (axis2_placement); USE FROM representation_schema -- ISO 10303-43 (mapped_item, representation, representation_item, representation_map); REFERENCE FROM representation_schema -- ISO 10303-43 (using_representations); USE FROM qualified_measure_schema -- ISO 10303-45 (measure_representation_item); USE FROM presentation_appearance_schema -- ISO 10303-46 (curve_style, styled_item, invisibility_context); USE FROM presentation_definition_schema -- ISO 10303-46 (annotation_curve_occurrence, annotation_fill_area_occurrence, annotation_occurrence, annotation_occurrence_relationship, annotation_symbol_occurrence, annotation_text_occurrence, text_literal); USE FROM presentation_organization_schema -- ISO 10303-46 (camera_model, presentation_view, annotation_representation_select); USE FROM shape_dimension_schema -- ISO 10303-47 (dimensional_characteristic_representation, shape_dimension_representation); USE FROM draughting_element_schema -- ISO 10303-101 (annotation_plane, draughting_callout, draughting_model, draughting_model_item_select, leader_curve, projection_curve); TYPE aade_invisibility_context = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON invisibility_context WITH (draughting_model); END_TYPE; ENTITY annotation_occurrence_associativity SUBTYPE OF (annotation_occurrence_relationship); WHERE WR1: SIZEOF (TYPEOF (SELF.related_annotation_occurrence) * ['PRESENTATION_DEFINITION_SCHEMA.ANNOTATION_FILL_AREA_OCCURRENCE', 'DRAUGHTING_ELEMENT_SCHEMA.PROJECTION_CURVE', 'DRAUGHTING_ELEMENT_SCHEMA.LEADER_CURVE']) = 1; END_ENTITY; ENTITY dimension_text_associativity SUBTYPE OF (text_literal, mapped_item); WHERE WR1: ('SHAPE_DIMENSION_SCHEMA.SHAPE_DIMENSION_REPRESENTATION' IN TYPEOF (SELF\mapped_item. mapping_source.mapped_representation)); WR2: ('DRAUGHTING_ELEMENT_SCHEMA.DRAUGHTING_CALLOUT' IN TYPEOF (SELF\mapped_item.mapping_target)); WR3: SIZEOF (QUERY (ato <* QUERY (si <* USEDIN (SELF, 'PRESENTATION_APPEARANCE_SCHEMA.STYLED_ITEM.ITEM') | ('PRESENTATION_DEFINITION_SCHEMA.ANNOTATION_TEXT_OCCURRENCE' IN TYPEOF(si))) | NOT (SIZEOF( QUERY (dc <* USEDIN (ato, 'DRAUGHTING_ELEMENT_SCHEMA.' + 'DRAUGHTING_CALLOUT.CONTENTS') | ('DRAUGHTING_ELEMENT_SCHEMA.DRAUGHTING_CALLOUT' IN TYPEOF (dc))) * [SELF\mapped_item.mapping_target]) = 1) )) = 0; END_ENTITY; ENTITY shape_aspect_associativity SUBTYPE OF (shape_aspect_relationship); WHERE WR1: SELF.relating_shape_aspect.product_definitional; WR2: NOT (SELF.related_shape_aspect.product_definitional); END_ENTITY; FUNCTION check_associative_shape_aspects (sdr : shape_definition_representation) : BOOLEAN; LOCAL sr1, sr2 : SET OF representation; dm, pv : SET OF representation; END_LOCAL; -- Check if the representation contains only two items IF (SIZEOF (sdr.used_representation.items) <> 2) THEN RETURN (FALSE); END_IF; -- Find the representations that use each item sr1 := using_representations(sdr.used_representation.items[1]); sr2 := using_representations(sdr.used_representation.items[2]); -- Find the representations in which item 1 representations are mapped REPEAT i := 1 TO HIINDEX(sr1); dm := representations_mapped_into(sr1[i]); REPEAT j := 1 TO HIINDEX(dm); IF ('DRAUGHTING_ELEMENT_SCHEMA.DRAUGHTING_MODEL' IN TYPEOF(dm[j])) THEN IF (dm[j] IN sr2) THEN RETURN (TRUE); END_IF; -- Find the views that the draughting model is mapped into pv := representations_mapped_into(dm[j]); REPEAT k := 1 TO HIINDEX(pv); IF ('PRESENTATION_ORGANIZATION_SCHEMA.PRESENTATION_VIEW' IN TYPEOF(pv[k])) THEN IF (pv[k] IN sr2) THEN RETURN (TRUE); END_IF; END_IF; END_REPEAT; END_IF; END_REPEAT; END_REPEAT; -- Find the representations in which item 2 representations are mapped REPEAT i := 1 TO HIINDEX(sr2); dm := representations_mapped_into(sr2[i]); REPEAT j := 1 TO HIINDEX(dm); IF ('DRAUGHTING_ELEMENT_SCHEMA.DRAUGHTING_MODEL' IN TYPEOF(dm[j])) THEN IF (dm[j] IN sr1) THEN RETURN (TRUE); END_IF; -- Find the views that the draughting model is mapped into pv := representations_mapped_into(dm[j]); REPEAT k := 1 TO HIINDEX(pv); IF ('PRESENTATION_ORGANIZATION_SCHEMA.PRESENTATION_VIEW' IN TYPEOF(pv[k])) THEN IF (pv[k] IN sr1) THEN RETURN (TRUE); END_IF; END_IF; END_REPEAT; END_IF; END_REPEAT; END_REPEAT; RETURN(FALSE); END_FUNCTION; FUNCTION representations_mapped_into (rep : representation) : SET of representation; LOCAL results : SET OF representation := []; rm : SET OF representation_map; mi : SET OF mapped_item := []; END_LOCAL; -- Find set of representation_maps which specify the representation rm := bag_to_set(USEDIN(rep, 'REPRESENTATION_SCHEMA.' + 'REPRESENTATION_MAP.MAPPED_REPRESENTATION')); -- Find the set of mapped_items that use each representation_map REPEAT i := 1 TO HIINDEX(rm); mi := mi + rm[i].map_usage; END_REPEAT; -- Find the set of representations that use each mapped_item REPEAT j := 1 TO HIINDEX(mi); results := results + USEDIN(mi[j],'REPRESENTATION_SCHEMA.' + 'REPRESENTATION.ITEMS'); END_REPEAT; RETURN(results); END_FUNCTION; END_SCHEMA;