Open billingsley-john opened 3 years ago
Usage:
Cutting single shape: (likewise for union and intersect) my_shape.boolean_operations = {"cut": shape_1}
Cutting multiple shapes: (likewise for union and intersect) my_shape.boolean_operations = {"cut": [shape_1, shape_2]} shape_1 is cut first, shape_2 cut second
Ordering boolean operations my_shape.boolean_operations = {"union": shape_1, "cut": shape_2} shape_1 is unioned before shape_2 is cut
Need to be careful when defining new boolean operations after a shape class has already been defined. I.e. as boolean_operations now controls cut, union and intersect, if we want to 'add' a boolean operation, we need to make sure we don't overwrite any original boolean operations that may already exist. E.g. my_shape = p.RotateStraightShape(boolean_operations={"cut": shape_1})
If we now want to add a union, we need to make sure to include the original cut: my_shape.boolean_operations={"cut": shape_1, "union": shape_2}, or, alternatively, add the key-value pair like this: my_shape.boolean_operations["union"] = shape_2 Note. this second method only works if boolean_operations is already a dictionary
Proposed changes
Starting PR which updates the method for performing boolean operations of cut, union and intersect. At the moment, the order in which these operations are performed is hard coded. This PR introduces a boolean_operations dictionary to shapes in which the boolean operations and their orders can be specified.
Types of changes
What types of changes does your code introduce to the Paramak? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...