Part TopoShape/ru: Difference between revisions
(Created page with "== Программирование ==") |
(Created page with "== Программирование ==") |
(No difference)
|
Latest revision as of 05:41, 17 August 2022
Введение
A Part TopoShape, or formally a Part::TopoShape
, is a class that defines a parametric topological shape in the software. Objects in the document that show something in the 3D view normally have a TopoShape.
The topological shapes, as well as their methods, are defined by the OpenCASCADE Technology kernel (OCCT). FreeCAD uses these shapes, and builds App DocumentObjects around them.
Another type of class is that of meshes; this class is not very parametric because it can't be redefined easily except by specifying individual vertices and triangular surfaces.
Left: parametric Part TopoShape defined by properties. Right: non-parametric mesh, defined by vertices and triangular surfaces.
Simplified diagram of the relationships between the core objects in the program. The Part::TopoShape
class is embedded in the Part::Feature
object and from there it is propagated to all objects that are derived from it.
Применение
The Part TopoShape is an object that is assigned to some App DocumentObjects.
In particular, the basic object that handles these types of attributes is the Part Feature (Part::Feature
class). All objects derived from this class will have access to a Part TopoShape.
Some of the most important objects with Part TopoShape are the following:
- Any primitive solid created with the Part Workbench.
- Any PartDesign Body and PartDesign Feature created with the PartDesign Workbench.
- Any object derived from Part Part2DObject, like most objects created with the Draft Workbench.
- Any sketch, that is, Sketcher SketchObject, created with the Sketcher Workbench.
- Any object created by importing a STEP, BREP, and similar solid format files.
Программирование
See also: FreeCAD Scripting Basics, and scripted objects.
All objects derived from Part::Feature
will have a Part TopoShape, which is normally accessible from its Shape
attribute.
import FreeCAD as App
doc = App.newDocument()
obj = App.ActiveDocument.addObject("Part::Box", "Box")
print(obj.Shape)
A TopoShape 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.Shape.Area)
print(obj.Shape.BoundBox)
print(obj.Shape.CenterOfMass)
print(obj.Shape.ShapeType)
obj.Shape.check()
obj.Shape.copy()
obj.Shape.exportStep("my_file.step")
obj.Shape.exportStl("my_file.stl")
For a full list of attributes and methods, consult the source documentation, and the Std PythonHelp tool.
You can obtain a quick summary of all methods using Python's built-in help()
function.
help(obj.Shape)
- Примитивы: Куб(Параллелограмм), Конус, Цилиндр, Сфера, Тор, Полый цилиндр,Примитивы, Связующие формы
- Создание и правка: Выдавливание, Построение фигуры вращения, Отражение, Скругление, Фаска, Создать плоскость из граней, Ruled Surface, Профиль, Sweep, Section, Cross sections, 3D Offset, 2D Offset, Создать полый объект, Projection on surface, Прикрепление
- Булевы операции: Соединить, Разорвать связь, Compound Filter, Булевы операции, Cut, Fuse, Common, Connect, Embed, Cutout, Boolean fragments, Slice apart, Slice, XOR
- Измерительные: Measure Linear, Measure Angular, Measure Refresh, Clear All, Toggle All, Toggle 3D, Toggle Delta
- Ядро: App DocumentObject
- Базовые: App FeaturePython, App GeoFeature, Part Feature, Mesh Feature, Fem FemMeshObject
- Внутренние формы: Part TopoShape, Mesh MeshObject, Fem FemMesh
- Структура: App DocumentObjectGroup (Std Group), App Part (Std Part), App Link
- Производное: Part Part2DObject, Sketcher SketchObject, PartDesign Body, PartDesign Feature
- Начинающим
- Установка: Загрузка, Windows, Linux, Mac, Дополнительных компонентов, Docker, AppImage, Ubuntu Snap
- Базовая: О FreeCAD, Интерфейс, Навигация мыши, Методы выделения, Имя объекта, Настройки, Верстаки, Структура документа, Свойства, Помоги FreeCAD, Пожертвования
- Помощь: Учебники, Видео учебники
- Верстаки: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Start, Surface, TechDraw, Test Framework, Web