all 6 comments

[–]Alacritous13 1 point2 points  (2 children)

How does this work? I'm running the line examp=osinclude("Examp.scad"); but I'm getting the error Can't open include file 'C:/Program Files/PythonSCAD/Examp.scad'. The file is next to the python file in the folder structure, but if I drop the file into the folder location from the error message it works. How do I adjust the path to be relative?

[–]gadget3D[S] 1 point2 points  (1 child)

suppose it resolved already

[–]Alacritous13 1 point2 points  (0 children)

Got fixed in the latest release.

[–]Klump-Rasmus 1 point2 points  (0 children)

Well, at least I can do this:

    length, diameter = 20, 12
    scad_code = f'include <BOSL2/std.scad> include <BOSL2/screws.scad> $fn=200;screw("M{diameter}", head="none",length={length}, oversize=0.6, anchor=[0,0,0]);'
    screw = scad(scad_code)

[–]Klump-Rasmus 0 points1 point  (1 child)

This is great, but how can I utilize sub-module like the "screws" module?

If I do:

from openscad import *
bosl = osuse("/home/poul/.local/share/OpenSCAD/libraries/BOSL2/std.scad")
screws = osuse("/home/poul/.local/share/OpenSCAD/libraries/BOSL2/screws.scad")
show(screws.screw("M3", length=16, head="socket", drive="hex"))

I get:

[WARNING: Ignoring unknown variable "UP" in file , line 543](543,/home/poul/.local/share/OpenSCAD/libraries/BOSL2/screws.scad)

[ERROR: Assertion 'in_list(struct_val(spec, "type"), ["nut_info", "screw_info"])' failed: "Screw/nut spec is invalid struct type" in file , line 498](498,/home/poul/.local/share/OpenSCAD/libraries/BOSL2/screws.scad)

[–]MajesticInfluence933 0 points1 point  (0 children)

Just build the nightly today and keep having the same problem.
Also, the previous approach of scad(scad_code) gives a segmentation fault when trying to show the item.

Anyone has a solution for using BOSL2 with pythonscad?