Mesh API/it: Difference between revisions
Renatorivo (talk | contribs) (Created page with "{{APIFunction|addFacet|Facet|Aggiunge una sfaccettatura alla maglia| }} {{APIFunction|addFacets|list|Aggiunge un elenco di sfaccettature alla maglia| }} {{APIFunction|addMesh|...") |
(Updating to match new version of source page) |
||
Line 11: | Line 11: | ||
{{APIFunction|addFacet|Facet| |
{{APIFunction|addFacet|Facet|Adds a facet to the mesh| }} |
||
{{APIFunction|addFacets|list| |
{{APIFunction|addFacets|list|Adds a list of facets to the mesh| }} |
||
{{APIFunction|addMesh|Mesh| |
{{APIFunction|addMesh|Mesh|Combines this mesh with another mesh.| }} |
||
{{APIFunction|clear| | |
{{APIFunction|clear| |Clears the mesh| }} |
||
{{APIFunction|coarsen| | |
{{APIFunction|coarsen| |Coarsens the mesh| }} |
||
{{APIFunction|collapseEdge|Edge| |
{{APIFunction|collapseEdge|Edge|Removes an edge and both facets that share this edge| }} |
||
{{APIFunction|collapseFacet|Facet| |
{{APIFunction|collapseFacet|Facet|Removes a facet| }} |
||
{{APIFunction|collapseFacets|list| |
{{APIFunction|collapseFacets|list|Removes a list of facets| }} |
||
{{APIFunction|copy| | |
{{APIFunction|copy| |Creates a copy of this mesh|a Mesh object}} |
||
{{APIFunction|countComponents| | |
{{APIFunction|countComponents| |Get the number of topological independent areas|an integer}} |
||
{{APIFunction|countNonUniformOrientedFacets| | |
{{APIFunction|countNonUniformOrientedFacets| |Get the number of wrong oriented facets|an integer}} |
||
{{APIFunction|countSegments| | |
{{APIFunction|countSegments| |Get the number of segments which may also be 0|an integer}} |
||
{{APIFunction|crossSections| | |
{{APIFunction|crossSections| |Get cross-sections of the mesh through several planes| }} |
||
{{APIFunction|difference|Mesh| |
{{APIFunction|difference|Mesh|Difference of this and the given mesh object.| }} |
||
{{APIFunction|fillupHoles| | |
{{APIFunction|fillupHoles| |Fillup holes| }} |
||
{{APIFunction|fixDeformations| | |
{{APIFunction|fixDeformations| |Repair deformed facets| }} |
||
{{APIFunction|fixDegenerations| | |
{{APIFunction|fixDegenerations| |Remove degenerated facets| }} |
||
{{APIFunction|fixIndices| | |
{{APIFunction|fixIndices| |Repair any invalid indices| }} |
||
{{APIFunction|fixSelfIntersections| | |
{{APIFunction|fixSelfIntersections| |Repair self-intersections| }} |
||
{{APIFunction|flipNormals| | |
{{APIFunction|flipNormals| |Flip the mesh normals| }} |
||
{{APIFunction|foraminate| | |
{{APIFunction|foraminate| |Get a list of facet indices and intersection points| }} |
||
{{APIFunction|getPlanes| | |
{{APIFunction|getPlanes| |Get all planes of the mesh as segment. In the worst case each triangle can be regarded as single plane if none of its neighbors is coplanar.| }} |
||
{{APIFunction|getSegment|integer| |
{{APIFunction|getSegment|integer|Get a list of facet indices that describes a segment| }} |
||
{{APIFunction|getSeparateComponents| | |
{{APIFunction|getSeparateComponents| |Returns a list containing the different components (separated areas) of the mesh as separate meshes|a list}} |
||
{{APIFunction|harmonizeNormals| | |
{{APIFunction|harmonizeNormals| |Adjust wrong oriented facets| }} |
||
{{APIFunction|hasNonManifolds| | |
{{APIFunction|hasNonManifolds| |Check if the mesh has non-manifolds|a boolean}} |
||
{{APIFunction|hasNonUniformOrientedFacets| | |
{{APIFunction|hasNonUniformOrientedFacets| |Checks if the mesh has facets with inconsistent orientation| }} |
||
{{APIFunction|hasSelfIntersections| | |
{{APIFunction|hasSelfIntersections| |Check if the mesh intersects itself| }} |
||
{{APIFunction|inner| | |
{{APIFunction|inner| |Get the part inside of the intersection| }} |
||
{{APIFunction|insertVertex|Vertex| |
{{APIFunction|insertVertex|Vertex|Inserts a vertex into a facet| }} |
||
{{APIFunction|intersect|Mesh| |
{{APIFunction|intersect|Mesh|Intersection of this and the given mesh object.| }} |
||
{{APIFunction|isSolid| | |
{{APIFunction|isSolid| |Check if the mesh is a solid| }} |
||
{{APIFunction|meshFromSegment| | |
{{APIFunction|meshFromSegment| |Create a mesh from segment| }} |
||
{{APIFunction|nearestFacetOnRay|tuple, tuple|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.|a dictionary}} |
{{APIFunction|nearestFacetOnRay|tuple, tuple|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.|a dictionary}} |
||
{{APIFunction|offset|float| |
{{APIFunction|offset|float|Move the point along their normals| }} |
||
{{APIFunction|offsetSpecial|float| |
{{APIFunction|offsetSpecial|float|Move the point along their normals| }} |
||
{{APIFunction|optimizeEdges| | |
{{APIFunction|optimizeEdges| |Optimize the edges to get nicer facets| }} |
||
{{APIFunction|optimizeTopology| | |
{{APIFunction|optimizeTopology| |Optimize the edges to get nicer facets| }} |
||
{{APIFunction|outer| | |
{{APIFunction|outer| |Get the part outside the intersection| }} |
||
{{APIFunction|printInfo| | |
{{APIFunction|printInfo| |Get detailed information about the mesh| }} |
||
{{APIFunction|read| |Read in a mesh object from file.| }} |
{{APIFunction|read| |Read in a mesh object from file.| }} |
||
{{APIFunction|refine| |Refine the mesh| }} |
{{APIFunction|refine| |Refine the mesh| }} |
||
Line 76: | Line 76: | ||
{{APIProperty|CountFacets|the number of facets of the mesh object.}} |
{{APIProperty|CountFacets|the number of facets of the mesh object.}} |
||
{{APIProperty|CountPoints|the number of vertices of the mesh object.}} |
{{APIProperty|CountPoints|the number of vertices of the mesh object.}} |
||
{{APIProperty|Facets|A collection of facets; With this attribute it is possible to get access to the facets of the mesh: for |
{{APIProperty|Facets|A collection of facets; With this attribute it is possible to get access to the facets of the mesh: for f in mesh.Facets: print f. Facet.Points is a list of coordinate-tupels for the vertices. Facet.PointIndices is a list of indice for the vertices of the facet. WARNING! store Facets in a local variable as it is generated on the fly, each time it is accessed.}} |
||
{{APIProperty|Points|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}} |
{{APIProperty|Points|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,p.Index.WARNING! store Points in a local variable as it is generated on the fly, each time it is accessed.}} |
||
{{APIProperty|Topology|the points and face indices as tuple. Topology[0] is a list of all vertices. Each being a tuple of 3 coordinates. Topology[1] is a list of all polygons. Each being a list of vertex indice into Topology[0] WARNING! store Topology in a local variable as it is generated on the fly, each time it is accessed.}} |
|||
{{APIProperty|Topology|the points and face indices as tuple.}} |
|||
{{APIProperty|Volume|the volume of the mesh object.}} |
{{APIProperty|Volume|the volume of the mesh object.}} |
||
{{APIProperty|BoundBox|the BoundBox of the object}} |
{{APIProperty|BoundBox|the BoundBox of the object}} |
Revision as of 11:19, 28 January 2017
Gli oggetti mesh possono essere manipolati aggiungendo nuove sfaccettature, cancellando delle sfaccettature, importando da un file STL, trasformando la rete e in molti altri modi. Per una panoramica completa di ciò che si può fare vedere anche la documentazione del Modulo Mesh. Un oggetto mesh non può essere aggiunto direttamente ad un documento esistente. Pertanto, il documento deve creare un oggetto con una classe appropriataa che supporta le mesh. Esempio:
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()
Description: Get the number of wrong oriented facets
Returns: an integer
Description: Get all planes of the mesh as segment. In the worst case each triangle can be regarded as single plane if none of its neighbors is coplanar.
Returns:
Description: Returns a list containing the different components (separated areas) of the mesh as separate meshes
Returns: a list
Description: Checks if the mesh has facets with inconsistent orientation
Returns:
Description: 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.
Returns: a dictionary
Description: Remove components with less or equal to number of given facets
Returns:
Returns: A collection of facets; With this attribute it is possible to get access to the facets of the mesh: for f in mesh.Facets: print f. Facet.Points is a list of coordinate-tupels for the vertices. Facet.PointIndices is a list of indice for the vertices of the facet. WARNING! store Facets in a local variable as it is generated on the fly, each time it is accessed.
Returns: 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,p.Index.WARNING! store Points in a local variable as it is generated on the fly, each time it is accessed.
Returns: the points and face indices as tuple. Topology[0] is a list of all vertices. Each being a tuple of 3 coordinates. Topology[1] is a list of all polygons. Each being a list of vertex indice into Topology[0] WARNING! store Topology in a local variable as it is generated on the fly, each time it is accessed.