assetBestRatio function

string assetBestRatio(searchQuery, axesRatio)

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

axesRatio string

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

Returns the asset (according to axesRatio) with the best ratio.

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

Related

Examples

Inserting assets based on the best ratio

Asset ratio pool example

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

Since the assets are color coded with their ratio, it is visible that "long" and "wide" Lots utilize black and pink assets, while "square-ish" Lots utilize red and blue assets.
Result of assetBestRatio example
Lot -->
    innerRectangle(scope) { shape : Insert }

Insert -->
    alignScopeToAxes(y)
    s('1,0,'1)
    i(assetBestRatio("/myProject/assets/cube_*.obj", "xz"))