mirror of
https://github.com/jdegenstein/jmwright-CQ-Editor.git
synced 2025-12-19 14:14:13 +01:00
add doc for name and rand_color in show_object to README.md
This commit is contained in:
@@ -58,10 +58,12 @@ pip install git+https://github.com/gumyr/build123d
|
||||
|
||||
### Showing Objects
|
||||
|
||||
By default, CQ-editor will display a 3D representation of all `Workplane` objects in a script with a default color and alpha (transparency). To have more control over what is shown, and what the color and alpha settings are, the `show_object` method can be used. `show_object` tells CQ-editor to explicity display an object, and accepts the `options` parameter. The `options` parameter is a dictionary of rendering options named `alpha` and `color`. `alpha` is scaled between 0.0 and 1.0, with 0.0 being completely opaque and 1.0 being completely transparent. The color is set using R (red), G (green) and B (blue) values, and each one is scaled from 0 to 255. Either option or both can be omitted.
|
||||
By default, CQ-editor will display a 3D representation of all `Workplane` objects in a script with a default color and alpha (transparency). To have more control over what is shown, and what the color and alpha settings are, the `show_object` method can be used. `show_object` tells CQ-editor to explicity display an object, and accepts the `options` parameter. The `options` parameter is a dictionary of rendering options named `alpha` and `color`. `alpha` is scaled between 0.0 and 1.0, with 0.0 being completely opaque and 1.0 being completely transparent. The color is set using R (red), G (green) and B (blue) values, and each one is scaled from 0 to 255. Either option or both can be omitted. The `name` parameter can assign a custom name which will appear in the objects pane of CQ-editor.
|
||||
|
||||
```python
|
||||
show_object(result, options={"alpha":0.5, "color": (64, 164, 223)})
|
||||
show_object(result, name="somename", options={"alpha":0.5, "color": (64, 164, 223)})
|
||||
# or using rand_color:
|
||||
show_object(result, name="somename", options=rand_color(alpha=.5))
|
||||
```
|
||||
|
||||
Note that `show_object` works for `Shape` and `TopoDS_Shape` objects too. In order to display objects from the embedded Python console use `show`.
|
||||
|
||||
Reference in New Issue
Block a user