Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from FreeCAD import Base, Vector
- import FreeCAD,FreeCADGui,Part
- import Drawing
- sel = FreeCADGui.Selection.getSelection()
- for o in sel:
- solid = o.Shape
- #get the outside shape of the profile:
- proj = Part.Shape
- [visibleG0,visibleG1,hiddenG0,hiddenG1] = Drawing.project(solid,Vector(0,0,-1))
- proj = visibleG0
- proj.rotate(Vector(0,0,0), Vector(0,1,0), 180)
- outerProfile=FreeCAD.ActiveDocument.addObject("Part::Feature","Outside_Profile")
- outerProfile.Shape = proj # <- outer profile
- FreeCAD.activeDocument().recompute()
- #select individual faces to get their profiles -for pockets and open pockets
- objGeom=[]
- s=Gui.Selection.getSelectionEx()
- for i in s:
- for e in i.SubElementNames:
- objGeom.append(getattr(i.Object.Shape,e))
- face = objGeom[0]
- [visibleG0,visibleG1,hiddenG0,hiddenG1] = Drawing.project(face,Vector(0,0,-1))
- proj2 = Part.Shape
- proj2 = visibleG0
- proj2.rotate(Vector(0,0,0), Vector(0,1,0), 180)
- pocket =FreeCAD.ActiveDocument.addObject("Part::Feature","Pocket")
- pocket.Shape = proj2
- FreeCAD.activeDocument().recompute()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement