Skip to content

Scripting API

Mirror quad

from ArtisanPlugin.Scripting import TransformApi as transform

Model one quarter of a symmetric piece and let the other three appear: a claw, a scroll or a pavé field drawn in one quadrant is reflected left–right, front–back and diagonally, so a four-way symmetric head or a cross-shaped motif stays coherent while you keep editing the single original.

Usage

ids = transform.MirrorQuad(objectIds = None, plane = None)   # -> the new copies
ParameterDefaultMeaning
objectIdsNoneObjects to mirror. None or an empty list uses the current selection
planeNoneThe symmetry frame. None uses the active viewport’s construction plane, or world XY when the session has no view

The two mirror planes are built from the frame you give: one through its origin spanned by the Z and X axes (normal = Y), one spanned by the Y and Z axes (normal = X). Both are vertical with respect to the plane — they are not the plane itself, which is never used as a mirror. So the original and its copies are laid out around the plane’s origin, in the four quadrants of its XY grid, all at the same height.

What is created

Three copies per object, added to the document; the source objects are not modified, moved or deleted. The first copy is the reflection across the ZX plane, the second across the YZ plane, and the third is the second mirror applied to the first copy — the diagonal quadrant. Each is made with Rhino’s TransformWithHistory, so history is genuinely recorded: with Record History and Update Children on, editing the original updates its copies. Note the chain — the diagonal copy is a child of the first copy, not of the original, so it follows the original one hop removed.

Returns an IReadOnlyList<Guid>: the ids of the copies, three per object, in that order (first mirror, second mirror, diagonal), object by object. The count is nominally 3 × len(objectIds) but not guaranteed: if a copy fails Rhino returns an empty id and it is left out, and if the first copy fails the diagonal is skipped too, so an object can contribute one or two ids. Count the returned list rather than assuming three.

Ids you pass explicitly must exist — a missing one raises Object {id} does not exist. naming it, and duplicates are collapsed. With no ids and nothing selected it raises Nothing selected: select (or pass) at least one object.. A plane that is not valid geometry raises The mirror plane is not valid..

from ArtisanPlugin.Scripting import TransformApi as transform, Transaction

with Transaction.Begin("Mirror the quarter head"):
    ids = transform.MirrorQuad([clawId])
    print(len(ids), "copies")