FUNCTION find_assembly_root
(* SCHEMA assembly_feature_relationship_schema; *)
FUNCTION find_assembly_root
(constituent: SET OF product_definition) : SET OF product_definition;
LOCAL
local_relation: SET OF assembly_component_usage := [];
local_relation2: BAG OF assembly_component_usage := [];
local_parent: SET OF product_definition := [];
root : SET OF product_definition;
i : INTEGER := 0;
j : INTEGER := 0;
END_LOCAL;
-- Is constituent root ? --
IF ((SIZEOF (constituent) = 1) AND assembly_root (constituent[1]))
THEN RETURN ([constituent [1]]);
-- ERROR constituent is vacant --
ELSE IF (SIZEOF (constituent) = 0 ) THEN RETURN ([]);
-- extraction of related assembly_component_relationships --
ELSE
REPEAT j:= 1 TO HIINDEX(constituent);
local_relation2 := local_relation2 + (USEDIN (constituent[j],
'PRODUCT_STRUCTURE_SCHEMA.ASSEMBLY_COMPONENT_USAGE.'
+'RELATED_PRODUCT_DEFINITION'));
END_REPEAT;
local_relation := bag_to_set (local_relation2);
IF (SIZEOF(local_relation) = 0) THEN
IF (SIZEOF(constituent) = 1) THEN RETURN ([constituent[1]]);
ELSE RETURN ([]);
END_IF;
ELSE
-- extraction of a set of parents --
REPEAT i :=1 TO HIINDEX(local_relation);
REPEAT j := 1 TO HIINDEX(constituent);
IF (local_relation[i].relating_product_definition <>
constituent[j]) THEN
local_parent := local_parent +
local_relation[i].relating_product_definition;
END_IF;
END_REPEAT;
END_REPEAT;
IF ((SIZEOF (local_parent) = 1 ) AND
assembly_root (local_parent[1]))
THEN RETURN ([local_parent[1]]);
ELSE IF (SIZEOF (local_parent) = 0) THEN RETURN ([]);
-- try again --
ELSE
root := find_assembly_root(local_parent);
IF (SIZEOF (root) =1) THEN RETURN (root);
ELSE IF (SIZEOF (root) = 0) THEN RETURN ([]);
END_IF;
END_IF;
END_IF;
END_IF;
END_IF;
END_IF;
END_IF;
END_FUNCTION;
Referenced By
Defintion find_assembly_root is references by the following definitions:
[Top Level Definitions] [Exit]Generated by STEP Tools® EXPRESS to HTML Converter
2012-03-27T17:14:00-04:00