* Revert "Revert multi-profile (#4812)"
This reverts commit efe8089b08
.
* fix poor 1000ms wait UX
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* trigger CI
* Add Rust side artifacts for startSketchOn face or plane (#4834)
* Add Rust side artifacts for startSketchOn face or plane
* move ast digging
---------
Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
* lint
* lint
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores)
* trigger CI
* chore: disabled file watcher which prevents faster file write (#4835)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* partial fixes
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* Fix up all the tests
* Fix partial execution
* wip
* WIP
* wip
* rust changes to make three point confrom to same as others since we're not ready with name params yet
* most of the fix for 3 point circle
* get overlays working for circle three point
* fmt
* fix types
* cargo fmt
* add face codef ref for walls and caps
* fix sketch on face after updates to rust side artifact graph
* some things needed for multi-profile tests
* bad attempts at fixing rust
* more
* more
* fix rust
* more rust fixes
* overlay fix
* remove duplicate test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* lint and typing
* maybe fix a unit test
* small thing
* fix circ dep
* fix unit test
* fix some tests
* fix sweep point-and-click test
* fix more tests and add a fix me
* fix more tests
* fix electron specific test
* tsc
* more test tweaks
* update docs
* commint snaps?
* is clippy happy now?
* clippy again
* test works now without me changing anything big-fixed-itself
* small bug
* make three point have cross hair to make it consistent with othe rtools
* fix up state diagram
* fmt
* add draft point for first click of three point circ
* 1 test for three point circle
* 2 test for three point circle
* clean up
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* remove bad doc comment
* remove test skip
* remove onboarding test changes
* Update src/lang/modifyAst.ts
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Update output from simulation tests
* Fix to use correct source ranges
This also reduces cloning.
* Change back to skipping face cap none and both
* Update output after changing back to skipping none and both
* Fix clippy warning
* fix profile start snap bug
* add path ids to cap
* fix going into edit sketch
* make other startSketchOn's work
* fix snapshot test
* explain function name
* Update src/lib/rectangleTool.ts
Co-authored-by: Frank Noirot <frank@zoo.dev>
* rename error
* remove file tree from diff
* Update src/clientSideScene/segments.ts
Co-authored-by: Frank Noirot <frank@zoo.dev>
* nit
* Prevent double write to KCL code on revolve
* Update output after adding cap-to-path graph edge
* Fix edit/select sketch-on-cap via feature tree
* clean up for face codeRef
* fix changing tools part way through circle/rect tools
* fix delete of circle profile
* fix close profiles
* fix closing profile bug (tangentArcTo being ignored)
* remove stale comment
* Delete paths associated with sketch when the sketch plane is deleted
* Add support for deleting sketches on caps (not walls)
* get delet working for walls
* make delet of extrusions work for multi profile
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Delete the sketch statement too on the cap and wall cases
* Don't write to file in `split-sketch-pipe-if-needed` unless necessary
* Don't wait for file write to complete within `updateEditorWithAstAndWriteToFile`
It is already debounced internally. If we await it, we will have to wait for a debounced timeout
* docs
* fix circ dep
* tsc
* fix selection enter sketch weirdness
* test fixes
* comment out and fixme for delete related tests
* add skip wins
* try and get last test to pass
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
Co-authored-by: 49lf <ircsurfer33@gmail.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
205 lines
734 KiB
Markdown
205 lines
734 KiB
Markdown
---
|
|
title: "appearance"
|
|
excerpt: "Set the appearance of a solid. This only works on solids, not sketches or individual paths."
|
|
layout: manual
|
|
---
|
|
|
|
Set the appearance of a solid. This only works on solids, not sketches or individual paths.
|
|
|
|
This will work on any solid, including extruded solids, revolved solids, and shelled solids.
|
|
|
|
```js
|
|
appearance(solid_set: SolidSet, color: String, metalness?: number, roughness?: number) -> SolidSet
|
|
```
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `solid_set` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) whose appearance is being set | Yes |
|
|
| `color` | `String` | Color of the new material, a hex string like '#ff0000' | Yes |
|
|
| `metalness` | `number` | Metalness of the new material, a percentage like 95.7. | No |
|
|
| `roughness` | `number` | Roughness of the new material, a percentage like 95.7. | No |
|
|
|
|
### Returns
|
|
|
|
[`SolidSet`](/docs/kcl/types/SolidSet) - A solid or a group of solids.
|
|
|
|
|
|
### Examples
|
|
|
|
```js
|
|
// Add color to an extruded solid.
|
|
exampleSketch = startSketchOn("XZ")
|
|
|> startProfileAt([0, 0], %)
|
|
|> line(endAbsolute = [10, 0])
|
|
|> line(endAbsolute = [0, 10])
|
|
|> line(endAbsolute = [-10, 0])
|
|
|> close()
|
|
|
|
example = extrude(exampleSketch, length = 5)
|
|
// There are other options besides 'color', but they're optional.
|
|
|> appearance(color = '#ff0000')
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// Add color to a revolved solid.
|
|
sketch001 = startSketchOn('XY')
|
|
|> circle({ center = [15, 0], radius = 5 }, %)
|
|
|> revolve({ angle = 360, axis = 'y' }, %)
|
|
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// Add color to different solids.
|
|
fn cube(center) {
|
|
return startSketchOn('XY')
|
|
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|
|
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|
|
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|
|
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|
|
|> close()
|
|
|> extrude(length = 10)
|
|
}
|
|
|
|
example0 = cube([0, 0])
|
|
example1 = cube([20, 0])
|
|
example2 = cube([40, 0])
|
|
|
|
appearance(
|
|
[example0, example1],
|
|
color = '#ff0000',
|
|
metalness = 50,
|
|
roughness = 50,
|
|
)
|
|
appearance(
|
|
example2,
|
|
color = '#00ff00',
|
|
metalness = 50,
|
|
roughness = 50,
|
|
)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// You can set the appearance before or after you shell it will yield the same result.
|
|
// This example shows setting the appearance _after_ the shell.
|
|
firstSketch = startSketchOn('XY')
|
|
|> startProfileAt([-12, 12], %)
|
|
|> line(end = [24, 0])
|
|
|> line(end = [0, -24])
|
|
|> line(end = [-24, 0])
|
|
|> close()
|
|
|> extrude(length = 6)
|
|
|
|
shell(firstSketch, faces = ['end'], thickness = 0.25)
|
|
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// You can set the appearance before or after you shell it will yield the same result.
|
|
// This example shows setting the appearance _before_ the shell.
|
|
firstSketch = startSketchOn('XY')
|
|
|> startProfileAt([-12, 12], %)
|
|
|> line(end = [24, 0])
|
|
|> line(end = [0, -24])
|
|
|> line(end = [-24, 0])
|
|
|> close()
|
|
|> extrude(length = 6)
|
|
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)
|
|
|
|
shell(firstSketch, faces = ['end'], thickness = 0.25)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.
|
|
// This example shows _before_ the pattern.
|
|
exampleSketch = startSketchOn('XZ')
|
|
|> startProfileAt([0, 0], %)
|
|
|> line(end = [0, 2])
|
|
|> line(end = [3, 1])
|
|
|> line(end = [0, -4])
|
|
|> close()
|
|
|
|
example = extrude(exampleSketch, length = 1)
|
|
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)
|
|
|> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.
|
|
// This example shows _after_ the pattern.
|
|
exampleSketch = startSketchOn('XZ')
|
|
|> startProfileAt([0, 0], %)
|
|
|> line(end = [0, 2])
|
|
|> line(end = [3, 1])
|
|
|> line(end = [0, -4])
|
|
|> close()
|
|
|
|
example = extrude(exampleSketch, length = 1)
|
|
|> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)
|
|
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// Color the result of a 2D pattern that was extruded.
|
|
exampleSketch = startSketchOn('XZ')
|
|
|> startProfileAt([.5, 25], %)
|
|
|> line(end = [0, 5])
|
|
|> line(end = [-1, 0])
|
|
|> line(end = [0, -5])
|
|
|> close()
|
|
|> patternCircular2d(
|
|
center = [0, 0],
|
|
instances = 13,
|
|
arcDegrees = 360,
|
|
rotateDuplicates = true,
|
|
)
|
|
|
|
example = extrude(exampleSketch, length = 1)
|
|
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// Color the result of a sweep.
|
|
|
|
|
|
// Create a path for the sweep.
|
|
sweepPath = startSketchOn('XZ')
|
|
|> startProfileAt([0.05, 0.05], %)
|
|
|> line(end = [0, 7])
|
|
|> tangentialArc({ offset = 90, radius = 5 }, %)
|
|
|> line(end = [-3, 0])
|
|
|> tangentialArc({ offset = -90, radius = 5 }, %)
|
|
|> line(end = [0, 7])
|
|
|
|
pipeHole = startSketchOn('XY')
|
|
|> circle({ center = [0, 0], radius = 1.5 }, %)
|
|
|
|
sweepSketch = startSketchOn('XY')
|
|
|> circle({ center = [0, 0], radius = 2 }, %)
|
|
|> hole(pipeHole, %)
|
|
|> sweep(path = sweepPath)
|
|
|> appearance(color = "#ff0000", metalness = 50, roughness = 50)
|
|
```
|
|
|
|

|
|
|
|
|