<< Click to Display Table of Contents > 

Client Control Interface Manual > Programming Examples > Mirror Entity on Y Axis

Mirror Entity on Y Axis
Previous pageReturn to chapter overviewNext page

The following examples shows how to mirror an entity on the Y axis. To mirror on X axis, just switch the -1,1 to 1,-1 in the ScScaleEntity command. The Entity has the name "A" in this example.

 

Mirror Entity on Y Axis

 

//define the type of the new entity

cci.ScSetStringValue((int)ScComSAMLightClientCtrlValueTypes.scComSAMLightClientCtrlStringValueTypeCreateEntity,"ScWinTextChars2D");

string EntityName = "A";

 

// Get Co-ordinates of the center point of the entity

double Xmin, Ymin, Xmax, Ymax, Xc, Yc;

Xmin = cci.ScGetEntityOutline( EntityName, 0 );

Ymin = cci.ScGetEntityOutline( EntityName, 1 );

Xmax = cci.ScGetEntityOutline( EntityName, 3 );

Ymax = cci.ScGetEntityOutline( EntityName, 4 );

Xc = ( Xmin + Xmax ) / 2;

Yc = ( Ymin + Ymax ) / 2;

 

// Translate entity to the center of the working field

cci.ScTranslateEntity( EntityName, -Xc, -Yc, 0 );

 

// Mirror Entity

cci.ScScaleEntity( EntityName, -1, 1, 1 );

 

// Translate entity back to its original position

cci.ScTranslateEntity( EntityName, Xc, Yc, 0 );

Table 414: Mirror Entity on Y Axis