SolidCode / SolidPython

A python frontend for solid modelling that compiles to OpenSCAD
1.1k stars 172 forks source link

Color function does not accept transparency #158

Closed rockstorm101 closed 3 years ago

rockstorm101 commented 3 years ago

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:

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'?

etjones commented 3 years ago

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!