Skip to content

Commit 34cfe79

Browse files
authored
Merge pull request #6 from jf---/jf/no-pip-cell
coverage for all compas primitives
2 parents e17bb03 + 2ff3694 commit 34cfe79

22 files changed

+676
-141
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
* Added support for `frames, circle, ellipse, vector, plane, curve, analystical surface primitives`
13+
* Dot command added
14+
1215
### Changed
1316

1417
### Removed

notebooks/00_basics.ipynb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": 1,
6-
"metadata": {},
7-
"outputs": [],
8-
"source": [
9-
"%pip install -q compas_notebook"
10-
]
11-
},
123
{
134
"cell_type": "markdown",
145
"metadata": {},

notebooks/10_scene.ipynb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": 1,
6-
"metadata": {},
7-
"outputs": [],
8-
"source": [
9-
"%pip install -q compas_notebook"
10-
]
11-
},
123
{
134
"cell_type": "code",
145
"execution_count": 2,

notebooks/20_geometry.ipynb

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,72 +5,41 @@
55
"execution_count": 1,
66
"metadata": {},
77
"outputs": [],
8-
"source": [
9-
"%pip install -q compas_notebook"
10-
]
11-
},
12-
{
13-
"cell_type": "code",
14-
"execution_count": 2,
15-
"metadata": {},
16-
"outputs": [],
178
"source": [
189
"from compas.colors import Color\n",
10+
"from compas.geometry import Circle\n",
11+
"from compas.geometry import Ellipse\n",
12+
"from compas.geometry import Frame\n",
1913
"from compas.geometry import Line\n",
14+
"from compas.geometry import Plane\n",
2015
"from compas.geometry import Point\n",
2116
"from compas.geometry import Pointcloud\n",
2217
"from compas.geometry import Polyline\n",
18+
"from compas.geometry import Vector\n",
19+
"from compas.geometry import SphericalSurface\n",
20+
"from compas.geometry import CylindricalSurface\n",
21+
"from compas_notebook.geometry import Dot\n",
2322
"from compas_notebook.viewer import Viewer"
2423
]
2524
},
2625
{
2726
"cell_type": "code",
28-
"execution_count": 3,
27+
"execution_count": null,
2928
"metadata": {},
3029
"outputs": [],
31-
"source": [
32-
"cloud = Pointcloud.from_bounds(x=8, y=5, z=3, n=13)\n",
33-
"\n",
34-
"point = Point(-1, 2, 3)\n",
35-
"line = Line([0, 0, 0], point)\n",
36-
"polyline = Polyline(cloud.points)"
37-
]
30+
"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\")"
3831
},
3932
{
4033
"cell_type": "code",
41-
"execution_count": 4,
34+
"execution_count": null,
4235
"metadata": {},
43-
"outputs": [
44-
{
45-
"data": {
46-
"application/vnd.jupyter.widget-view+json": {
47-
"model_id": "a55820df515f4eb0a67494e16869aac2",
48-
"version_major": 2,
49-
"version_minor": 0
50-
},
51-
"text/plain": [
52-
"VBox(children=(HBox(children=(Button(icon='search-plus', layout=Layout(height='32px', width='48px'), style=But…"
53-
]
54-
},
55-
"metadata": {},
56-
"output_type": "display_data"
57-
}
58-
],
59-
"source": [
60-
"viewer = Viewer()\n",
61-
"\n",
62-
"viewer.scene.add(point, color=Color.red(), pointsize=0.3)\n",
63-
"viewer.scene.add(line)\n",
64-
"viewer.scene.add(polyline, color=Color.blue())\n",
65-
"viewer.scene.add(cloud, color=Color.green(), pointsize=0.3)\n",
66-
"\n",
67-
"viewer.show()"
68-
]
36+
"outputs": [],
37+
"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()"
6938
}
7039
],
7140
"metadata": {
7241
"kernelspec": {
73-
"display_name": "compas2",
42+
"display_name": "compas_opzuid",
7443
"language": "python",
7544
"name": "python3"
7645
},
@@ -84,9 +53,9 @@
8453
"name": "python",
8554
"nbconvert_exporter": "python",
8655
"pygments_lexer": "ipython3",
87-
"version": "3.12.1"
56+
"version": "3.12.12"
8857
}
8958
},
9059
"nbformat": 4,
91-
"nbformat_minor": 2
92-
}
60+
"nbformat_minor": 4
61+
}

notebooks/30_shapes.ipynb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": 1,
6-
"metadata": {},
7-
"outputs": [],
8-
"source": [
9-
"%pip install -q compas_notebook"
10-
]
11-
},
123
{
134
"cell_type": "code",
145
"execution_count": 2,

notebooks/60_breps.ipynb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": 1,
6-
"metadata": {},
7-
"outputs": [
8-
{
9-
"name": "stdout",
10-
"output_type": "stream",
11-
"text": [
12-
"Note: you may need to restart the kernel to use updated packages.\n"
13-
]
14-
}
15-
],
16-
"source": [
17-
"%pip install -q compas_notebook"
18-
]
19-
},
203
{
214
"cell_type": "code",
225
"execution_count": 2,

notebooks/70_graphs.ipynb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": 1,
6-
"metadata": {},
7-
"outputs": [],
8-
"source": [
9-
"%pip install -q compas_notebook"
10-
]
11-
},
123
{
134
"cell_type": "code",
145
"execution_count": 2,

notebooks/80_groups.ipynb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": 1,
6-
"metadata": {},
7-
"outputs": [
8-
{
9-
"name": "stdout",
10-
"output_type": "stream",
11-
"text": [
12-
"Note: you may need to restart the kernel to use updated packages.\n"
13-
]
14-
}
15-
],
16-
"source": [
17-
"%pip install -q compas_notebook"
18-
]
19-
},
203
{
214
"cell_type": "code",
225
"execution_count": 2,

src/compas_notebook/conversions/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .geometry import box_to_threejs
44
from .geometry import cone_to_threejs
55
from .geometry import cylinder_to_threejs
6+
from .geometry import dot_to_threejs
67
from .geometry import line_to_threejs
78
from .geometry import point_to_threejs
89
from .geometry import pointcloud_to_threejs
@@ -26,6 +27,7 @@
2627
"color_to_threejs",
2728
"cone_to_threejs",
2829
"cylinder_to_threejs",
30+
"dot_to_threejs",
2931
"line_to_threejs",
3032
"nodes_and_edges_to_threejs",
3133
"nodes_to_threejs",

0 commit comments

Comments
 (0)