SolidCode/SolidPython

Color function does not accept transparency

rockstorm101 opened this issue · 1 comments

The 'color' function does not work as expected. According to the docs [1], in its fourth form, this function is supposed to accept two parameters, namely: a string with the name of the colour and a floating point value for the transparency. Like color( "colorname", 1.0 ) { ... }. However, the following code:

import solid as sp

if __name__ == '__main__':
    cube = sp.cube([10,10,10], center = True)
    example = sp.color("Teal", 0.5)(cube)
    sp.scad_render_to_file(example, include_orig_code = False)

Produces the following error:

$ python bug_156.py 
Traceback (most recent call last):
  File "bug_156.py", line 5, in <module>
    example = sp.color("Teal", 0.5)(cube)
TypeError: __init__() takes 2 positional arguments but 3 were given

System Info:

  • SolidPython: 1.0.2
  • Python: 3.8.6
  • OS: Debian Sid

P.S.: Thank you so much for developing and maintaining this software. Love it!
P.S.2.: The latest version on PyPI is said to be '1.0.3' but the latest tag/release on GitHub is still '1.0.1'?

Thanks for pointing this out! I fixed both the tags (which I'd neglected to push to origin) and the OpenSCAD color() mismatch. Fixed and released on PyPI as v1.0.4. Cheers!