Mesh2Shape.py
Go to the documentation of this file.00001
00002
00003
00004
00005 import Mesh,Part,MeshPart
00006
00007 faces = []
00008 mesh = App.ActiveDocument.ActiveObject.Mesh
00009 segments = mesh.getPlanes(0.00001)
00010
00011 for i in segments:
00012 if len(i) > 0:
00013
00014 wires = MeshPart.wireFromSegment(mesh, i)
00015
00016 if len(wires) > 0:
00017 ext=None
00018 max_length=0
00019 for i in wires:
00020 if i.BoundBox.DiagonalLength > max_length:
00021 max_length = i.BoundBox.DiagonalLength
00022 ext = i
00023
00024 wires.remove(ext)
00025
00026 for i in wires:
00027 i.reverse()
00028
00029
00030 wires.insert(0, ext)
00031 faces.append(Part.Face(wires))
00032
00033
00034 shell=Part.Compound(faces)
00035 Part.show(shell)
00036
00037
00038