ocp-vscode 2.3.2__tar.gz → 2.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/PKG-INFO +2 -2
  2. ocp_vscode-2.4.1/README.md +253 -0
  3. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode/__init__.py +1 -1
  4. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode/backend.py +41 -19
  5. ocp_vscode-2.4.1/ocp_vscode/backend_logo.py +4 -0
  6. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode/build123d.py +179 -39
  7. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode/colors.py +6 -0
  8. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode/comms.py +13 -16
  9. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode/config.py +2 -8
  10. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode/show.py +114 -71
  11. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode.egg-info/PKG-INFO +2 -2
  12. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode.egg-info/SOURCES.txt +1 -0
  13. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode.egg-info/requires.txt +1 -1
  14. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/setup.cfg +1 -1
  15. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/setup.py +2 -2
  16. ocp_vscode-2.3.2/README.md +0 -249
  17. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/LICENSE +0 -0
  18. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode/animation.py +0 -0
  19. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode/daemonize.py +0 -0
  20. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode/state.py +0 -0
  21. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode.egg-info/dependency_links.txt +0 -0
  22. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode.egg-info/not-zip-safe +0 -0
  23. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/ocp_vscode.egg-info/top_level.txt +0 -0
  24. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/test/test_for_backend.py +0 -0
  25. {ocp_vscode-2.3.2 → ocp_vscode-2.4.1}/test/testextension.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ocp_vscode
3
- Version: 2.3.2
3
+ Version: 2.4.1
4
4
  Summary: OCP CAD Viewer for VSCode
5
5
  Home-page: https://github.com/bernhard-42/vscode-ocp-cad-viewer
6
6
  Author: Bernhard Walter
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Requires-Python: >=3.9
19
19
  License-File: LICENSE
20
- Requires-Dist: ocp-tessellate<2.4.0,>=2.3.2
20
+ Requires-Dist: ocp-tessellate<3.1.0,>=3.0.0
21
21
  Requires-Dist: requests
22
22
  Requires-Dist: ipykernel
23
23
  Requires-Dist: orjson
@@ -0,0 +1,253 @@
1
+ # _OCP CAD Viewer_ for VS Code
2
+
3
+ _OCP CAD Viewer_ for VS Code is an extension to show [CadQuery](https://github.com/cadquery/cadquery) and [build123d](https://github.com/gumyr/build123d) objects in VS Code via the [three-cad-viewer](https://github.com/bernhard-42/three-cad-viewer) viewer component.
4
+
5
+ ## Installation
6
+
7
+ ### Prerequisites
8
+
9
+ - A fairly recent version of Microsoft VS Code, e.g. 1.85.0 or newer
10
+ - The [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) installed in VS Code
11
+ - Necessary tools:
12
+ - `python` and `pip` available in the Python enviroment that will be used for CAD development
13
+ - The command `git` needs to be available
14
+ - On a Silicon Apple computer the command `mamba` needs to be available. You might want to consider using [Mambaforge](https://github.com/conda-forge/miniforge#mambaforge).
15
+
16
+ **Notes**:
17
+
18
+ - To use OCP CAD Viewer, start VS Code from the commandline in the Python environment you want to use or select the right Python interpreter in VS Code first. **OCP CAD Viewer depends on VS Code using the right Python interpreter** (i.e. mamba / conda / pyenv / poetry / ... environment).
19
+ - For VSCodium, the extension is not available in the VS code market place. You need to download the the vsix file from the [release folder](https://github.com/bernhard-42/vscode-ocp-cad-viewer/releases) and install it manually.
20
+ - Currently, on a Silicon Mac (ARM CPU), _OCP_ and _CadQuery_ can only be installed via `mamba`, see 3. below.
21
+
22
+ ### Installation
23
+
24
+ 1. Open the VS Code Marketplace, and search and install _OCP CAD Viewer 2.4.1_.
25
+
26
+ Afterwards the OCP viewer is available in the VS Code sidebar:
27
+
28
+ ![](screenshots/ocp_icon.png)
29
+
30
+ 2. Clicking on it shows the OCP CAD Viewer UI with the viewer manager and the library manager:
31
+
32
+ ![](screenshots/init.png)
33
+
34
+ You have 3 options:
35
+
36
+ - Prepare _OCP CAD Viewer_ for working with [build123d](https://github.com/gumyr/build123d): Presse the _Quickstart build123d_ button.
37
+
38
+ This will install _OCP_, _build123d_, _ipykernel_ (_jupyter_client_), _ocp_tessellate_ and _ocp_vscode_ via `pip` (except for Apple Silicon machines that require `mamba` and will also install _cadquery_)
39
+
40
+ ![](screenshots/build123d_installed.png)
41
+
42
+ - Prepare _OCP CAD Viewer_ for working with [CadQuery](https://github.com/cadquery/cadquery): Presse the _Quickstart CadQuery_ button.
43
+
44
+ This will install _OCP_, _CadQuery_, _ipykernel_ (_jupyter_client_), _ocp_tessellate_ and _ocp_vscode_ via `pip` (except for Apple Silicon machines that require `mamba`)
45
+
46
+ ![](screenshots/cadquery_installed.png)
47
+
48
+ - Ignore the quick starts and use the "Library Manager" to install the libraries. Doing so, _OCP CAD Viewer_ let's you select whether to use `pip`, `mamba`, `conda` or `poetry`. Install the needed library by pressing the green down-arrow behind the library name in the "Library Manager" section of the _OCP CAD Viewer_ sidebar. For more details, see [here](./docs/install.md)
49
+
50
+ The Quickstarts will also
51
+
52
+ - (optionally) install the the [Jupyter extension for VS Code from Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter)
53
+ - start the OCP viewer
54
+ - create a demo file in a temporary folder to quickly see a simple usage example
55
+
56
+ 3. On Silicon Macs (ARM CPU)
57
+
58
+ - Install Miniforge
59
+ - Option 1: Download and install from the [Miniforge](https://github.com/conda-forge/miniforge?tab=readme-ov-file#download) github page
60
+ - Option 2: Use `homebrew`: `brew install miniforge`
61
+ - Initialize your shell for `mamba`: `mamba init $(basename "$SHELL")`
62
+ - Create an environment, e.g named `code_cad` with Python 3.10: `mamba create -n code_cad python=3.10`
63
+ - Activate the environment: `mamba activate code_cad`
64
+ - Start VS Code from your working folder: `code .`
65
+ - Install the Python extension in VS Code
66
+ - Continue with 1. above
67
+
68
+ **Note:** Do not use the _OCP CAD Viewer_ logo to verify your _OCP CAD Viewer_ settings! The logo overwrites all your settings in VS Code with its own settings to always look the same on each instance. Use a simple own model for checking your conmfiguration
69
+
70
+ ## Usage
71
+
72
+ ### Running code using Jupyter
73
+
74
+ - Start the _OCP CAD Viewer_ by pressing the green box-arrow button in the "Viewer Manager" section of the _OCP CAD Viewer_ sidebar
75
+ - Import ocp_vscode and the CAD library by using the paste button behing the library names in the "Viewer Manager" section
76
+ - Use the usual Run menu to run the code
77
+
78
+ ![Running code](screenshots/ocp_vscode_run.png)
79
+
80
+ ### Debugging code with visual debugging
81
+
82
+ After each step, the debugger checks all variables in `locals()` for being CAD objects and displays them with their variable name.
83
+ Note:
84
+
85
+ - Check that `OCP:on` is visible in the status bar
86
+ - It also shows planes, locations and axis, so name your contexts
87
+ - It remembers camera position and unselected variables in the tree
88
+ - during debugging, `show` and `show_object` are disabled. They interfere with the visual debugging
89
+
90
+ ![Debugging code](screenshots/ocp_vscode_debug.png)
91
+
92
+ ### Library Manager
93
+
94
+ You can also use "Library Manager" in the _OCP CAD Viewer_ sidebar to manage the Python libraries for _build123d_, _cadquery_, _ipython_ and _ocp_tessellate_ (Presse the green arrow whenhovering over a library to install/upgrade it)
95
+
96
+ ### Extra topics
97
+
98
+ - [Quickstart experience on Windows](docs/quickstart.md)
99
+ - [Use Jupyter to execute code](docs/run.md)
100
+ - [Debug code with visual debugging](docs/debug.md)
101
+ - [Measure mode](docs/measure.md)
102
+ - [Use the `show` command](docs/show.md)
103
+ - [Use the `show_object` command](docs/show_object.md)
104
+ - [Use the `set_viewer_config` command](docs/set_viewer_config.md)
105
+ - [Download examples for build123d or cadquery](docs/examples.md)
106
+ - [Use the build123d snippets](docs/snippets.md)
107
+
108
+ ## Best practices
109
+
110
+ - Use the **Jupyter extension** for a more interactive experience. This allows to have one cell (separated by `# %%`) at the beginning to import all libraries
111
+
112
+ ```python
113
+ # %%
114
+ from build123d import *
115
+ from ocp_vscode import *
116
+
117
+ # %%
118
+ b = Box(1,2,3)
119
+ show(b)
120
+ # %%
121
+ ```
122
+
123
+ and then only execute the code in the cell you are currently working on repeatedly.
124
+
125
+ - The **config system** of OCP CAD Viewer
126
+
127
+ There are 3 levels:
128
+
129
+ - Workspace configuration (part of the VS Code settings, you can access them e.g. via the green gear symbol in OCP CAD Viewer's "Viewer Manager")
130
+ - Defaults set with the command `set_defaults` per Python file
131
+ - Parameters in `show` or `show_object` per command
132
+
133
+ `set_defaults` overrides the Workspace settings and parameters in `show` and `show_config` override the other two.
134
+
135
+ Note that not all parameters are available in the global Workspace config, since they don't make sense globally (e.g. `helper_scale` which depends on the size of the boundary box of the currently shown object)
136
+
137
+ A common setup would be
138
+
139
+ ```python
140
+ # %%
141
+ from build123d import *
142
+ import cadquery as cq
143
+
144
+ from ocp_vscode import *
145
+ set_port(3939)
146
+
147
+ set_defaults(reset_camera=False, helper_scale=5)
148
+
149
+ # %%
150
+ ...
151
+ ```
152
+
153
+ Explanation
154
+
155
+ - The first block imports build123d and CadQuery (omit what you are not interested in).
156
+ - The second block imports all commands for OCP CAD Viewer. `set_port` is only needed when you have more than one viewer open and can be omitted for the first viewer)
157
+ - The third block as an example sets helper_scale and reset_camera as defaults. Then every show_object or show command will respect it as the default
158
+
159
+ - Debugging build123d with `show_all` and the **visual debugger**
160
+
161
+ - If you name your contexts (including `Location` contexts), the visual debugger will show the CAD objects assigned to the context.
162
+
163
+ - Use `show_all` to show all cad objects in the current scope (`locals()`) of the Python interpreter (btw. the visual debugger uses `show_all` at each step)
164
+
165
+ ```python
166
+ # %%
167
+ from build123d import *
168
+ set_defaults(helper_scale=1, transparent=True)
169
+
170
+ with BuildPart() as bp:
171
+ with PolarLocations(3,8) as locs:
172
+ Box(1,1,1)
173
+
174
+ show_all()
175
+ # %%
176
+ ```
177
+
178
+ ![named contexts](./screenshots/context_vars.png)
179
+
180
+ - **Keep camera orientation** of an object with `reset_camera`
181
+
182
+ Sometimes it is helpful to keep the orientation of an object across code changes. This is what `reset_camera` does:
183
+
184
+ - `reset_camera=Camera.Center` will keep position and rotation, but ignore panning. This means the new object will be repositioned to the center (most robust approach)
185
+ - `reset_camera=Camera.KEEP` will keep position, rotation and panning. However, panning can be problematic. When the next object to be shown is much larger or smaller and the object before was panned, it can happen that nothing is visible (the new object at the pan location is outside of the viewer frustum). OCP CAD Viewer checks whether the bounding box of an object is 2x smaller or larger than the one of the last shown object. If so, it falls back to `Camera.CENTER`. A notification is written to the OCP CAD Viewer output panel.
186
+ - `reset_camera=Camera.RESET` will ensure that position, rotation and panning will be reset to the initial default
187
+
188
+ ## Development
189
+
190
+ Testing:
191
+
192
+ Native tessellator can be set via `NATIVE_TESSELLATOR=1`and Python tessellator via `NATIVE_TESSELLATOR=0`.
193
+
194
+ When `OCP_VSCODE_PYTEST=1` is set, `show` will not send the tessellated results to the viewer, but return it to the caller for inspection.
195
+
196
+ A full test cycle consist of:
197
+
198
+ ```bash
199
+ NATIVE_TESSELLATOR=0 OCP_VSCODE_PYTEST=1 pytest -v -s pytests/
200
+ NATIVE_TESSELLATOR=1 OCP_VSCODE_PYTEST=1 pytest -v -s pytests/
201
+ ```
202
+
203
+ ## Troubleshooting
204
+
205
+ - **CAD Models almost always are invisible in the OCP viewer window**
206
+
207
+ ```bash
208
+ three-cad-viewer.esm.js:20276 THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false
209
+
210
+ Material Name:
211
+ Material Type: LineBasicMaterial
212
+
213
+ Program Info Log: Program binary could not be loaded. Binary is not compatible with current driver/hardware combination. Driver build date Mar 19 2024. Please check build information of source that generated the binary.
214
+ Location of variable pc_fragColor conflicts with another variable.
215
+ ```
216
+
217
+ VS Code internal browser that renders the viewer component uses a cache for code and other artifacts. This includes WebGL artefacts like compiled shaders. It can happen that e.g. due to a graphic driver update the compiled version in the cache does not fit to the new driver. Then this error message appears.
218
+
219
+ **Solution:** [Delete the VS Code browser cache on Linux](https://bobbyhadz.com/blog/vscode-clear-cache) (go to the section for your operating system)
220
+
221
+ ## Changes
222
+
223
+ v2.4.1
224
+
225
+ - Fix colormap handling to keep color of objects when .color attribute is set
226
+ - show() ends gracefully and empty lists are treated correctly
227
+
228
+ v2.4.0
229
+
230
+ New features
231
+
232
+ - Removed `measure_tools` parameter and integrated switching between normal and measure mode into the [three-cad-viewer](https://github.com/bernhard-42/three-cad-viewer/blob/master/src/treeview.js) ([#58](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/58)).
233
+ - Rewrote the CAD view tree to use lazy loading (switching to measure mode can increase number of nodes by more then 100 times). This changed the input format for the viewer component (states integrated into object tree now), which is a breaking change if you use threee-cad-viewer directly, but no changes for users of vscode-ocp-cad-viewer.
234
+ - Rewrote converter of [ocp-tessellate](https://github.com/bernhard-42/ocp-tessellate/blob/main/ocp_tessellate/convert.py) to be more consistent and easier to maintain. All solids and faces can now be instances. Breaking changes if you use ocp_tessellate directly, but no changes for users of vscode-ocp-cad-viewer.
235
+ - Added `center_grid` to workspace configuration to ensure grid planes always go through world origin ([#77](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/77)).
236
+ - Added `save_screenshot(filename)` to save a PNG of the currently shown object(s). Canvas only, no CAD tools ([#86](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/86)).
237
+ - Support viewing of build123d `LocationList`s.
238
+
239
+ Fixes
240
+
241
+ - Fixed the mini-build123d `Location` class used by measurement backend.
242
+ - Measure mode cannot work on clipped object, so disabled clipping tab when measure mode is turned on ([#55](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/55), [#70](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/70))
243
+ - Removed using `to_tuple` for build123d Color objects ([#69](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/69)).
244
+ - Made color handling more consistent (sometime `color` or `alpha` was ignored).
245
+ - Fixed opening duplivcate Jupyter notebooks ([#78](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/78)).
246
+ - Fixed measure tool related regression. ([#81](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/81), [82](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/82),).
247
+ - Fixed ImageFace aspect ratio bug ([#83](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/83)).
248
+ - Fixed `show_all` failing on empty ShapeList ([#90](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/90)).
249
+ - Fixed to display ShapeList of Compound correctly ([#91](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/91)).
250
+ - Fixed ShapeList containing different object types ([#92](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/92)).
251
+ - Fixed measure tools to work with 1D objects ([#93](https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/93)).
252
+
253
+ full change log see [CHANGELOG.md](./CHANGELOG.md)
@@ -15,7 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
- __version__ = "2.3.2"
18
+ __version__ = "2.4.1"
19
19
 
20
20
  import os
21
21
 
@@ -13,6 +13,8 @@ from ocp_tessellate.tessellator import (
13
13
  get_vertices,
14
14
  )
15
15
  from ocp_tessellate.trace import Trace
16
+
17
+ from ocp_vscode.backend_logo import logo
16
18
  from ocp_vscode.build123d import (
17
19
  Compound,
18
20
  Edge,
@@ -127,6 +129,7 @@ class PropertiesResponse(MeasureReponse):
127
129
  area: float = None
128
130
  volume: float = None
129
131
  radius: float = None
132
+ radius2: float = None
130
133
  geom_type: str = None
131
134
 
132
135
 
@@ -160,6 +163,8 @@ class ViewerBackend:
160
163
  Start the backend
161
164
  """
162
165
  print("Viewer backend started")
166
+ backend.load_model(logo)
167
+ print("Logo model loaded")
163
168
  listener(self.handle_event)()
164
169
 
165
170
  @error_handler
@@ -218,11 +223,16 @@ class ViewerBackend:
218
223
  loc = (
219
224
  Location().wrapped if v["loc"] is None else tq_to_loc(*v["loc"])
220
225
  )
221
- shape = [
222
- deserialize(base64.b64decode(s.encode("utf-8")))
223
- for s in v["shape"]
224
- ]
225
- compound = make_compound(shape) if len(shape) > 1 else shape[0]
226
+ if isinstance(v["shape"], dict):
227
+ compound = deserialize(
228
+ base64.b64decode(v["shape"]["obj"].encode("utf-8"))
229
+ )
230
+ else:
231
+ shape = [
232
+ deserialize(base64.b64decode(s.encode("utf-8")))
233
+ for s in v["shape"]
234
+ ]
235
+ compound = make_compound(shape) if len(shape) > 1 else shape[0]
226
236
  self.model[id_] = Compound(compound.Moved(loc))
227
237
  faces = get_faces(compound)
228
238
  for i, face in enumerate(faces):
@@ -265,13 +275,20 @@ class ViewerBackend:
265
275
  response.vertex_coords = shape.to_tuple()
266
276
 
267
277
  elif isinstance(shape, Edge):
268
- response.radius = shape.radius if shape.geom_type() in ["CIRCLE"] else None
278
+ response.radius = None
279
+ response.major_radius = None
280
+ response.minor_radius = None
281
+ if shape.geom_type == "CIRCLE":
282
+ response.radius = shape.radius
283
+ elif shape.geom_type == "ELLIPSE":
284
+ response.radius = shape._geom_adaptor().Ellipse().MajorRadius()
285
+ response.radius2 = shape._geom_adaptor().Ellipse().MinorRadius()
286
+
269
287
  response.length = shape.length
270
288
 
271
289
  elif isinstance(shape, Face):
272
- if shape.geom_type() == "CYLINDER":
273
- circle = shape.edges().filter_by("CIRCLE")[0]
274
- response.radius = circle.radius
290
+ if shape.geom_type == "CYLINDER":
291
+ response.radius = shape._geom_adaptor().Cylinder().Radius()
275
292
 
276
293
  response.length = shape.length
277
294
  response.width = shape.width
@@ -280,8 +297,7 @@ class ViewerBackend:
280
297
  elif isinstance(shape, (Solid, Compound)):
281
298
  response.volume = shape.volume
282
299
 
283
- geom_type = shape.geom_type().capitalize()
284
- response.geom_type = geom_type if geom_type != "Vertex" else None
300
+ response.geom_type = shape.geom_type if not isinstance(shape, Vertex) else None
285
301
  center, info = self.get_center(shape, False)
286
302
  response.center = center.to_tuple()
287
303
  response.vertex_coords = response.center
@@ -303,16 +319,22 @@ class ViewerBackend:
303
319
  first = (
304
320
  Plane(shape1)
305
321
  if isinstance(shape1, Face)
306
- else Plane(shape1 @ 0, z_dir=shape1.normal())
307
- if isinstance(shape1, Edge) and shape1.geom_type() in ["CIRCLE", "ELLIPSE"]
308
- else shape1 % 0
322
+ else (
323
+ Plane(shape1 @ 0, z_dir=shape1.normal())
324
+ if isinstance(shape1, Edge)
325
+ and shape1.geom_type in ["CIRCLE", "ELLIPSE"]
326
+ else shape1 % 0
327
+ )
309
328
  )
310
329
  second = (
311
330
  Plane(shape2)
312
331
  if isinstance(shape2, Face)
313
- else Plane(shape2 @ 0, z_dir=shape2.normal())
314
- if isinstance(shape2, Edge) and shape2.geom_type() in ["CIRCLE", "ELLIPSE"]
315
- else shape2 % 0
332
+ else (
333
+ Plane(shape2 @ 0, z_dir=shape2.normal())
334
+ if isinstance(shape2, Edge)
335
+ and shape2.geom_type in ["CIRCLE", "ELLIPSE"]
336
+ else shape2 % 0
337
+ )
316
338
  )
317
339
  if isinstance(first, Plane) and isinstance(second, Plane):
318
340
  angle = first.z_dir.get_angle(second.z_dir)
@@ -349,7 +371,7 @@ class ViewerBackend:
349
371
  if isinstance(shape, Vertex):
350
372
  return shape.center(), SelectedCenterInfo.vertex
351
373
  elif isinstance(shape, Edge):
352
- if shape.geom_type() in [
374
+ if shape.geom_type in [
353
375
  "CIRCLE",
354
376
  "ELLIPSE",
355
377
  ]:
@@ -359,7 +381,7 @@ class ViewerBackend:
359
381
  return shape.center(), SelectedCenterInfo.geom
360
382
 
361
383
  elif isinstance(shape, Face):
362
- if shape.geom_type() in ["CYLINDER"]:
384
+ if shape.geom_type in ["CYLINDER"]:
363
385
  if not for_distance:
364
386
  return shape.center(), SelectedCenterInfo.geom
365
387