Skip to content
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Added support for `frames, circle, ellipse, vector, plane, curve, analystical surface primitives`
* Dot command added

### Changed

### Removed
Expand Down
9 changes: 0 additions & 9 deletions notebooks/00_basics.ipynb
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%pip install -q compas_notebook"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
9 changes: 0 additions & 9 deletions notebooks/10_scene.ipynb
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%pip install -q compas_notebook"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down
65 changes: 17 additions & 48 deletions notebooks/20_geometry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,41 @@
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%pip install -q compas_notebook"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from compas.colors import Color\n",
"from compas.geometry import Circle\n",
"from compas.geometry import Ellipse\n",
"from compas.geometry import Frame\n",
"from compas.geometry import Line\n",
"from compas.geometry import Plane\n",
"from compas.geometry import Point\n",
"from compas.geometry import Pointcloud\n",
"from compas.geometry import Polyline\n",
"from compas.geometry import Vector\n",
"from compas.geometry import SphericalSurface\n",
"from compas.geometry import CylindricalSurface\n",
"from compas_notebook.geometry import Dot\n",
"from compas_notebook.viewer import Viewer"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"cloud = Pointcloud.from_bounds(x=8, y=5, z=3, n=13)\n",
"\n",
"point = Point(-1, 2, 3)\n",
"line = Line([0, 0, 0], point)\n",
"polyline = Polyline(cloud.points)"
]
"source": "point = Point(-1, 2, 3)\nvector = Vector(1, 1, 2)\nplane = Plane([0, 0, -1], [0, 0, 1])\nframe = Frame(point, [1, 0, 0], [0, 1, 0])\n\nline = Line([0, 0, 0], point)\ncloud = Pointcloud.from_bounds(x=8, y=5, z=3, n=13)\npolyline = Polyline(cloud.points)\n\n# quadric curves\ncircle = Circle(radius=1.5, frame=Frame([2, 0, 0], [0, 1, 0], [0, 0, 1]))\nellipse = Ellipse(major=2.0, minor=1.0, frame=Frame([5, 0, 0], [0, 1, 0], [0, 0, 1]))\n\n# Create analytical surfaces\nsphere_surface = SphericalSurface(radius=1.5, frame=Frame([0, 0, 0], [1, 0, 0], [0, 1, 0]))\ncylinder_surface = CylindricalSurface(radius=0.8, frame=Frame([3, 0, 0], [1, 0, 0], [0, 1, 0]))\n\n# Dot: text label at a point (constant screen size)\ndot = Dot([8, 5, 3], \"Corner\")"
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a55820df515f4eb0a67494e16869aac2",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(Button(icon='search-plus', layout=Layout(height='32px', width='48px'), style=But…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"viewer = Viewer()\n",
"\n",
"viewer.scene.add(point, color=Color.red(), pointsize=0.3)\n",
"viewer.scene.add(line)\n",
"viewer.scene.add(polyline, color=Color.blue())\n",
"viewer.scene.add(cloud, color=Color.green(), pointsize=0.3)\n",
"\n",
"viewer.show()"
]
"outputs": [],
"source": "viewer = Viewer()\n\nviewer.scene.add(point, color=Color.red(), pointsize=0.3)\nviewer.scene.add(line)\nviewer.scene.add(frame)\nviewer.scene.add(polyline, color=Color.blue())\nviewer.scene.add(cloud, color=Color.green(), pointsize=0.3)\nviewer.scene.add(circle, color=Color.red())\nviewer.scene.add(ellipse, color=Color.green())\nviewer.scene.add(vector)\nviewer.scene.add(plane)\nviewer.scene.add(sphere_surface, color=Color.cyan())\nviewer.scene.add(cylinder_surface, color=Color.magenta())\nviewer.scene.add(dot, color=Color.black())\n\nviewer.show()"
}
],
"metadata": {
"kernelspec": {
"display_name": "compas2",
"display_name": "compas_opzuid",
"language": "python",
"name": "python3"
},
Expand All @@ -84,9 +53,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.1"
"version": "3.12.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
"nbformat_minor": 4
}
9 changes: 0 additions & 9 deletions notebooks/30_shapes.ipynb
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%pip install -q compas_notebook"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down
17 changes: 0 additions & 17 deletions notebooks/60_breps.ipynb
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"%pip install -q compas_notebook"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down
9 changes: 0 additions & 9 deletions notebooks/70_graphs.ipynb
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%pip install -q compas_notebook"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down
17 changes: 0 additions & 17 deletions notebooks/80_groups.ipynb
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"%pip install -q compas_notebook"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down
2 changes: 2 additions & 0 deletions src/compas_notebook/conversions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .geometry import box_to_threejs
from .geometry import cone_to_threejs
from .geometry import cylinder_to_threejs
from .geometry import dot_to_threejs
from .geometry import line_to_threejs
from .geometry import point_to_threejs
from .geometry import pointcloud_to_threejs
Expand All @@ -26,6 +27,7 @@
"color_to_threejs",
"cone_to_threejs",
"cylinder_to_threejs",
"dot_to_threejs",
"line_to_threejs",
"nodes_and_edges_to_threejs",
"nodes_to_threejs",
Expand Down
Loading