SketchUp Functions (Specific to SketchUp Dynamic Components)
Function | Description | Example(s) |
---|---|---|
CHOOSE(index,value1,value2, ...valueN) |
The CHOOSE function returns a value from a list of parameters, at the location of the index value. This function allows you to create a single drop-down list that drives multiple attribute changes at once. Use CHOOSE and OPTIONINDEX together as a mechanism to assign different values depending on a user's choice in the Component Options dialog box. For example, if the Component Options dialog box allows the user to choose different materials to assign to a component (and the price changes depending on material chosen), you can create a formula for the MSRP |
Example: =CHOOSE(2,"Blue","Red","Green") Results in "Red." Example: =CHOOSE (OPTIONINDEX("Material"), 100, 150, 200) Returns 100, 150, or 200 depending on the material chosen in the Component Options dialog box. View SketchUp Example |
CURRENT("attributeName") | The CURRENT function accepts a string name of an attribute, and returns the size or position attribute that the SketchUp user just applied. This function allows you to do validation of Scale Tool or Move Tool actions. | Example: =ROUND(CURRENT("LenX")/2)*2 When entered into the LenX value field this example constrains the component to the nearest width, within 2 inches, after scaling. View SketchUp Example |
EDGES() | The EDGES function returns the number of "ungrouped" edges inside the component or group that this function is called within. | View SketchUp Example |
FACEAREA("materialName") | The FACEAREA method returns the area (in square inches) of every "ungrouped" face that is painted with the materialName. The FACEAREA method returns the total area of all ungrouped faces when the materialName is not provided. | Example: =FACEAREA("Oak") Returns the square inches of Oak material inside the component or group. View SketchUp Example |
FACES() | The FACES function returns the number of "ungrouped" faces inside the component or group that this function is called within. | View SketchUp Example |
LARGEST(value1,value2,...valueN) | The LARGEST function returns the largest of the values in a list. | Example: =LARGEST(CURRENT("LenX"), 20, 10) When entered into the LenX value field this example constrains the component so it cannot be scaled more than the largest of three numbers (either the value of LenX, 20, or 10): View SketchUp Example |
LAT() | The LAT function returns the latitude of the current SketchUp model. | View SketchUp Example |
LNG() | The LNG function returns the longitude of the current SketchUp model. | -- |
NEAREST(originalValue, value1, value2, ...valueN) | The NEAREST function compares the originalValue with a list of target values, and returns the target value that is closest to the originalValue. | Example: = NEAREST(CURRENT("LenX"),24,36,48) When entered into the LenX value field, this example will cause the component to snap to the nearest width of 24,36, or 48 after scaling. View SketchUp Example |
OPTIONINDEX("attributeName") | The OPTIONINDEX function returns the currently selected index from its option list given a string name of an attribute. For example, if an attribute can be "red","blue", or "green", and blue is the current value, this function returns 2. If no match is found, 0 is returned. | View SketchUp Example |
OPTIONLABEL("attributeName") | The OPTIONLABEL function returns the currently selected label form its option list given a string name of an attribute. For example, if an attribute can be "Red=red","Blue=blue", or "Green=green", and blue is the current value, this function returns "Blue". If no match is found, an error is raised. | View SketchUp Example |
SMALLEST(value1,value2,...valueN) | The SMALLEST function returns the smallest of the values in a list. | Example: =SMALLEST(CURRENT("LenX"),20, 10) When entered into the LenX value field this example constrains the component so it cannot be scaled less than the smallest number (the value of LenX, 20, or 10). View SketchUp Example |
SUNANGLE() | The SUNANGLE function returns the angle (in degrees) between the sun and the current model's North direction. | View SketchUp Example |
SUNELEVATION() | The SUNELEVATION function returns the elevation (in degrees) of the sun from the current model's shadow settings. The elevation is defined as the angle between a vector pointing at the sun and the ground plane. | View SketchUp Example |