Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions content/pages/docs/kcl-lang/arithmetic.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ KCL supports the usual arithmetic operators on numbers and logic operators on bo
| `\|` | Logical 'or' |
| `!` | Unary logical 'not' |

KCL also supports comparison operators which operate on numbers and produce booleans:
KCL also supports comparsion operators which operate on numbers and produce booleans:

| Operator | Meaning |
|----------|---------|
Expand All @@ -29,7 +29,7 @@ KCL also supports comparison operators which operate on numbers and produce bool
| `<=` | Less than or equal |
| `>=` | Greater than or equal |

Arithmetics and logic expressions can be arbitrarily combined with the usual rules of associativity and precedence, e.g.,
Arithmetics and logic expressions can be arbitrairly combined with the usual rules of associativity and precedence, e.g.,

```
myMathExpression = 3 + 1 * 2 / 3 - 7
Expand Down
33 changes: 27 additions & 6 deletions content/pages/docs/kcl-std/functions/std-solid-appearance.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
---
title: "appearance"
subtitle: "Function in std::solid"
excerpt: "Set the appearance of a solid. This only works on solids, not sketches or individual paths."
excerpt: "Set the appearance of a solid, imported geometry, or plane. This does not work on sketches or individual paths."
layout: manual
---

Set the appearance of a solid. This only works on solids, not sketches or individual paths.
Set the appearance of a solid, imported geometry, or plane. This does not work on sketches or individual paths.

```kcl
appearance(
@solids: [Solid; 1+] | ImportedGeometry,
@solids: [Solid; 1+] | ImportedGeometry | Plane,
color: string,
metalness?: number(_),
roughness?: number(_),
opacity?: number(_),
): [Solid; 1+] | ImportedGeometry
): [Solid; 1+] | ImportedGeometry | Plane
```

This will work on any solid, including extruded solids, revolved solids, and shelled solids.
For planes, only `color` is used.

### Arguments

| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `solids` | [[`Solid`](/docs/kcl-std/types/std-types-Solid); 1+] or [`ImportedGeometry`](/docs/kcl-std/types/std-types-ImportedGeometry) | The The solid(s) whose appearance is being set. | Yes |
| `solids` | [[`Solid`](/docs/kcl-std/types/std-types-Solid); 1+] or [`ImportedGeometry`](/docs/kcl-std/types/std-types-ImportedGeometry) or [`Plane`](/docs/kcl-std/types/std-types-Plane) | The solid(s), imported geometry, or plane whose appearance is being set. | Yes |
| `color` | [`string`](/docs/kcl-std/types/std-types-string) | Color of the new material, a hex string like '#ff0000'. | Yes |
| `metalness` | [`number(_)`](/docs/kcl-std/types/std-types-number) | Metalness of the new material, a percentage like 95.7. | No |
| `roughness` | [`number(_)`](/docs/kcl-std/types/std-types-number) | Roughness of the new material, a percentage like 95.7. | No |
| `opacity` | [`number(_)`](/docs/kcl-std/types/std-types-number) | Opacity. Defaults to 100 (totally opaque). 0 would be totally transparent. | No |

### Returns

[[`Solid`](/docs/kcl-std/types/std-types-Solid); 1+] or [`ImportedGeometry`](/docs/kcl-std/types/std-types-ImportedGeometry)
[[`Solid`](/docs/kcl-std/types/std-types-Solid); 1+] or [`ImportedGeometry`](/docs/kcl-std/types/std-types-ImportedGeometry) or [`Plane`](/docs/kcl-std/types/std-types-Plane)


### Examples
Expand Down Expand Up @@ -348,4 +349,24 @@ cube
>
</model-viewer>

```kcl
offsetPlane(XZ, offset = 4mm)
|> appearance(color = "#ff0000", opacity = 50)

```


<model-viewer
class="kcl-example"
alt="Example showing a rendered KCL program that uses the appearance function"
src="/kcl-test-outputs/models/serial_test_example_fn_std-solid-appearance10_output.gltf"
ar
environment-image="/moon_1k.hdr"
poster="/kcl-test-outputs/serial_test_example_fn_std-solid-appearance10.png"
shadow-intensity="1"
camera-controls
touch-action="pan-y"
>
</model-viewer>


Loading