assetApproxRatio

Synopsis

string assetApproxRatio(string searchQuery, string axisSelector, float n)

Parameters

Returns

Asset with one of the best n size fits (according to axisSelector).

This function returns one of the n best assets of the best ratio, from the file list specified in string, according to the specified axisSelector.

Note: assetApproxRatio(string, axisSelector, 1) = assetBestRatio(string, axisSelector)

Related

Examples

Inserting assets based on their approximate ratio

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.



CGA examples with n = 1 and n = 3:

Note.1: 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.

Note.2: Note the color variations in the next two images by using only the "best ratio" (n = 1) and "choose randomly one of the best three ratios" (n = 3).

n = 1:
Lot -->
	innerRectangle(scope) { shape : doInsert }
doInsert -->
	alignScopeToAxes(y)
	s('1,0,'1)
	i(assetApproxRatio("/myProject/assets/cube_*.obj", "xz", 1))
n = 3:
Lot -->
	innerRectangle(scope) { shape : doInsert }
doInsert -->
	alignScopeToAxes(y)
	s('1,0,'1)
	i(assetApproxRatio("/myProject/assets/cube_*.obj", "xz", 3))

Copyright ©2008-2017 Esri R&D Center Zurich. All rights reserved.