Skip to documentation
DocumentationAll documentsEnglish

OCENTER(nged)

NAME

ocenter - get or set the center point of an object's bounding box

On this page

SYNOPSIS

ocenter object
ocenter object x y z

DESCRIPTION

The ocenter command gets or sets the bounding-box center of the specified object.

With one argument, ocenter computes the axis-aligned bounding box of object and returns the center point as a space-separated x y z triplet in the current working units.

With four arguments (object x y z), ocenter moves the object so that its bounding-box center coincides with the specified point (x, y, z) in model coordinates. The move is applied by modifying the object’s own geometry, not by adding a transformation to a parent combination. The object is updated directly in the database.

Coordinates are in the current working units.

Note
The bounding-box center is computed from the axis-aligned bounding box of the object, which may not coincide with the geometric centroid for asymmetric shapes.

EXAMPLES

Example 1. Get the bounding-box center of an object

mged> ocenter hull.s

Returns the center of hull.s’s bounding box in working units, for example: `0 0 250.

Example 2. Move an object’s center to the origin

mged> ocenter wheel.s 0 0 0

Moves wheel.s so its bounding-box center is at the model origin (0, 0, 0).

Example 3. Center an object on an axis

mged> set c [ocenter part.s] mged> ocenter part.s 0 0 [lindex $c 2]

Retrieves the current center, then moves part.s so its center is on the Z axis (X=0, Y=0) without changing its Z position.

SEE ALSO

center(nged), translate(nged), bb(nged)

AUTHOR

BRL-CAD Team

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org