NearestWithDistance

Node Action:

The NearestWithDistance node action finds the closest components of a specified type.

Parameters:

se_type

NearestWithDistance

se_type = NearestWithDistance

se_coordinate

The coordinate to search near.

se_maxCount

Future functionality to limit the results to the max components to return.

se_maxDistance

The buffer distance around the coordinate.

se_componentType

The component type to search for.

se_predicate

Future functionality to allow you to build a predicate instead of using component type.

se_resultVariable

The variable name to save the search result.

Example:

Find Nearest Pole: Finds the pole nearest to the selected component, then selects and zooms to it.

digraph workflow {

entry[
se_type0 = ComponentToolTrigger,
se_displayName0 = "Find Nearest Pole"
se_iconService0 = ""
se_iconUrl0 = ""
se_requiresConnection0 = false,
se_sortOrder0 = 0,
se_visibilityCondition0 = "(dynamicStateMachineContext, msLogger) => {
  return true;
}",
se_type1 = Action,
se_action1 = "(ctx, msLogger) => {
   ctx.State.Coordinate = ctx.Event.component.geometry;
}",


]

FindNearestPole[
se_type0 = NearestWithDistance,
se_componentType0 = "Pole",
se_coordinate0 = Coordinate,
se_maxDistance0 = 100,
se_resultVariable0 = Poles

]

SelectAndZoom[
  se_type0 = SelectComponent,
  se_determineComponentId0 = "(ctx, msLogger) => {
    IEnumerable<dynamic> poles = ctx.State.Poles;
    var pole = poles.FirstOrDefault();
    return pole?.Id.ToString();
}",

  se_type1 = ZoomToComponent,
  se_componentId1 = ""
  se_determineComponentId1 = "(ctx, msLogger) => {
     IEnumerable<dynamic> poles = ctx.State.Poles;
     var pole = poles.FirstOrDefault();
     return pole?.Id.ToString();
}",

]
entry->FindNearestPole->SelectAndZoom->exit
}
Feedback
QR Code is a registered trademark of DENSO WAVE INCORPORATED in Japan and other countries.