SilverScreen Solid Modeler

near_entity1

near_entity1

Previous topic Next topic  

near_entity1

Previous topic Next topic JavaScript is required for the print function  

 

SilverScreenAPI

 

int near_entity1( int e_type, int x, int y );

 

int e_type; // An integer value

int x;      // An integer value

int y;      // An integer value

 

 




Synopsis

#include "silver.h"

 

The near_entity1 function builds a q-group of visible entities 'near' the 2D screen coordinate defined by the values of x and y. e_type controls the type type of entities considered. If no entity satisfies the type requirements, or the screen coordinate is invalid, then the current q-group will become empty.

 

 

Parameters

e_type is a bos-level bits1 flag value whose meaning is as follows:

 

Value

Meaning

BITS_OBJECT

Only object entities are tested for nearness to x,y

BITS_BLOCK

Only block entities are tested for nearness to x,y

BITS_SYMBOL

Only symbol entities are tested for nearness to x,y

BITS_TEXT

Only text-line entities are tested for nearness to x,y

BITS_DETAIL

Only detail entities are tested for nearness to x,y

 

x is the x-coordinate of the 2D point used to select entities

y is the y-coordinate of the 2D point used to select entities

 

 

Return Value

near_entity1 returns the number of items in the q-group that satisfied the selection conditions. If the screen position does not resolve to one candidate then all candidates are added to the q-group.

 

 

Remarks

You may not treat e_type as a bit-flag in this function (values may not be Or'd). The reason is that all entities in an entity group (either a named group or the q-group) must have the same type.

 

 

See Also

get_group_item, pick_entity

 

 

Example

The following code isolates all objects closest to the current 2D cursor position when the user presses the left mouse button:

C / C++ Code

 

 #include "silver.h"

 #include "ssnodes.h"

 #include "sskeys.h"

 

 int xpos, ypos, key;

 

 do

   {

   key = inchar();

   }

 while ( key != M_LUP );

 

 pointer_position(&xpos, &ypos);

 

 if ( near_entity1(BITS_OBJECT, xpos, ypos) > 0 )

    {

    ss_command("isolate q-group");

    }