Mesh MeshObject/fr: Difference between revisions

From FreeCAD Documentation
(Created page with "== Comment l'utiliser ==")
(Created page with "Le Mesh MeshObject est un objet assigné à certainsApp DocumentObjects.")
Line 15: Line 15:
== Comment l'utiliser ==
== Comment l'utiliser ==


The Mesh MeshObject is an object that is assigned to some [[App_DocumentObject|App DocumentObjects]].
Le Mesh MeshObject est un objet assigné à certains[[App_DocumentObject/fr|App DocumentObjects]].


In particular, the basic object that handles these types of attributes is the [[Mesh_Feature|Mesh Feature]] ({{incode|Mesh::Feature}} class). All objects derived from this class will have access to a Mesh MeshObject.
In particular, the basic object that handles these types of attributes is the [[Mesh_Feature|Mesh Feature]] ({{incode|Mesh::Feature}} class). All objects derived from this class will have access to a Mesh MeshObject.

Revision as of 10:27, 24 January 2020

Other languages:

Introduction

Un Mesh MeshObject, ou officiellement Mesh::MeshObject, est une classe qui définit une structure de données de maillage dans le logiciel. Ceci est similaire à la Part TopoShape mais pour Mesh.

Les maillages sont normalement créés avec l'atelier Mesh, ou importés à partir de STL, OBJ et de formats de fichier de maillage similaires.

Veuillez noter que FEM Workbench utilise également des maillages, mais dans ce cas, il utilise une structure de données différente, appelée Fem FemMesh (classe Fem::FemMesh). Ces informations ne s'appliquent pas à cette structure de données.

Diagramme simplifié des relations entre les objets principaux du programme. La classe Mesh::MeshObject est incorporée dans l'objet Mesh::Feature et à partir de là, elle est propagée à tous les objets qui en sont dérivés.

Comment l'utiliser

Le Mesh MeshObject est un objet assigné à certainsApp DocumentObjects.

In particular, the basic object that handles these types of attributes is the Mesh Feature (Mesh::Feature class). All objects derived from this class will have access to a Mesh MeshObject.

The most notable objects that will have a Mesh MeshObject are the following:

  • Any primitive mesh created with the Mesh Workbench.
  • Any object created by importing an STL, OBJ, and similar mesh format files.

Scripting

See also: FreeCAD Scripting Basics, and scripted objects. For a full list of attributes and methods, consult the source documentation, and the Std PythonHelp tool.

All objects derived from Mesh::Feature will have a Mesh MeshObject, which is normally accessible from its Mesh attribute.

import FreeCAD as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("Mesh::Cube", "Cube")
App.ActiveDocument.recompute()
print(obj.Mesh)

A MeshObject has many attributes (variables) and methods that contain information about it, and which allow doing operations with it. These variables and methods can be tested in the Python console.

print(obj.Mesh.Area)
print(obj.Mesh.BoundBox)
print(obj.Mesh.CountPoints)
print(obj.Mesh.Volume)

obj.Mesh.copy()
obj.Mesh.countComponents()
obj.Mesh.getEigenSystem()
obj.Mesh.write("my_file.stl")