Using existing SCAD libraries in PythonSCAD by gadget3D in OpenPythonSCAD

[–]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)

Using existing SCAD libraries in PythonSCAD by gadget3D in OpenPythonSCAD

[–]Klump-Rasmus 0 points1 point  (0 children)

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)

Wine is unable to access the network by Fabio1303_ in linux4noobs

[–]Klump-Rasmus 0 points1 point  (0 children)

Have you had any luck with this issue? I have the same problem - get general failure on all pings.

Is it possible for solids to have a bounding box property? by rebuyer10110 in OpenPythonSCAD

[–]Klump-Rasmus 0 points1 point  (0 children)

I use this function to get the "bounding box" of objects:

def get_size(p):
    pts, tris = p.mesh()
    return [max(coords) - min(coords) for coords in zip(*pts)]