Mesh() -- Create an empty mesh object. This class allows one to manipulate the mesh object by adding new facets, deleting facets, importing from an STL file, transforming the mesh and much more. For a complete overview of what can be done see also the documentation of mesh. A mesh object cannot be added to an existing document directly. Therefore the document must create an object with a property class that supports meshes. Example: m = Mesh.Mesh() ... # Manipulate the mesh d = FreeCAD.activeDocument() # Get a reference to the actie document f = d.addObject(\"Mesh::Feature\", \"Mesh\") # Create a mesh feature f.Mesh = m # Assign the mesh object to the internal property d.recompute() Read in a mesh object from file. mesh.read(Filename='mymesh.stl') mesh.read(Stream=file,Format='STL') Write the mesh object into file. mesh.write(Filename='mymesh.stl',[Format='STL',Name='Object name',Material=colors]) mesh.write(Stream=file,Format='STL',[Name='Object name',Material=colors]) Write the mesh in OpenInventor format to a string. Create a copy of this mesh Move the point along their normals Move the point along their normals Get cross-sections of the mesh through several planes Union of this and the given mesh object. Intersection of this and the given mesh object. Difference of this and the given mesh object. Get the part inside of the intersection Get the part outside the intersection Get the section curves of this and the given mesh object. lines = mesh.section(mesh2, [ConnectLines=True, MinDist=0.0001]) Coarse the mesh Apply a translation to the mesh Apply a rotation to the mesh Apply a transformation to the mesh Transform the mesh to its eigenbase Get Eigen base of the mesh Add a facet to the mesh Add a list of facets to the mesh Remove a list of facet indices from the mesh Remove all edges that are smaller than a given length Remove facets whose all three points are on the boundary Builds a list of facet indices with triangles that are inside a volume mesh Repairs the neighbourhood which might be broken Combine this mesh with another mesh. setPoint(int, Vector) Sets the point at index. movePoint(int, Vector) This method moves the point in the mesh along the given vector. This affects the geometry of the mesh. Be aware that after moving point(s) the mesh can have self intersections! getPointNormals() Get the normals of the points. Add a list of facet indices that describes a segment to the mesh Get the number of segments which may also be 0 Get a list of facet indices that describes a segment Returns a list containing the different components (separated areas) of the mesh as separate meshes import Mesh for c in mesh.getSeparatecomponents(): Mesh.show(c) Get a list of the indices of selected facets Get a list of the indices of selected points Create a mesh from segment Clear the mesh Check if the mesh is a solid Check if the mesh has non-manifolds Remove non-manifolds Remove non-manifold points Check if the mesh intersects itself Returns a tuple of indices of intersecting triangles Repair self-intersections Remove folds on surfaces Check if the mesh has facets with inconsistent orientation Get the number of wrong oriented facets Get a tuple of wrong oriented facets Check if the mesh has points with invalid coordinates (NaN) Remove points with invalid coordinates (NaN) Check if points lie on edges removePointsOnEdge(FillBoundary=False) Remove points that lie on edges. If FillBoundary is True then the holes by removing the affected facets will be re-filled. Check if the mesh has invalid neighbourhood indices Check if the mesh has point indices that are out of range Check if the mesh has facet indices that are out of range Check if the mesh has corrupted facets Get the number of topologic independent areas Remove components with less or equal to number of given facets Repair any invalid indices Repair caps by swapping the edge Repair deformed facets Remove degenerated facets Remove duplicated points Remove duplicated facets Refine the mesh Split all edges Split edge Split facet Swap the common edge with the neighbour Remove an edge and both facets that share this edge Remove a facet Remove a list of facets Insert a vertex into a facet Insert a new facet at the border Get detailed information about the mesh Get a list of facet indices and intersection points Cuts the mesh with a given closed polygon cut(list, int) -> None The argument list is an array of points, a polygon The argument int is the mode: 0=inner, 1=outer Trims the mesh with a given closed polygon trim(list, int) -> None The argument list is an array of points, a polygon The argument int is the mode: 0=inner, 1=outer Trims the mesh with a given plane trimByPlane(Vector, Vector) -> None The plane is defined by a base and normal vector. Depending on the direction of the normal the part above or below will be kept. Adjust wrong oriented facets Flip the mesh normals Fillup holes Smooth the mesh smooth([iteration=1,maxError=FLT_MAX]) Decimate the mesh decimate(tolerance(Float), reduction(Float)) tolerance: maximum error reduction: reduction factor must be in the range [0.0,1.0] Example: mesh.decimate(0.5, 0.1) # reduction by up to 10 percent mesh.decimate(0.5, 0.9) # reduction by up to 90 percent Merge facets to optimize topology Optimize the edges to get nicer facets Optimize the edges to get nicer facets nearestFacetOnRay(tuple, tuple) -> dict Get the index and intersection point of the nearest facet to a ray. The first parameter is a tuple of three floats the base point of the ray, the second parameter is ut uple of three floats for the direction. The result is a dictionary with an index and the intersection point or an empty dictionary if there is no intersection. getPlanarSegments(dev,[min faces=0]) -> list Get all planes of the mesh as segment. In the worst case each triangle can be regarded as single plane if none of its neighbours is coplanar. getSegmentsOfType(type, dev,[min faces=0]) -> list Get all segments of type. Type can be Plane, Cylinder or Sphere getSegmentsByCurvature(list) -> list The argument list gives a list if tuples where it defines the preferred maximum curvature, the preferred minimum curvature, the tolerances and the number of minimum faces for the segment. Example: c=(1.0, 0.0, 0.1, 0.1, 500) # search for a cylinder with radius 1.0 p=(0.0, 0.0, 0.1, 0.1, 500) # search for a plane mesh.getSegmentsByCurvature([c,p]) getCurvaturePerVertex() -> list The items in the list contains minimum and maximum curvature with their directions A collection of the mesh points With this attribute it is possible to get access to the points of the mesh for p in mesh.Points: print p.x, p.y, p.z Return the number of vertices of the mesh object. Return the number of edges of the mesh object. A collection of facets With this attribute it is possible to get access to the facets of the mesh for p in mesh.Facets: print p Return the number of facets of the mesh object. Return the points and face indices as tuple. Return the area of the mesh object. Return the volume of the mesh object. private: friend class PropertyMeshKernel; class PropertyMeshKernel* parentProperty = nullptr;