macro for finding holes
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: macro for finding holes
This was already discussed... The cylinder axis does not hit the model, yet it's not a cylindrical hole.
-
- Posts: 4
- Joined: Fri Jul 05, 2019 2:12 pm
- Location: China
Re: macro for finding holes
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')