jeff-dh / SolidPython

A python frontend for solid modelling that compiles to OpenSCAD
137 stars 24 forks source link

fill() function from dev snapshot not supported #53

Closed jonboh closed 11 months ago

jonboh commented 11 months ago

I think the fill() function from the dev snapshot is still not supported by solidpython2, but is it possible to add an arbitrary function so that the generated code has it? Even if the library itself does not know about it.

Are you planning to implement fill()?

jeff-dh commented 11 months ago

you can create an extension for it. Create file called fill_extension.py with this content:

from solid2 import register_access_syntax
from solid2.core.object_base import OpenSCADObject

@register_access_syntax
class fill(OpenSCADObject):
    def __init__(self) -> None:
        super().__init__('fill', {})

Afterwards you can use it like this:

>>> from solid2 import circle
>>> import fill_extension
>>> circle().fill()
fill() {
        circle();
}

LSP support will not work for such extensions.