ITK Function Reference

(V10000.1.0.60_20160308.00)
Functions
ModelSearch

Functions

MDL0MODEL_API int MODELSEARCH_create_box_zone_expression (const double *box_coordinates, Mdl0BoxOperator_t box_operator, tag_t *box_expression)
 
MDL0MODEL_API int MODELSEARCH_create_configuration_context (const char *revision_rule, tag_t *configuration_context)
 
MDL0MODEL_API int MODELSEARCH_create_configuration_context_with_rule_and_variant (const tag_t revision_rule, const tag_t variant_rule, tag_t *configuration_context)
 
MDL0MODEL_API int MODELSEARCH_create_group_expression (Mdl0Operator_t group_operator, int num_exprs, const tag_t *exprs, tag_t *group_expr)
 
MDL0MODEL_API int MODELSEARCH_create_plane_zone_expression (const double *plane_coordinates, Mdl0PlaneOperator_t plane_operator, tag_t *plane_expression)
 
MDL0MODEL_API int MODELSEARCH_create_proximity_expression (int num_target_elements, const tag_t *target_elements, double distance, tag_t *proximity_expression)
 
MDL0MODEL_API int MODELSEARCH_create_result_type_expression (int num_types, const char **search_types, tag_t *result_type_expression)
 
MDL0MODEL_API int MODELSEARCH_create_saved_query_expression (const char *name, int num_entries, const char **entries, const char **values, tag_t *saved_query_expression)
 
MDL0MODEL_API int MODELSEARCH_execute_search (tag_t collaborative_design, tag_t config_context, tag_t search_recipe, logical apply_trushape, logical load_results, int *num_objects, tag_t **model_elements)
 
MDL0MODEL_API int MODELSEARCH_execute_search_by_container (tag_t search_container, tag_t config_context, logical load_elements, int *number_of_elements, tag_t **model_elements)
 
MDL0MODEL_API int MODELSEARCH_get_recipe_from_container (tag_t container, tag_t *collaborative_design, tag_t *config_context, tag_t *search_recipe, logical *apply_trushape)
 
MDL0MODEL_API int MODELSEARCH_set_recipe_on_container (tag_t collaborative_design, tag_t config_context, tag_t search_recipe, logical apply_trushape, tag_t container)
 

Detailed Description

ModelSearch allows users to search for Model Elements in the context of an Application Model This is a APS (Advanced PLM Services) level functionality that is utilized by 4GD (4th generation Design) to implement the searching of Design Elements and Partitions.

The set of ITK functions in this file provides the ability for customers to create APS based Search Recipes and execute them in a custom module.

To create search recipes programmatically, developers should first create the corresponding elemental search expressions like ( Saved Query, Box Zone, Plane Zone, Proximity ). Then Group search expressions could be created using these elemental expression tags.

This search expression could be exeucted to get the results or could be saved using the set and get recipe functions.

For e.g. to create a Group Search Recipe that finds Design Elements in a CD that have a name starting with pipe and is inside a box zone with diaagonal coordinates as (0.5, 0.3, 0.0) and (2.0, 1.0, 0.5), following will be the code snippet:

#include <modelsearch.h>
::
::
char ** entries;
char ** values;
int num_entries = 1;
int ifail = ITK_ok;
tag_t saved_query = NULLTAG;
tag_t box_expr = NULLTAG;
tag_t group_expr = NULLTAG;
int num_des = 0;
tag_t *des = NULL;
entries = (char **)SM_alloc_persistent( num_entries * sizeof( char * ) );
values = (char **)SM_alloc_persistent( num_entries * sizeof( char * ) );
entries[0] = (char *)SM_string_copy_persistent( "name" );
values[0] = (char *)SM_string_copy_persistent( "pipe*" );
ifail = MODELSEARCH_create_saved_query_expression( "FindDesignElementQuery", num_entries, entries, values, &saved_query );
if ( ifail == ITK_ok )
{
double box_coordinates[6];
box_coordinates[0] = 0.5; // min x
box_coordinates[1] = 0.3; // min y
box_coordinates[2] = 0.0; // min z
box_coordinates[3] = 2.0; // max x
box_coordinates[4] = 1.0; // max y
box_coordinates[5] = 0.5; // max z
ifail = MODELSEARCH_create_box_zone_expression( box_coordinates, Inside, &box_expr );
}
if ( ifail == ITK_ok )
{
tag_t group_exprs[2];
group_exprs[0] = saved_query;
group_exprs[1] = box_expr;
ifail = MODELSEARCH_create_group_expression( And, 2, group_exprs, &group_expr );
}
if ( ifail == ITK_ok )
{
ifail = MODELSEARCH_execute_search( cd_tag, config_context, group_expr, false, true, &num_des, &des );
}
// results of the search are in the array variable des of size num_des

Function Documentation

MDL0MODEL_API int MODELSEARCH_create_box_zone_expression ( const double *  box_coordinates,
Mdl0BoxOperator_t  box_operator,
tag_t box_expression 
)

Creates a boxzone search definition tag that could be executed to find the elements inside/outside/intersecting the box.

Returns
Parameters
box_coordinates(I) Array of double precision numbers defining the coordinates of the bounding box
box_operator(I) Box operator. Valid values are Inside, Outside, BoxIntersect, InsideOrIntersects, OutsideOrIntersects
box_expression(O) Tag of the search expression representing this bounding box recipe
MDL0MODEL_API int MODELSEARCH_create_configuration_context ( const char *  revision_rule,
tag_t configuration_context 
)

Retrieves configuration context for input revision rule.

Returns
Parameters
revision_rule(I) Revision rule string
configuration_context(O) Configuration context
MDL0MODEL_API int MODELSEARCH_create_configuration_context_with_rule_and_variant ( const tag_t  revision_rule,
const tag_t  variant_rule,
tag_t configuration_context 
)

Retrieves configuration context for input revision rule and variant rule.

Returns
Parameters
revision_rule(I) Revision rule tag
variant_rule(I) Variant rule tag
configuration_context(O) Configuration context
MDL0MODEL_API int MODELSEARCH_create_group_expression ( Mdl0Operator_t  group_operator,
int  num_exprs,
const tag_t exprs,
tag_t group_expr 
)

Creates a group expression using other search definitions. Group operator is a boolean operator that combines these expression accordingly.

Returns
Parameters
group_operator(I) Operator. Valid values are And, Or, Not. Combines the expression tags accordingly
num_exprs(I) Number of expressions to combine
exprs(I) Expression tags to combine into a group expression
group_expr(O) Tag of the group expression object
MDL0MODEL_API int MODELSEARCH_create_plane_zone_expression ( const double *  plane_coordinates,
Mdl0PlaneOperator_t  plane_operator,
tag_t plane_expression 
)

Creates a planezone search definition tag that could be executed to find the elements above/below/intersecting the plane.

Returns
Parameters
plane_coordinates(I) Array of double precision numbers defining a point on the plane and the vector
plane_operator(I) Plane zone operator. Valid values are PlaneAbove, PlaneBelow, PlaneIntersects, PlaneAboveOrIntersects, PlaneBelowOrIntersects
plane_expression(O) Tag of the plane search defintion
MDL0MODEL_API int MODELSEARCH_create_proximity_expression ( int  num_target_elements,
const tag_t target_elements,
double  distance,
tag_t proximity_expression 
)

Creates a proximity search definition based on the distance (in meters) and the target elements.

Returns
Parameters
num_target_elements(I) Number of target elements for the proximity expression
target_elements(I) Tag of the target elements
distance(I) Distance (in meters) around the target elements that needs to be searched
proximity_expression(O) Tag of the Proximity search expression
MDL0MODEL_API int MODELSEARCH_create_result_type_expression ( int  num_types,
const char **  search_types,
tag_t result_type_expression 
)

Creates a Result type search defnition using the array of the result type names.

Returns
Parameters
num_types(I) Number of search types
search_types(I) Array of search type names (of size num_types)
result_type_expression(O) Tag of ResultType search expression
MDL0MODEL_API int MODELSEARCH_create_saved_query_expression ( const char *  name,
int  num_entries,
const char **  entries,
const char **  values,
tag_t saved_query_expression 
)

Creates a saved query search definition using the name of the saved query and the corresponding entries and values.

Returns
Parameters
name(I) Name of the saved query
num_entries(I) Number of entries and values populated in the saved query
entries(I) Array of entry names (of size num_entries)
values(I) Array of entry values (of size num_entries)
saved_query_expression(O) Tag of Saved Query search expression
MDL0MODEL_API int MODELSEARCH_execute_search ( tag_t  collaborative_design,
tag_t  config_context,
tag_t  search_recipe,
logical  apply_trushape,
logical  load_results,
int *  num_objects,
tag_t **  model_elements 
)

Executes a search using the search recipe in the given collaborative design using the supplied configuration context.

Returns
Parameters
collaborative_design(I) Tag of the collaborative design (or any relevant application model)
config_context(I) Tag of configuration context that has the associated revision rule and other configuration conditions
search_recipe(I) Tag of the search definition object
apply_trushape(I) Flag indicating whether to perform Trushape filtering or not
load_results(I) Flag indicating whether to load the search results or not
num_objects(O) Number of objects returned by the search
model_elements(OF) num_objects Array of tags returned by the search
MDL0MODEL_API int MODELSEARCH_execute_search_by_container ( tag_t  search_container,
tag_t  config_context,
logical  load_elements,
int *  number_of_elements,
tag_t **  model_elements 
)

Executes a search in an Application Model for the given Configuration Context using the search recipe in the search container object.

The returned objects are model elements in the Application Model. The results could be automatically loaded based on the loadElements flag.

Returns
Parameters
search_container(I) Tag of the search container (subset or partition)
config_context(I) Tag of the Configuration Context
load_elements(I) Flag indicating whether the search results should be loaded or not
number_of_elements(O) Number of objects found
model_elements(OF) number_of_elements Tag of the objects found
MDL0MODEL_API int MODELSEARCH_get_recipe_from_container ( tag_t  container,
tag_t collaborative_design,
tag_t config_context,
tag_t search_recipe,
logical apply_trushape 
)

Retrieves the search recipe from a search container that was persisted in the Teamcenter database.

Returns
Parameters
container(I) Tag of the search container
collaborative_design(O) Tag of the collaborative design (or the application model)
config_context(O) Tag of the configuration context attached to the container
search_recipe(O) Tag of the search definition object
apply_trushape(O) Flag indicating trushape filtering option
MDL0MODEL_API int MODELSEARCH_set_recipe_on_container ( tag_t  collaborative_design,
tag_t  config_context,
tag_t  search_recipe,
logical  apply_trushape,
tag_t  container 
)

Sets the search recipe on a search container and persist in the Teamcenter database.

Returns
Parameters
collaborative_design(I) Tag of the collaborative design (or any relevant application model)
config_context(I) Tag of configuration context that has the associated revision rule and other configuration conditions
search_recipe(I) Tag of the search definition object
apply_trushape(I) Flag indicating whether to perform Trushape filtering or not
container(I) Tag of the search container on which the search recipe needs to be set