# Synopsis

PDX_MSGT stcr_CreateEntity(long option, MDA_PTR orig_db_ptr, int step_model, DDF_TF typeform, MDA_PTR *db_ptr, ...)

# Purpose

Create a STEP entity.

# Description

Creates a STEP entity of the specified typeform in the specified step_model based on the data provided. The data provided must result in a valid definition. The fields within the new STEP entity are set through arguments passed through the variable argument list. The values in this list must represent each field defined within the entity definition in its respective DDF. The order of these is essential and all fields must be used unless specified as optional (see below). This routine does NOT attempt to support ALL entity structures that can be created from an EXPRESS file. It does do a decent job of supporting the CM types of entities for which it was written. Entity structures containing nested unions (selects) and multidimensional arrays are not currently supported. The orig_db_ptr argument should contain the database pointer of the entity that the new entity was created from (usually this should be obtained by the calling routine via mda_GetOrigDbptr) or MDA_NULL_PTR. See the mda_intro man page for more information about predecessor entities. The following example demonstrates how a STEP CALENDAR_DATE might be created to represent the date, May 6, 1996.

.nf stcr_CreateEntity (STCR_NOOPT, MDA_NULL_PTR, step_model, CALENDAR_DATE, &db_ptr, 1996, 6, 5); .fi Many entity definitions defined within a STEP DDF may have fields which may be optionally used. These optional fields are typically defined as follows in a DDF. .nf struct last_name { short present attr=(ignore); vstring value; } attr=(optional); .fi For fields defined in this manner, the value may be set simply by passing a legal value into the correct location within the variable argument list. If this field is not to be used, the STCR_NOT_USED keyword can be placed in this location of the variable argument list. An example follows that depicts how a PERSON entity might be created. This particular person has one middle name defined in an array called m_name. .nf stcr_CreateEntity (STCR_NOOPT, MDA_NULL_PTR, step_model, PERSON, "jpb", "Black", "Jeremy", 1, m_name, STCR_NOT_USED, STCR_NOT_USED); .fi Notice from the above example that fields which are unsized arrays must be preceded by a count value in the variable argument list unless the field is optional and not used. Limited support is provided for select types such as the one in the following example. .nf union value_component "MEASURE_VALUE" { double area_measure; double context_dependent_measure; vstring descriptive_measure; struct positive_length_measure { double length_measure; } attr = (select_c); struct positive_plane_angle_measure { double plane_angle_measure; } attr = (select_c); double solid_angle_measure; } attr = (complicated_select, select_c); .fi The select type that is requested should be specified in double quotes prior to the value that is stored in the entity structure. i.e. the select type name is to precede the value as shown in the following example which creates an UNCERTAINTY_MEAURE_WITH_UNIT entity. The UMWU will contain a value_component of type "solid_angle_measure" with the value 2.0.

.nf stcr_CreateEntity (STCR_NOOPT, MDA_NULL_PTR, step_model, UNCERTAINTY_MEASURE_WITH_UNIT, "solid_angle_measure", 2.0, nmdunt_ptr, "Measure name", "Measure description"); .fi Select types defined by nested unions are currently unsupported.

# Input

## option

Options (not used)

## orig_db_ptr

The original entities orig_db_ptr as obtained from the mda_GetOrigDbptr call, or MDA_NULL_PTR

## step_model

The model for creating the STEP entity or entities

## typeform

The type/form of the entity to create. @a ... List of additional arguments representing each of the fields of the STEP entity being constructed.

# Output

## db_ptr

The database pointer of the resulting STEP entity.

# Return

STCR error code