FreeCAD: A sketch can be a function. Cut glass revisited.

FreeCAD: A sketch can be a function. Cut glass revisited.

633 Lượt nghe
FreeCAD: A sketch can be a function. Cut glass revisited.
Get the macro: https://github.com/pyro9/MixedMacros/blob/main/SetDiameters.FCMacro In case you can't read it in the video: ===== # Copyright (c) 2025 [email protected] # ... s =FreeCADGui.Selection.getCompleteSelection() fun=s[0].Object targets=[ e.Object for e in s[1:]] def doFunc(x): fun.setDatum('X', x) fun.recompute() return fun.getDatum('Y') def ExpandCompounds(li): for e in li: if 'Part::Compound'==e.TypeId: for i in ExpandCompounds(e.OutList): yield i else: yield e def filter(li, nam): for i in li: try: i.getDatum(nam) yield i except: pass for t in filter(ExpandCompounds(targets),'radius'): print(t.Name) t.setDatum('radius', doFunc(t.Placement.Base.z)) t.recompute() ===== 00:01 Intro 00:40 Sketch as a function 01:47 Begin Design 02:15 Function sketch 03:54 Function sketch demo 05:03 Macro demo 05:31 The SetDiameters macro 7:28 "Call" the function sketch 08:14 Filter functions 09:30 Actually set some radii 10:12 Conclusion and shameless bump to next video