/Hole_puncher Secret
Created
November 25, 2019 08:32
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import trimatic | |
# Find the parts | |
cyl = trimatic.find_part('Cylinder-001') | |
plate = trimatic.find_part('Basic Plate') | |
print( 'Parts found! ') | |
# Ask the user for input to place (in this case) 4 points where the holes should go | |
print('Please place 4 points where drill holes should be') | |
for x in range(4): | |
my_point = trimatic.indicate_coordinate() | |
# Compute normal and closest point | |
[my_normal,my_closestpoint] = trimatic.compute_normal_and_closest_point(parts=plate,point=my_point) | |
# Create a plane based on the point and the normal resulting from previous function. Call it 'my_plane' | |
my_plane = trimatic.create_plane_normal_origin(my_normal,my_closestpoint) | |
# Move the cylinder (xy plane - this is the moving entity) to the plane (this is the fixed entity | |
trimatic.align.plane_to_plane_align(my_plane,cyl.object_coordinate_system.xy_plane) | |
# Then delete the plane as it is no longer needed | |
trimatic.delete(my_plane) | |
# Duplicate the original as boolean subtraction removes the subtraction entity | |
cyl_dup = trimatic.duplicate(cyl) | |
# Hide the cylinders | |
cyl.visible = False | |
cyl_dup.visible = False | |
# Do the boolean | |
plate = trimatic.boolean_subtraction(entities=plate,subtracting_entities=cyl_dup) | |
plate.name = 'Basic Plate' | |
# Hide the cylinder | |
cyl.visible = False | |
print('Done with executing script') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment