
To do this, we need to specify that there s a given part with a hole and that other parts may occupy the space in that hole. Example: outer = cylinder(r=pipe_od, h=seg_length) inner = cylinder(r=pipe_id, h=seg_length) pipe_a = outer - hole()(inner) Once you ve made something a hole, eventually you ll want to put something, like a bolt, into it.

Using hole(), you can make a pipe, specify that its center should remain open, and then add two pipes together knowing that the central void area will stay empty no matter what other objects are added to that structure. In OpenSCAD you need to make two cylinders, union them, then make two smaller cylinders, union them, then subtract the smaller from the larger.

17Ģ2 SolidPython Documentation, Release Consider making a joint where two pipes come together. SolidPython s hole() function makes this process easier. So c = cylinder(r=10, h=5) + cylinder(r=2, h=30) is the same as: c = union()( cylinder(r=10, h=5), cylinder(r=2, h=30) ) Likewise: c = cylinder(r=10, h=5) c -= cylinder(r=2, h=30) is the same as: c = difference()( cylinder(r=10, h=5), cylinder(r=2, h=30) ) 8.2 First-class Negative Space (Holes) OpenSCAD requires you to be very careful with the order in which you add or subtract objects. Example CodeĢ1 CHAPTER 8 Extra syntactic sugar 8.1 Basic operators Following Elmo Mäntynen s suggestion, SCAD objects override the basic operators + (union), - (difference), and * (intersection). 15Ģ0 SolidPython Documentation, Release Chapter 7.
OPENSCAD EXTRUDE ALONG PATH CODE
file ) + '/examples') Or browse the example code on Github here Adding your own code to the example file solid/examples/solidpython_template.py will make some of the setup easier. If you ve installed SolidPython, the following line of Python will print(the location of ) the examples directory: import os, solid print(os.path.dirname(solid. Importing OpenSCAD codeġ9 CHAPTER 7 Example Code The best way to learn how SolidPython works is to look at the included example code. Here s a simple example: This Python code: from solid import * d = difference()( cube(10), sphere(15) ) print(scad_render(d)) Generates this OpenSCAD code: difference() your_file.py from solid import * # use() puts the module `box()` into the global namespace use('/path/to/scadfile.scad') b = box(2,4,6) scad_render_to_file(b, 'out_file.scad') 14 Chapter 6.

It generates valid OpenSCAD code from Python code with minimal overhead. SolidPythonĩ CHAPTER 2 SolidPython: OpenSCAD for Python SolidPython is a generalization of Phillip Tiefenbacher s openscad module, found on Thingiverse.
OPENSCAD EXTRUDE ALONG PATH LICENSE
1 SolidPython Documentation Release Evan Jones May 14, 2020ģ Contents 1 SolidPython 3 2 SolidPython: OpenSCAD for Python 5 3 Advantages 7 4 Installing SolidPython 9 5 Using SolidPython 11 6 Importing OpenSCAD code 13 7 Example Code 15 8 Extra syntactic sugar Basic operators First-class Negative Space (Holes) Animation solid.utils Directions: (up, down, left, right, forward, back) for arranging things: Arcs Extrude Along Path Basic color library Bill Of Materials solid.screw_thread solid.splines Jupyter Renderer Contact License Library Reference Indices and tables 29 iĥ SolidPython Documentation, Release Contents: Contents 1Ħ SolidPython Documentation, Release Contentsħ CHAPTER 1 SolidPython SolidPython: OpenSCAD for Python Advantages Installing SolidPython Using SolidPython Importing OpenSCAD Code Example Code Extra syntactic sugar Basic operators First-class Negative Space (Holes) Animation solid.utils Directions: (up, down, left, right, forward, back) for arranging things: Arcs Extrude Along Path Basic color library Bill Of Materials solid.screw_thread solid.splines Jupyter Renderer Contact 3Ĩ SolidPython Documentation, Release License 4 Chapter 1.
