Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
test rounded edge.stl brlcad-python-tcl
from python_brlcad_tcl.brlcad_tcl import *
class rounded_cube(BrlCadModel):
def __init__(self, brl_db):
super(rounded_cube, self). __init__(brl_db)
self.center_name = None
self.edge = 10
c1 = [0, 0, 0]
c2 = [self.edge, self.edge, self.edge]
cube = brl_db.cuboid(c1, c2)
c1 = [0, 0, 0]
c2 = [self.edge/8., self.edge, self.edge/8.]
sub1 = brl_db.cuboid(c1, c2, 'sub1.s')
c1 = [self.edge/8., 0, self.edge/8.]
c2 = [0, self.edge, 0]
cyl1 = brl_db.circular_cylinder(c1, c2, radius=self.edge/8.)
# finally create a region (a special combination that means it's going to be rendered)
# by unioning together the main combinations we just created
comb1 = brl_db.combination(cube - sub1)
comb2 = brl_db.combination(comb1 + cyl1)
self.final_name = comb2
if __name__ == "__main__":
g_path_out = check_cmdline_args(__file__)
with brlcad_tcl(g_path_out, "My Database", stl_quality=0.1,verbose=True) as brl_db:
rc = rounded_cube(brl_db)
final_name = brl_db.region('u {}'.format(rc.final_name))
# process the g database into an STL file with a list of regions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment