Skip to content

On Calling the Free Function cone #1830

@huskier

Description

@huskier

The following code produces an error: multimethod.DispatchError: ('cone: 0 methods found', (), [])

from cadquery.func import *
from cadquery.vis import show

mycone = cone(d1=100 * 2.0, d2=100 * 1.8, h=100.0)
show(mycone)

Actual Function Implementation. The cone function is defined using @multimethod with multiple registered versions:

@multimethod
def cone(d1: Real, d2: Real, h: Real) -> Shape:
    """
    Construct a partial solid cone.
    """
    return _compound_or_shape(
        BRepPrimAPI_MakeCone(
            gp_Ax2(Vector(0, 0, 0).toPnt(), Vector(0, 0, 1).toDir()),
            d1 / 2,
            d2 / 2,
            h,
            2 * pi,
        ).Shape()
    )

@cone.register
def cone(d: Real, h: Real) -> Shape:
    """
    Construct a full solid cone.
    """
    return cone(d, 0, h)

We believe users CAN write the function call as follows. It should be supported in Python.

mycone = cone(d1=100 * 2.0, d2=100 * 1.8, h=100.0)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions