Sometimes I need to cut huge volumes of complex sheet metal parts with laser of CNC mill. These technologies are not good with sharp corners, both internal and external. So I have to manually add holes and fillets. But it is boring! And there are thousands! Please, help me to automate it with macros. I know python and FreeCAD scripting basics, but use it rarely and not professionally.
I hope this macros will be useful for many others who work with CNC mill and lasercut.
The process (after selection of face of the part) can looks like this:
1. Get selected face
Code: Select all
def select_face():
try:
if len(Gui.Selection.getSelectionEx())==0:
print "No face selected! Please select a face."
return -1
if len(Gui.Selection.getSelectionEx()[0].SubObjects)>1:
print "Multiple faces selected! Please select ONE face." #Multiple selection to be added later
return -1
if Gui.Selection.getSelectionEx()[0].SubObjects[0].ShapeType <> 'Face':
print "Selection is not a Face! Please select a Face."
return -1
if Gui.Selection.getSelectionEx()[0].SubObjects[0].curvatureAt(0,0)<>(0,0):
print "This process work only for flat faces!"
return -1
return Gui.Selection.getSelectionEx()[0].SubObjects[0]
except:
print "Face is not selected! Please select a Face."
return -1
3. Make list of internal corners (common wires (ortogonal to selected face) of two non-tangent faces)
4. Make circles with R radius on the sketch over these corners (not directly over corners, but with corner point layind on circle)
5. Pocket through all
6. Recognize work face of new appeared part (may be by normal)
7. Make list of all corners and make them fillets with R radius.
8. Change colour of the part (optionally, to see processed parts)