Purpose

The module CSOLabelPlacementGlobal implements an automatic label placement strategy that considers all CSOs on a slice.

Usage

Attach this module to a CSOLabelRenderer or a SoCSOAnnotationDeviceCoordinates module.

Details

The hull outline is computed according to the selected hull mode.

By default, the placement strategy computes the convex hull of all CSOs on a slice.

If Hull Points from CSO List is selected, the first CSO in the current slice from the input inHullCSOList is used as the label hull. If none is found, the default placement strategy is used to compute the hull.

After the hull is defined, rays are computed from the center of that hull; the angles between consecutive rays are constant and there are numCSOs + Additional Slots many rays. For example, if there are 4 CSOs and no additional slots should be used, there will be 4 slots: to the east, south, west, and north of the center, in that order. The angles where labels can be placed (relative to the center point) can be restricted by setting Start Angle and End Angle.

For each ray, the crossing point with the hull is computed; note that the hull can be enlarged by the Device Offset value. This leads to crossing positions a bit farther away from the center.

Finally, all shortest distances between the CSOs and the position slots are computed and used to fill a weight matrix for computing the best position slot by solving it as an assignment problem, using a Kuhn-Mankres Hungarian solver.

The label for a CSO is placed to a corresponding slot for an assignment where the overall error is smallest.

Windows

Main

../../../Modules/Inventor/SoCSO/mhelp/Images/Screenshots/CSOLabelPlacementGlobal.Main.png

Input Fields

inHullCSOList

name: inHullCSOList, type: CSOList(MLBase)

A list of CSOs that can be used as label hulls.

For accessing this object via scripting see the Scripting Reference: MLCSOListWrapper.

Output Fields

outPlacement

name: outPlacement, type: CSOLabelPlacement(MLBase)

Parameter Fields

Field Index

Additional Slots: Integer
Device Offset: Float
End Angle: Float
Hull Mode: Enum
Start Angle: Float

Visible Fields

Device Offset

name: deviceOffset, type: Float, default: 20

Sets the initial distance of a label to the convex hull in pixel.

Additional Slots

name: additionalSlots, type: Integer, default: 12, minimum: 0

Sets the number of additional slots for placing labels around the convex hull around all CSOs.

Hull Mode

name: hullMode, type: Enum, default: CONVEX_CSO_HULL

Defines how the label hull is calculated.

Values:

Title Name Description
Convex Cso Hull CONVEX_CSO_HULL Calculates the convex hull of all CSOs with a label
Hull Points From Cso List HULL_POINTS_FROM_CSO_LIST Uses a CSO in the current slice from input inHullCSOList as label hull

Start Angle

name: startAngle, type: Float, default: 0

Sets the start angle in degrees to restrict the label positions to an arc (0 is up).

End Angle

name: endAngle, type: Float, default: 0

Sets the end angle in degrees to restrict the label positions to an arc (0 means unrestricted).