macro for finding holes

Here's the place for discussion related to CAM/CNC and the development of the Path module.
nahshon
Posts: 211
Joined: Wed Jul 24, 2013 8:06 pm

Re: macro for finding holes

Post by nahshon »

This was already discussed... The cylinder axis does not hit the model, yet it's not a cylindrical hole.
foo.png
foo.png (7.61 KiB) Viewed 1419 times
iamnotstone
Posts: 4
Joined: Fri Jul 05, 2019 2:12 pm
Location: China

Re: macro for finding holes

Post by iamnotstone »

we can also check a normal on the surface. here is my solution:

Code: Select all

face = Gui.Selection.getSelectionEx()[0].SubObjects[0]

surface = face.Surface

surfaceType = type(surface).__name__

if(surfaceType == 'Cylinder'):
	center = surface.Center
	axis = surface.Axis

	value = face.valueAt(0,0)
	normal = face.normalAt(0,0)

	center2value = value - center

	dotValue = normal.dot(center2value)

	if(dotValue > 0):
		print('this is a boss')
	else:
		print('this is a hole')
Post Reply