assetBestSize function

string assetBestSize(searchQuery, axisSize)

searchQuery string Search query to apply on list of all files in the workspace. See fileSearch / filesSearch for details about the syntax.

axisSize string

"x", "y", "z", "xy", "xz", "yz", "xyz" Axes for the currect scope.

Returns the asset with the best size fit (according to axisSize).

This function returns the asset with the best fitting size, from the files specified by searchQuery, according to the specified axisSize string.

Related

Examples

Inserting assets based on their (physical) size

Pool of assets with different physical sizes

The goal is to insert assets from a pool, depending on their (physical) size. The pool of assets is seen in the following image. Colors are (only) used to visually emphasize the size ratio.

Inserted assets chosen by best fitting size
Lot -->
    s('0.9,'0.9,'0.9)
    center(xz)
    RecursiveSplit

RecursiveSplit -->
    case scope.sx >= 1.5 && scope.sz >= 1.5:
        split(x) { ~scope.sx/3 : split(z) { ~scope.sz/3 : RecursiveSplit }* }*
    else: innerRectangle(scope) { shape : Insert }

Insert -->
    alignScopeToAxes(y)
    i(assetBestSize("/myProject/assets/cube_*.obj", "xz"))

Note that small parts get blue assets while large parts get red assets.