Skip to main content

BUild123d Mutables Objects

Project description

Bumo

BUild123d Mutables Objects

An experimental package used to manage Build123d objects by applying mutations on them.

It can be used:

  • just out of curiosity, because it's just a new way to build things;
  • as a debug tool, using colors and debug mode;
  • as a higher-level interface for Build123d;
  • as a more object-oriented approach to build CAD parts.

Installation

poetry install bumo

or using pip:

pip install bumo

Getting started

Bumo is not a cad library on its own and does not aim to replace Build123d, you should take a look at the Build123d docs before using it.

Note: In the following examples we will use ocp vscode, but any other viewer should work.

Instantiating the builder

First things first, let's instanciate a Bumo builder and pass a Build123d part into it. Note that we must call the object (obj()) when passing it to the show function.

import build123d as _
from ocp_vscode import show_object
from bumo import Builder

obj = Builder(_.Box(12, 12, 2))

show_object(obj())

Adding mutations

When applying an operation, instead of returning a copy of the modified object, the builder mutates the object:

obj = Builder(_.Box(12, 12, 2))
obj.add(_.Box(8, 8, 4))
obj.sub(_.Cylinder(3, 4))

Adding colors

On each mutation you can pass a color, because coloring object faces is useful and funny:

obj = Builder(_.Box(12, 12, 2), "orange")
obj.add(_.Box(8, 8, 4), "green")
obj.sub(_.Cylinder(3, 4), "violet")

Moving objects

You can move objects with move(), all colors will be preserved. Note that you can still use the Build123d * operator before passing the object to the builder.

obj = Builder(_.Box(12, 12, 2), "orange")
obj.add(_.Box(8, 8, 4), "green")
obj.move(_.Location([-5, 2, 0]))
obj.sub(_.Rotation(25, 25, 0) * _.Cylinder(2.5, 10), "violet")

Reusing mutations

Instead of returning a copy of the object, mutations return a Mutation object that can be used to retrieve the altered faces and edges. Mutations can also be accessed by querrying a builder index (ie. obj[n]). This is useful with fillets and chamfers:

obj = Builder(_.Box(12, 12, 2), "orange")
obj.add(_.Box(8, 8, 4), "green")
obj.fillet(obj[-1].edges_added(), 0.4, color="yellow")
hole = obj.sub(_.Cylinder(3, 4), "violet")
obj.chamfer(hole.edges_added()[0], 0.3, color="blue")

Using the debug mode

You can turn one or several mutations in debug mode, so all the other faces will be translucent. Either by passing a debug attribute to mutations, or passing faces to the debug method:

obj = Builder(_.Box(12, 12, 2), "orange")
obj.add(_.Box(8, 8, 4), "green")
obj.fillet(obj[-1].edges_added(), 0.4, color="yellow")
obj.debug(obj[-1].faces_altered()[0], "red")
hole = obj.sub(_.Cylinder(3, 4), "violet")
obj.chamfer(hole.edges_added()[0], 0.3, color="blue", debug=True)

Configuring the builder

You can set builder attributes if necessary:

Builder.default_color = "grey"
Builder.debug_alpha = 0.5

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bumo-0.1.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bumo-0.1.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file bumo-0.1.1.tar.gz.

File metadata

  • Download URL: bumo-0.1.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.10.12 Linux/6.8.0-51-generic

File hashes

Hashes for bumo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 05970237def6f71903b8c786bc1b3218ff377e6a089e0b1ec4147ffeb58d6026
MD5 aa1f310c1b9a0eb1714e1bbe506ddb91
BLAKE2b-256 6c9a88ab54e8d254b0730a89e98c894d990912cb072a28098d9c367f03679207

See more details on using hashes here.

File details

Details for the file bumo-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bumo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.10.12 Linux/6.8.0-51-generic

File hashes

Hashes for bumo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 054f11d96e3538882ca7996e7e832416b6f5f3e237ffa7243647f6c83ff55185
MD5 7d92e4f844b7986b063a62da6bc00b1e
BLAKE2b-256 f7ca8aae4803ea763fe2a1e7c4d7198e9c0b103863e416cfa2dba243313dd599

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page