CadQuery / CadQuery/cadquery

Multimethod 1.10 causes issues [was: 'sweep' end in 'TypeError: typing_extensions.Literal cannot be used with isinstance()']

Open
#1,431 18 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

Simple example:
```py
import cadquery as cq

r = 0.5 # Radius of the helix
p = 0.4 # Pitch of the helix - vertical distance between loops
h = 2.4 # Height of the helix - total height

# Helix
wire = cq.Wire.makeHelix(pitch=p, height=h, radius=r)
helix = cq.Workplane(obj=wire)

# Final result: A 2D shape swept along a helix.
result = (
cq.Workplane("XZ") # helix is moving up the Z axis
.center(r, 0) # offset rect
.rect(0.15, 0.15)
.sweep(helix, isFrenet=True) # Frenet keeps orientation as expected
)

show_object(result)
```

ends with:

```
Traceback (most recent call last):
File "/cq-editor/lib/python3.9/site-packages/cq_cli/main.py", line 36, in build_and_parse
raise (build_result.exception)
File "/cq-editor/lib/python3.9/site-packages/cadquery/cqgi.py", line 119, in build
exec(c, env)
File "", line 32, in
File "/cq-editor/lib/python3.9/site-packages/cadquery/cq.py", line 3196, in sweep
r = self._sweep(
File "/cq-editor/lib/python3.9/site-packages/cadquery/cq.py", line 3804, in _sweep
thisObj = Solid.sweep(f, p, makeSolid, isFrenet, mode, transition)
File "/cq-editor/lib/python3.9/site-packages/cadquery/utils.py", line 50, in __call__
return super().__call__(*args, **kwargs)
File "/cq-editor/lib/python3.9/site-packages/multimethod/__init__.py", line 326, in __call__
func = self[tuple(func(arg) for func, arg in zip(self.type_checkers, args))]
File "/cq-editor/lib/python3.9/site-packages/multimethod/__init__.py", line 326, in
func = self[tuple(func(arg) for func, arg in zip(self.type_checkers, args))]
File "/cq-editor/lib/python3.9/site-packages/multimethod/__init__.py", line 131, in get_type
if not isinstance(arg, self.__origin__): # no need to check subscripts
File "/usr/lib/python3.9/typing.py", line 338, in __instancecheck__
raise TypeError(f"{self} cannot be used with isinstance()")
TypeError: typing_extensions.Literal cannot be used with isinstance()
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.