Siatka: Obiekt siatki

From FreeCAD Documentation
Revision as of 09:27, 18 December 2022 by Kaktus (talk | contribs) (Created page with "==Użycie==")
Other languages:

Opis

Siatka: Obiekt siatki, lub formalnie Mesh::MeshObject, jest klasą, która definiuje strukturę danych siatki w oprogramowaniu. Jest to podobne do obiektu Część: Kształt topologiczny, ale dla siatek.

Siatki są zwykle tworzone za pomocą środowiska pracy Projekt Siatki lub importowane z plików STL, OBJ i podobnych formatów siatek.

Proszę zauważyć, że środowisko pracy MES również wykorzystuje siatki, ale w tym przypadku używa innej struktury danych, zwanej MES: Siatka (klasa Fem::FemMesh). Ta informacja nie dotyczy siatek MES.

Uproszczony schemat zależności pomiędzy podstawowymi obiektami programu. Klasa Mesh::MeshObject jest osadzona w obiekcie Mesh::Feature i stamtąd jest propagowana do wszystkich obiektów, które są od niej pochodne.

Użycie

The Mesh MeshObject is an object that is assigned to some App 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")